You are on page 1of 7

Course Code: ITGN 256

Course Title: Introduction to Operating Systems

Semester: Fall Academic Year: 2020-21

Assessment Instrument: Final Exam Assignment Due Date: 26th Nov 2020

Course Instructor: Dr. Alavikunhu Panthakkan Duration:

College/Department: College of Engineering and IT

This assessment instrument assesses the following Course Learning Outcomes (CLO):

Question CLO # CLO Description Question Student


SN Total Mark Mark
Explain how concurrent
Question 1 CLO 2 processes are handled by 7.5
operating system.
Explain the memory
Question 2 CLO3 management in operating 7.5
systems
Total Mark
15
*Linkages to Program Outcomes and Concentration Outcomes are provided in the Syllabus.

Student Name: ..............................Majid..........................................................

Student ID No: ................................. S0000001686..........................................

1
Question No 1:
For the give below scenario of four CPU processes arriving at different times with
different burst time and priority.

Process Arrival Time Burst Time Priority

P1 A1 B1 P1
P2 A2 B2 P2
P3 A3 B3 P3
P4 A4 B4 P4

Student ID number is S0000001686, then Arrival Time, Burst Time and Priority are
calculated using given below table

Arrival Time (A) Burst Time (B) Priority (P)


A1=1 B1= 11 P1 = 2
A2=6 B2= 66 P2 = 10
A3=8 B3= 88 P3 = 7
A4=6 B4= 12 P4 = 8

Under three different CPU scheduling algorithms, do the following tasks


1. Draw the Gant chart for various CPU scheduling algorithm [3 Marks]
ANS:

Gant charts
Gant chart using First Come First Serve (FCFS):
Using Given table:

Processors Arrival Time Burst Priority (P)


(A) Time (B)
P1 A1=1 B1= 11 P1 = 2
P2 A2=6 B2= 66 P2 = 10
P3 A3=8 B3= 88 P3 = 7
P4 A4=6 B4= 12 P4 = 8

P1 P2 P3 P4

0 11 77 165 177

1
Gant chart using Shortest Job First (SJF): -
Using Given Table:

Processors Arrival Time Burst Priority (P)


(A) Time (B)
P1 A1=1 B1= 11 P1 = 2
P2 A2=6 B2= 66 P2 = 10
P3 A3=8 B3= 88 P3 = 7
P4 A4=6 B4= 12 P4 = 8

P1 P4 P2 P3

0 11 23 89 117

2. Calculate the average waiting time for various CPU scheduling algorithm [3
Marks]

Ans:
Case1: First Come First Serve (FCFS) Scheduling algorithm
Given table:
Processor Arrival Burst Priority
s Time (A) Time (B) (P)
P1 1 11 2
P2 6 66 10
P3 8 88 7
P4 6 12 8

Calculate average waiting time through Gant chart


The average time will be = (0+11+77+165) / 4
= 63.25ms
For the above given processes, first P1 will be provided with the CPU resources,

2
 Hence, waiting time for P1 will be 0
 P1 requires 11 ms for completion, hence waiting time for P2 will be 11 ms
 Similarly, waiting time for process P3 will be execution time of P1 + execution time
for P2, which will be (11 + 66) ms = 77 ms.
 For process P4 it will be the sum of execution times of P1, P2 and P3.

The GANTT chart above perfectly represents the waiting time for each process.

Case2: Shortest Job First (SJF) Scheduling algorithm


Processor Arrival Burst Priority
s Time (A) Time (B) (P)
P1 1 11 2
P2 6 66 10
P3 8 88 7
P4 6 12 8

Calculate average waiting time through Gant chart


The average time will be = (0+11+23+89) / 4
= 30.75ms

Case3: Priority Scheduling algorithm


Case4: Round Robin Scheduling algorithm with Time Quantum =6
3. Assignment Q1 Presentation and Questions [1.5 Marks]

3
Question No 2:
Calculate the total head movement with detailed head movement diagram of the given
Queue for various below mentioned Disk Scheduling Algorithm
Case1: FCFS Scheduling [2 Marks]
Case2: SSTF Scheduling [2 Marks]
Case3: SCAN Scheduling [2 Marks]

Queue = 110,56, 150, 60, 180, 30, 90, 58


Head starts at 60
Assignment Q2 Presentation and Questions [1.5 Marks]
Student ID number is S0000001686, then id1=1, id2=6, id3=8
and id4=6

ANS:
Case 1: Using FCFS
Given Queue = 110,56,150,60,180,30,90,58
Starting head = 60

Diagram

0 30 56 58 60 90 110 150 180 190

4
Now calculate total heads

Total= (110-60) + (110-56) + (56-150) + (150-56) + (150-60) + (60-150) + (60-180) +


(180-60) + (180-30) + (30-180) + (30-90) + (90-30) + (90-58) + (58-90)
= 50+54-94+94+90-90-120+120+150-150-60+60+32-32
=104

Case 2: Using SSTF


Given Queue = 110,56,150,60,180,30,90,58
Starting head = 60

Diagram

0 30 56 58 60 90 110 150 180 190

Now calculate total heads


Total= (60-30) + (180-60)
5
= 150

Instructions:

1. This is a group assignment with maximum of 3 students in each group

2. Each group should submit Softcopy of Report via Moodle

3. Each group should demonstrate the final exam assignment through a


presentation (10-15 minutes)

You might also like