Module 3.1 Process Scheduling
Module 3.1 Process Scheduling
Module – 3
Medium-term scheduler
It is slower. It is faster.
It controls the multiprogramming degree. It provides less control over the multiprogramming
degree.
It selects the process less frequently. It selects the process more frequently.
It is always present in the Batch OS and can or It is present in the Batch OS and is only minimally
cannot be present at all in the Time-Sharing OS. present in the Time-Sharing OS.
It chooses the processes from the job pool. It chooses the processes from the ready queue.
It chooses a good process that is a mix-up of It chooses a new process for a processor quite
input/output bound and CPU bound. frequently.
In order to remove the process from memory and make space for other
processes, the suspended process should be moved to secondary
storage.
0 24 27 30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
1 12 0
2 6 1
3 9 4
Turnaround Time –
Average Turnaround time = (12+17+23)/3
=17.33ms
Response Time –
Average Response Time = (0+11+14)/3 = 8.33ms
1 10 0
2 29 0
3 3 0
4 7 0
5 12 0
0 3 6 30
P1 P3 P2 P4
0 3 7 8 12 16
0 2 4 5 7 11 16
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
Three queues:
Q0 – RR with time quantum 8 milliseconds
Q1 – RR time quantum 16 milliseconds
Q2 – FCFS
Scheduling
A new job enters queue Q0 which is served FCFS.
When it gains CPU, job receives 8 milliseconds. If it
does not finish in 8 milliseconds, job is moved to
queue Q1.
At Q1 job is again served FCFS and receives 16
additional milliseconds. If it still does not complete,
it is preempted and moved to queue Q2.
• Solaris scheduling
• Windows XP scheduling
• Linux scheduling
while (true) {
// perform CPU-intensive task
...
Thread.yield();
}
Priority Comment
Thread.MIN_PRIORITY Minimum Thread Priority
Thread.MAX_PRIORITY Maximum Thread Priority
Thread.NORM_PRIORITY Default Thread
Priority