# hw3 - 16 J1 J2 J1 J3 J4 J1 J3 J1 J1 J1 J2 J3 J4 1 4 5 6 10...

This preview shows pages 1–3. Sign up to view the full content.

CPSC435 (W2008) Operating Systems Answer Key for Assignment 3 1. Given the following information: Job Number Arrival Time CPU Time J1 0 10 J2 1 2 J3 2 3 J4 3 1 Draw A Gantt Chart ( i.e. timeline) for each of the following scheduling algorithms. a. FCFS b. SJF c. SRT J1 J2 J3 J4 0 1 2 3 10 12 15 J4 16 J1 J2 J3 J1 J2 J3 J4 0 1 2 3 10 11 13 16 J4 J2 J3 J1 J1 J2 J3 J4 0 1 2 3 4 7 16 J1 J2 J2 J4 J3 J1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
d. Round Robin with a time quantum of 2 (you may ignore context switching time) case 1: J3 is put in the queue before J1 case 2: J1 is put in the queue before J3 2. Determine the turnaround time and waiting time for each of the jobs shown in the following Gantt chart. TAT J1 = 20 – 0 = 20 W J1 = (10 - 5) + (18 – 13) = 10 TAT J2 = 18 – 1 = 17 W J2 = (6 – 1) + (17 – 10) = 12 TAT J3 = 6 – 3 = 3 W J3 = (5 – 3) = 2 TAT J4 = 17 – 4 = 13 W J4 = (13 – 4) = 9 J1 J2 J3 J4 0 1 2 3 4 6 8 9 10 12 14 16 J1 J2 J3 J1 J4 J3 J1 J1 J1 J1 J2 J3 J4 0 1 2 3 4 6 8 9 11 12 14
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 16 J1 J2 J1 J3 J4 J1 J3 J1 J1 J1 J2 J3 J4 1 4 5 6 10 13 17 18 20 2 3 J1 J3 J2 J1 J4 J2 J1 2 3. Given the following timeline: Determine the priority (P) at t = 2 for processes P1 and P2 shown above for each of the following scheduling algorithms. ( Hint : use the approach shown on pp. 155-156 in the textbook). Note P1 arrives at t = 2 and P2 arrives at t = 1. We assume P2 gets the CPU immediately upon its arrival at t = 1. a. FCFS P(P1) = r P1 = 0 – 0 = 0 P(P2) = r P2 = (2 – 1) = 1 b. SJF P(P1) = -t P1 = -(4 – 2) = -2 P(P2) = -t P2 = -(6 – 1) = -5 c. SRT P(P1) = -(t P1 – a P1 ) = -(4 – 2) = -2 P(P2) = -(t P2 – a P2 ) = -(6 – 2) = -4 3 1 2 3 4 5 6 7 P1 P2...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

hw3 - 16 J1 J2 J1 J3 J4 J1 J3 J1 J1 J1 J2 J3 J4 1 4 5 6 10...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online