GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 24(a)

Minimum average job response

Operating Systems · CPU Scheduling · Full GATE CSE 1998 paper

GATE 1998, Q24(a) Descriptive
Report issue

CPU Scheduling

Question 24(a), GATE 1998: Four jobs with expected run times 6,3,5,x are waiting. In what order should they run to minimize average response time?
Question 24(a), GATE 1998: Four jobs with expected run times 6,3,5,x are waiting. In what order should they run to minimize average response time?
Tap to enlarge
Answer & solution

Answer: Shortest expected processing time first, subject to standard all-arrived nonpreemptive assumptions. (no official key was published)

Assume one processor, all four jobs ready at time zero, no scheduling overhead, and response interpreted as time to completion (or waiting time to first execution under nonpreemptive execution). Consider adjacent jobs of lengths a>b starting at time t. Their completion-time sum in order a,b is (t+a)+(t+a+b)=2t+2a+b. Reversing them gives 2t+2b+a, smaller by a−b. Other jobs' completion times do not change, because the pair's total length is unchanged. Repeatedly removing inversions proves ascending processing time is optimal.

Thus for x≥0: if x≤3, use x,3,5,6; if 3≤x≤5, use 3,x,5,6; if 5≤x≤6, use 3,5,x,6; if x≥6, use 3,5,6,x. Ties can be broken either way. For random run times the same exchange proof minimizes expected mean completion using their expected durations, when the decision is a fixed order and those expectations are known.

The answer is not a universal interactive-response policy: different release times, preemption or defining response as first service with arbitrarily small time slices changes the optimization problem. These are not specified, so the conventional nonpreemptive model is stated.

Original paper, page 8