Question

In: Computer Science

Processor/CPU Management I Five processes, J1, J2, J3, J4 and J5. arrive in the Ready Queue...

Processor/CPU Management I Five processes, J1, J2, J3, J4 and J5. arrive in the Ready Queue in sequence, one second apart. Each job takes 1 millisecond to load into memory. Each job will take 10, 2, 3, 1, 5 seconds to run respectively.

II In a single user dedicated system such as a personal computer, it is possible for the user to detect if a program is in an infinite loop and stop it manually. Another solution is for the system to terminate an infinite loop automatically. But there are legitimate situations where a program runs for a very long time. Can you propose a way to terminate a program in an infinite loop automatically? Maybe not detecting all of them but at least some of them? Hint: Discuss the potential for those programs that 1. Consume lots of resources (what kind of resources?) in an infinite loop. What happens when resources are consumed ? and 2. Consume no resource except looping needlessly.

Solutions

Expert Solution

1. One way for the system to terminate programs is by imposing resource constraints. Resources can include files opened, memory used, processing time used, threads created, connections opened etc. If any of the resource constraints are exceeded, the process can be stopped. The resource increases requested by the program may be legitimate or it may be because the program is in an infinite loop. Because of the Halting Problem, it is not possible for the system to decide whether a program is running in an infinite loop or not (Halting problem: Alan Turing proved that it is not possible for any program to determine if some other general program will stop running or not). Excessive use of resources by a runaway program can potentially starve other applications and processes of the resources they need, hence it is important to impose constraints on resource usage by an application process.

2. If a program is running in an infinite loop without doing anything, the only resource it is consuming is CPU time, so this is a special case of the previous problem. Again, the system can terminate it for exceeding limits on using a single resource, which is processor time.


Related Solutions

Propose five means for a Dubai based hospital to adopt LEAN supply chain management processes to...
Propose five means for a Dubai based hospital to adopt LEAN supply chain management processes to optimize service availability during COVID-19 epidemic (5 points). Name five ways how service organizations specifically can apply LEAN (5 points).
How does segmentation differ from paging? How does memory management facilitate processor and I/O usage? How...
How does segmentation differ from paging? How does memory management facilitate processor and I/O usage? How does page size affect fault rate? 4. Describe the approach where segmentation is combined paging
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT