Scheduling Algorithms:
CPU scheduling deals with deciding which
processes in the ready queue to be allocated the CPU.
1. First -Come.First-Serve Scheduling
2. Shortest Job-First Scheduling
3.Priority Scheduling
4.Round-Robin Scheduling
5.Multilevel Queue Scheduling
6.Multilevel Feedback Queue Scheduling
First -Come.First-Serve Scheduling:
-
FCFS is very simple - Just like a FIFO queue
-
code for FCFS scheduling is simple to write and understand
-
is non pre-emptive
-
FCFS is troublesome for time sharing systems.
-
FCFS can take very long waiting times,particularly if the first process to get there takes a long time.
For example,
consider the following three processes:
|
|
||
---|---|---|---|
|
|
||
|
|
||
|
|
If the processes
arrive in the order P1,P2,P3 and are served in FCFS order,we get the
result in the following Gantt Chart:
P1 |
P2 |
P3 |
0 24
27 30
The Waiting time for
process P1 is 0 milliseconds.
The Waiting time for
process P2 is 24 milliseconds.
The Waiting time for
process P3 is 27 milliseconds.
The Average Waiting
time is(0+24+27)/3=17 milliseconds.
Convey Effect:
FCFS can also block
the system in a busy dynamic system in another way, known as the
convoy effect. When one CPU intensive process blocks
the CPU, a number of I/O intensive processes can get backed up behind
it, leaving the I/O devices idle. When the CPU hog finally
relinquishes the CPU, then the I/O processes pass through the CPU
quickly, leaving the CPU idle while everyone queues up for I/O, and
then the cycle repeats itself when the CPU intensive process gets
back to the ready queue.
No comments:
Post a Comment