0% found this document useful (0 votes)
19 views1 page

Solved Homework OS

The document outlines a university examination for a course on operating systems, detailing a set of processes with their CPU-burst times and arrival times. It includes a question on calculating the average waiting time for various scheduling algorithms: FCFS, SJF, and Shortest Remaining Time. The document also provides a Gantt chart for the FCFS algorithm and begins to outline the Gantt chart for the Shortest Remaining Time algorithm.

Uploaded by

Yousef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Solved Homework OS

The document outlines a university examination for a course on operating systems, detailing a set of processes with their CPU-burst times and arrival times. It includes a question on calculating the average waiting time for various scheduling algorithms: FCFS, SJF, and Shortest Remaining Time. The document also provides a Gantt chart for the FCFS algorithm and begins to outline the Gantt chart for the Shortest Remaining Time algorithm.

Uploaded by

Yousef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

‫الـمـمـلكـة الـعـربـيـة الـسـعـوديـة‬ ‫بسم الله الرحمن الرحيم‬ 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

You might also like