الـمـمـلكـة الـعـربـيـة الـسـعـوديـة بسم الله الرحمن الرحيم Kingdom of Saudi Arabia
وزارة الـتـعـلـيـم الـعـالـي Ministry of Higher Education
جـامـعـة الـمـجـمـعـة Majmaah University
كلية العلوم بالزلفي
College Of Sciences in Alzulfi
-:المستوى -: رقم ورمز المادة نظم التشغيل -: اسم المادة
-:تاريخ اإلمتحان -: الرقم الجامعي -: اسم الطالب
28/12/1435
Question 4:
Consider the following set of processes, with the length of the CPU-burst time given in
milliseconds.
Process Burst time Arrival Time
P1 5 0
P2 4 0
P3 3 1
P4 6 2
P5 2 2
Calculate he average waiting time for each of FCFS, SJF and Shortest Remaining Time
scheduler algorithms. Which algorithm is the best.
Solution:
FCFS Gantt chart:
P1 P2 P3 P4 P5
0 5 9 12 18 20
It is correct p1 , p2 arrive at the same time so p1 then p2
Or start with p, p1,p3,p5,p4. Or both are correct.
Shortest Remaining Time Gantt chart: ( can you please solve it?)
P2 P5 P3 P1 P4
0 4 6 9 14 20
التوضيح:
At time t=0: p2 start because it is shortest
At time t=1: p3 arrive, p2 continue because it is shortest remaining 3 = to p3
At time t=2: p4, p5 arrive, p2 continue because it is shortest remaining 2 = to p5