Saturday, December 5, 2009

Comer (XINU) Algorithm Examples

1. Consider disk arm scheduling algorithms. Assume that the disk has 200 cylinders numbered 0...199. The request queue is 10, 15, 9, 20, 40, 2. How will the queue look like after adding 23 and 45.

Try to find two requests R1 and R2 such that the head will pass the new request on its way from R1 to R2. If there exists two requests like that squeeze the new request in between. If there exists no such requests add new request to the end of the queue

23 can be squeezed in between 20 and 40.
Queue is 10,15, 9, 20, 23, 40, 2

45 cannot be squeezed in since there is no Request(i) such that 45 is in between Request(i)and Request(i-1). So add 45 to the end of the queue.

Queue is updated to 10,15, 9, 20, 23, 40, 2, 45

2. Disk requests arrive in the order 26, 79, 96, 27, 8 . In what order will XINU algorithms service the requests above.

26
26,79 - added to the end
26,79,96 - added to the end
26, 27, 79, 96 - 27 is squeezed in.
26, 27, 79, 96, 8 - 8 is added in the end.

3. Disk requests arrive in the order 50, 100, 75, 25, 125 . In what order will XINU algorithms service the requests above.

50
50,100 - added to the end
50, 75, 100 - 75 is squeezed in
50, 75, 100, 25 -25 is added to the end, but this will force redirection
50, 75, 100, 25, 125 - added to the end

4. When is XINU better than LOOK.
Consider block numbers 50, 60,40,100

XINU : head movement = 10+ 20+60 = 90
LOOK : order of processing is 50, 60, 100, 40
head movement = 10+ 40+ 60 = 110
Here XINU is better than LOOK
Since XINU will force redirection after processing 60 to process 40 overall head movement is less than LOOK.

No comments:

Post a Comment