Friday, April 19, 2013

Operating System- CS604 Assignment # 2 Solution Fall 2010



Operating System- CS604
Assignment # 2
Solution
Fall 2010
                                                               Marks: 20
Due Date
Your assignment must be uploaded before or on 26th Nov 2010.
Objective
The objective of this assignment is to familiarize with the Scheduling Algorithms

Instructions
Ø  Avoid Plagiarism. No marks will be given in case of cheating or copying from the internet or from other students.
Ø  Submit the assignment through your account on VULMS. No assignment will be accepted through email after the due date.  
Ø  If you have any problem related to assignment, feel free to discuss it by email at cs604@vu.edu.pk

Question # 1:
Part a: [10]
Using Non-preemptive SJF algorithm answer the following questions using the table below:

Process
Arrival Time
Burst Time
P2
0.0
12
P3
3.0
8
P4
5.0
4
P1
10.0
10
P5
12.0
6
i-                    Develop Gantt showing the execution of the processes in the order mentioned.
ii-                  Waiting times for each process.
iii-                Average waiting time.

i. Gantt Chart

P2
P4
P5
P3
P1
0                            12          16              22                    30                         40

ii.

Waiting Time for P1 = 30-10 = 20
Waiting Time for P2 = 0-0     = 0
Waiting Time for P3 = 22-3   = 19
Waiting Time for P4 = 12-5   = 7
Waiting Time for P5 = 16-12 = 4

iii.

Average Waiting Time = (20 + 0 + 19 + 7 + 4) / 5
                                = 50 / 5
                                = 10

 Part b: 10
Using Preemptive SJF algorithm answer the following questions using the same table:
i-                    Develop Gantt showing the execution of the processes in the order mentioned.
ii-                  Waiting times for each process.
iii-                Average waiting time.

i. Gantt Chart

P2
P3
P4
P3
P3
P3
P5
P2
P1
0            3       5              9     10     12         15                 21                      30                            40



ii.

Waiting Time for P1 = 40-10-10 = 20
Waiting Time for P2 = 30-0-12   = 18
Waiting Time for P3 = 15-3-8     = 4
Waiting Time for P4 = 9-5-4       = 0
Waiting Time for P5 = 21-12-6   = 3

iii.

Average Waiting Time = (20 + 18 + 4 + 0 + 3) / 5
                                = 45 / 5
                                = 9

No comments:

Post a Comment