6 thoughts on “Tutorial 5

  1. i don’t understand q1 part c: Round Robin’s turnaround time for B.. why is it 15 and not 16? Here is my process trace:

    | A | B | A | B | A | A | X | A | A | B | A | B | A | X | X | X |
    | B submitted
    | B runs | B ends

    is there something i misinterpreted? thanks for any help!

    • i meant to label the positions where b is submitted, started and ended.. hope its still understandable ><

      • Assuming the time taken to join the queue is negligible, B will finish its last unit of I/O processing at the 8th time unit and join the queue immediately. A

        At the 9th time unit, A will use up its time quantum and CPU will pick B from the queue.

        Mm, correct me if I’m wrong~

        • shouldn’t B finish its last unit of I/O processing of the first run at the 9th time unit? this is the diagram that i drew:

          C: ABABAA AABABA
          O: BBABB BABBB

          *C means CPU and O means I/O

          correct me if i’m wrong.

          • i think we made the same mistake in interpretation…

            think about the Round Robin as a Q that keep moving… lets label the pieces..

            B1|B2|B3i/o|B4i/o|B5i/o|B6i/o|B7| B8|B9i/o|B10i/o| B11i/o|B12i/o

            Queue <— A1 <—- B1

            when A finish, it moves to the back

            Queue <—B1 <— A2

            when it comes to a point that after B executes, it do I/O, means it wont join the queue

            Queue <—-B2 <—-A3
            Queue <—-A3

            when this instance of A finish, it immediately joins the queue and runs immediately

            Queue <—-A4

            when A4 finish, next one A5 is an I/O so the queue becomes empty. after A finish I/O, immediately joins queue because B is still busy wif I/O

            Queue<— A6

            now, when that A6 is running (near the end of the time quantum), B6 finish I/O, B7 immediately joins the queue

            Queue <— A6 <—- B7

            when A6 finish, A7 will join the queue… but since B7 is there already, B7 will run first


            Thats why the process trace is


  2. Hi prof,
    Sorry if this is trivial, but when I was revising Tut 5, this doubt came up. This is regarding question 1. So, when the processes will be running FCFS, I think this will be the execution order –
    First 4 units – compute of A will execute
    Units 5 – 6 => compute of B (since A is blocked for IO)
    Units 7 – 10 => compute of A again (IO of A finishes, B is blocked for IO)
    Units 11 – 12 => compute of B again (A is blocked for IO, IO of B has already finished)
    Unit 12 => A exits (B is blocked for IO and exit takes negligible time)

    So, according to my calculations, I think the answer should be 12. Can anyone please tell me where I am wrong?

Comments are closed.