GATE / CS ARCHIVE

GATE CSE 2015 SET 1 / QUESTION 52

GATE CSE 2015 Set 1 Q52

Operating Systems · CPU Scheduling · Full GATE CSE 2015 Set 1 paper

GATE 2015 Set 1, Q52 2 marks · NAT
Report issue

CPU Scheduling

Question 52, GATE 2015: A preemptive uniprocessor runs periodic T1,T2,T3 with periods 3,7,20 ms and execution times 1,2,4 ms. Shorter period means higher priority. All first jobs arrive at the beginning of millisecond 1. At the end of which millisecond does first T3 finish?
Tap to enlarge
Answer & solution

Official answer: 12

Set time zero at that initial arrival. T1 releases at 0,3,6,9; T2 at 0,7. First T3 starts at 4 after T1,T2,T1 consume four units, gets two units until time 6, then waits while T1,T2,T1 run through time 10. It completes its remaining two units in [10,12). Thus the finish is the end of the twelfth millisecond, not the beginning of millisecond 12. No context-switch overhead is supplied.

Solution: With time 0 at the beginning of the first millisecond, rate-monotonic priorities are T1>T2>T3. Execute T1: 0–1, T2: 1–3, T1: 3–4, T3: 4–6, T1: 6–7, T2: 7–9, T1: 9–10, T3: 10–12. The first T3 job receives its required 4ms and finishes at time 12, the end of the twelfth millisecond. Context-switch overhead is unspecified and taken as zero.

Original paper, page 20 · Answer key