
We’ve looked at a number of different scheduling algorithms. Which one works the best is application dependent. General purpose OS will use priority based, round robin, preemptive
This is a non-pre-emptive, pre-emptive scheduling algorithm. Best approach to minimize waiting time. Easy to implement in Batch systems where required CPU time is known in advance.
Urban legend about IBM 7074 at MIT: when shut down in 1973, low-priority processes were found which had been submitted in 1967 and had not yet been run... This is the biggest problem with static priority systems: a low priority process is not guaranteed to run — ever!
The Process Scheduler schedule different processes to be assigned to the CPU based on particular scheduling algorithm. There are six popular process scheduling algorithms which we are going to discuss in the following section: First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling Priority Scheduling Shortest Remaining Time
How to select CPU-scheduling algorithm for an OS? while (true) { // perform CPU-intensive task . . .
FCFS Scheduling (First Come First Serve) • First job that requests the CPU gets the CPU • Non preemptive –Process continues till the burst cycle ends •Example 6
Each queue can have its own scheduling algorithms. Priorities are assigned to each queue. For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based on the algorithm assigned to the queue.
There are many CPU scheduling algorithm as shown below. First-Come, First-Served nonpreemptive algorithm. It is the simplest of all the scheduling algorithms. The key concept of this algorithm is “The process which comes first in the ready queue will allocate the CPU first”.
What do we learn from this example? T1 tries to acquire L, fails, blocks. T3 enters system at priority 3. What does this method do? ... Is this a good idea? Take a real-time process only if the system can guarantee the “real-time” behavior of all processes. Assume periodic processes. The jobs are schedulable, if the following holds: å Ci £ Ti.
When to schedule? 1. New process created l fork() àchild process created l Schedule parent or child (or both) 2. Process dies and returns exit status l Due to calling exit(), or fatal exception/signal 3. Blocked process l E.g. on I/O and semaphore 4. I/O interrupt 5. HW clock interrupt l E.g., with 250 Hz frequency
- Some results have been removed