Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider a system running 2 (two) CPU-bound tasks and 4 (four) I/O-bound tasks.

ID: 3871571 • Letter: C

Question

Consider a system running 2 (two) CPU-bound tasks and 4 (four) I/O-bound tasks. Each I/O bound task issues an I/O operation once every 1 millisecond of CPU. Each I/O operation takes 4 milliseconds. Assume that there is only one I/O device (so multiple I/O requests may have to queue). Assume that the context switch takes 0.2 milliseconds. Assume that each CPU-bound requires 10 milliseconds of CPU to complete and each I/O-bound task requires 2 milliseconds of CPU time. Show through a Ganttt chart how the I/O and CPU are allocated and compute the average turnaround times for the CPU-bound and I/O bound tasks.

Explanation / Answer

cpu bound process p1 and p2,io bound process p3,p4,p5,p6

all arrive at t=0 so we use fcfs and use them by their number

process no       arrival time          cpu time       io1            io2          completion time tat

p1                      0                        10              0               0              10.2                  10.2

p2                      0                         10              0               0              20.4                  20.4

p3                      0                          2               4                4               31                    31

p4                      0                          2               4                4                35                   35

p5                      0                         2                  4               4               39                   39

p6                      0                         2                    4              4              43                    43

average turn around time=10.2+20.4+31+35+39+43/6

                                   178.6/6=29.75

i=overhead

0.2

gantt chart            

time 0.2       10.2     10.4    20.4   20.6   21.6   21.8 22.8 23   24   24.2 25.2 25.6 25.8   26.8 29.6 29.8 30.8 31    33.6 33.8 34.8 35 37.6 37.8   38.8   39   42.8   43

i       p1     i    p2    i       p3    i      p4   i    p5    i     p6   idle    i     p3     idle i     p4     i   p3 idle i p5 i p4 idle i p6 i p5 idle i p6