Operating System (CS - 308)

| Back To Operating System Main Page |

| Back To Current Topic Page | Link To Prof. N. Caftori Page |

Any comments or questions send to my  thank you very much.
 ASSIGNMENT I MENU
Question number 1
a. Using FCFS method to find completion time of each jobs
b . Turn around time  . . . of each job
Question number 2
a . SJF algorithm
b . SRTF algorithm
c . Round Robin method
Question number 3
a . Non-preemptive priority algorithm
b . Preemptive priority algorithm

Question number 4

1. Consider the following jobs:
 
Job
Arrival time
Run time
A
0
5C, 3I, 4C, 5I, 3C
B
2
3C, 6I, 4C
C
6
4C, 3I, 7C
 
7
 
A
8 = 5C + 3I
 
 
.
.
.
 
B
14 = 5C + 3C + 6I
 
C
15 = 5C + 3C + 4C + 3I
 
 
.
.
.
 
A
21 = 5C + 3C + 4C + 4C + 5I
 
Back to Menu
a. Using the FCFS method, compute the completion time of each job:
            -*- The Gantt chart:


 


                     From the Gantt chart, we have:

Back to Menu
b. Using the results in (a) compute the turn around time for each job:

                          Apply the formula:

 
Turn around time = Completion time - Arrival time
                          Apply the formula:
 
Weighted turn around time    =
Turn around time
---------------------------
Run time
 
Weighted turn around time of job A    = 
30
-------------
5 + 4 + 3
 = 
30
-------
12
  =   2.5
         
CPU utilization    =
 30 x 100 %
-----------------
30
  =    100 %
Back to Menu
2. Consider the following jobs:
 
 
Job
Arrival time
Run time
A
0
5
B
2
5
C
3
4
D
6
2
Back to Menu
a. Using SJF method, compute the completion times of the jobs and average
           waiting time
                                  From the Gantt chart, we have:

                                                          Completion time of job A = 5
                                                          Completion time of job B = 16
                                                          Completion time of job C = 9
                                                          Completion time of job D = 11

              From the Gantt chart and the given data table, we have:
 

Waiting time 
= 0 + (11 - 2) + (5 - 3) + (9 - 6)
= 0 +       9     +      2     +     3 
= 14
 =>   Average waiting time   = 
14
----------- 
   =   3.5
Back to Menu
b. Using SRTF method, compute the completion times of the jobs and average
           waiting time

               From the Gantt chart, we have:

                                Completion time of job A = 5

                                Completion time of job B = 16

                                Completion time of job C = 11

                                Completion time of job D = 8

                        From the Gantt chart and the given data table, we have:
 

Waiting time 
= 0 + (11 - 2) + (5 - 3) + (8 - 6) + (6 - 6) 
= 0 +     9      +     2     +     2     +     0 
= 13
=>   Average waiting time = 
13
----------
4
  =  3.25
Back to Menu
c. Using the Round Robin method (with time slice = 2 units), compute the time
           of jobs:
 
Job
Arrival Time
Run Time
A
0
5
B
2
5
A
2
3 (Remaining time)
C
3
4
B
4
3 (Remaining time)
D
6
2
A
6
1 (Remaining time)
C
8
2 (Remaining time)
B
10
1 (Remaining time)
 

               From the Gantt chart, we have:

                                Completion time of job A = 13

                                Completion time of job B = 16

                                Completion time of job C = 15

                                Completion time of job D = 10

                        From the Gantt chart and the given data table, we have:
 

Waiting time 
=   (4 - 2) + (12 - 6) + (2 - 2) + (8 - 4)
    + (15 - 10) + (6 - 3) + (13 - 8) + (10 - 6)
=   2 + 6 + 0 + 4 + 5 + 3 + 5 + 4
=   29
 =>   Average waiting time  = 
29
---------
4
=  7.25
Back to Menu
3. Assuming that Job A has low priority, Job B has medium priority,
         and Job C & D have high priority:
 
 
Priority
Job
Arrival time
Run time
Low
A
0
5
Medium
B
2
5
High
C
3
4
High
D
6
2
Back to Menu
a. Using non-preemptive priority algorithm, compute the completion times
           of each jobs and the average waiting time

               From the Gantt chart, we have:

                                Completion time of job A = 5

                                Completion time of job B = 16

                                Completion time of job C = 9

                                Completion time of job D = 11

                        From the Gantt chart and the given data table, we have:
 

Waiting time 
= 0 + (11 - 2) + (5 - 3) + (9 - 6)
= 0 +       9     +      2     +     3
=  14
=>   Average waiting time    =
14
----------
4
=    3.5
Back to Menu
b. Using preemptive priority algorithm, compute the completion times
           of each jobs and the average waiting time

                From the Gantt chart, we have:

                                Completion time of job A = 16

                               Completion time of job B = 13

                                Completion time of job C = 7

                                Completion time of job D = 9

                        From the Gantt chart and the given data table, we have:
 

Waiting time 
= 0 + (13 - 2) + (2 - 2) + (9 - 3) + (3 - 3) + (7 - 6)
= 0 +      11     +     0     +     6     +     0      +    1
=  18
=>   Average waiting time    =
18
----------
4
=   4.5
Back to Menu
4. Write a paragraph about the life of a process

            The life of a process is like the activities of an auto repair center
 

New: The driver drives his car to the auto repair center entrance and asks to enter.
Ready: The car is in the garage and waits for serving.
Interrupt: Garage manager asks the driver what he can help.
Running: And then he checks for the vehicle number, model, make, year . . .
Interrupt: Garage manager asks the driver to go inside to sign the paper.
Running: And then he lets a mechanic do the customer's request (the driver's request).  Example:  Checking the brakes.
I / O waiting: The driver is waiting for the estimated information.
Running : The mechanic is checking the brakes.
Interrupt: The mechanist found something wrong with the brakes.  The brakes' life time are over.  The garage manager asks the driver if he wants to change new ones.  The driver agrees to make the changing.
Running: And then the mechanist replaces the old brakes with the new ones.
I / O waiting: The driver is waiting in the waiting room.
Ready: The mechanist finishes brakes changing, and the car is ready for the driver.
Interrupt: The customer (driver) asks for a road test to make sure if the brakes are done well.
Running: The mechanist and the customer are in the car.  The customer is driving and trying to apply the brakes.
I /O waiting: The driver and the mechanist are waiting for a good brake.
 Ready: Then, they are sure the brakes were done well, and they return to the garage.
Interrupt: The garage manager gives the customer the bill.
Running: The driver goes to the cashier to pay the bill and get the change.
Terminated: The driver says "good bye" to the garage manager and "thank you" for the good service .  And then he takes his car and drives away.
Back to top