Operating systems miscellaneous


Operating systems miscellaneous

  1. Consider a uni processor system executing three tasks T1, T2 and T3, each o which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3, 7 and 20 milliseconds, respectively. The priority of each task is the inverse of its period, and the available tasks are scheduled in order of priority, with the highest priority task scheduled first. Each instance of T1, T2 and T3 requires an execution time of 1, 2 and 4 milliseconds, respectively. Given that all tasks initially arrive at the beginning of the 1st millisecond and task preemptions are allowed, the first instance of T3 completes its execution at the end of ______ milliseconds.









  1. View Hint View Answer Discuss in Forum

    Correct Option: B


  1. Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remainingtime first.

    The average turnaround time of these processes is ________ milliseconds.









  1. View Hint View Answer Discuss in Forum

    Due to SRTF preemption

    ∵ Completion Time = Arrival Time + Process Turn Around Time
    ∴ Process Turn Around Time = Completion Time – Arrival Time

    P1 20
    P2 7
    P3 1
    P4 5

    Average Turn Around Time (TAT) = 33 / 4 = 8.25

    Correct Option: A

    Due to SRTF preemption

    ∵ Completion Time = Arrival Time + Process Turn Around Time
    ∴ Process Turn Around Time = Completion Time – Arrival Time

    P1 20
    P2 7
    P3 1
    P4 5

    Average Turn Around Time (TAT) = 33 / 4 = 8.25



  1. Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue?









  1. View Hint View Answer Discuss in Forum

    SRTF is the preemptive SJF which generates less average waiting time in which jobs are schedule according to shortest remaining time.

    Correct Option: A

    SRTF is the preemptive SJF which generates less average waiting time in which jobs are schedule according to shortest remaining time.


  1. Consider the set of processes with arrival time (in milliseconds). CPU burst time (in milliseconds) and priority (0 is the highest priority) shown below. None of the processes have I/O burst time.
    Process Arrival Time Burst Time Priority
    P1 0 11 2
    P2 5 28 0
    P3 12 2 3
    P4 2 10 1
    P5 9 164

    The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is ________.









  1. View Hint View Answer Discuss in Forum


    Gantt chart for above problem looks like:

    Waiting Time = (Completion time – Arrival time – Burst time).
    ∑AT = (0 + 5 + 12 + 2 + 9) = 28
    ∑BT = (11 + 28 + 2 + 10 + 16) = 67
    ∑CT = (67 + 51 + 49 + 40 + 33) = 240
    Waiting time = (240 – 28 – 67) = 145

    Average Waiting time =
    145
    = 29 ms
    5

    Hence, 29 ms is correct answer.

    Correct Option: D


    Gantt chart for above problem looks like:

    Waiting Time = (Completion time – Arrival time – Burst time).
    ∑AT = (0 + 5 + 12 + 2 + 9) = 28
    ∑BT = (11 + 28 + 2 + 10 + 16) = 67
    ∑CT = (67 + 51 + 49 + 40 + 33) = 240
    Waiting time = (240 – 28 – 67) = 145

    Average Waiting time =
    145
    = 29 ms
    5

    Hence, 29 ms is correct answer.



  1. Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below:

    If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.









  1. View Hint View Answer Discuss in Forum


    So, turn around time is for P1 ,P2 ,P3 ,P4 are :
    P1 ⇒ (12 - 0) , P2 ⇒ (6 - 3), P3 ⇒ (17 - 5) , P4 ⇒ (8 - 6),
    ⇒ P1 = 12 , P2 = 3 , P3 = 12 , P4 = 2
    As we know that Waiting time = Turn around time - Burst time
    So, waiting time for P1 ,P2 ,P3 ,P4 are :
    P1 ⇒ (12 - 7) = 5
    P2 ⇒ (3 - 3) = 0
    P3 ⇒ (12 - 5) = 7
    P4 ⇒ (2 - 2) = 0

    Hence, avg. waiting time =
    P1 + P2 + P3 + P4
    =
    5 + 7
    = 3.0
    44

    Correct Option: B


    So, turn around time is for P1 ,P2 ,P3 ,P4 are :
    P1 ⇒ (12 - 0) , P2 ⇒ (6 - 3), P3 ⇒ (17 - 5) , P4 ⇒ (8 - 6),
    ⇒ P1 = 12 , P2 = 3 , P3 = 12 , P4 = 2
    As we know that Waiting time = Turn around time - Burst time
    So, waiting time for P1 ,P2 ,P3 ,P4 are :
    P1 ⇒ (12 - 7) = 5
    P2 ⇒ (3 - 3) = 0
    P3 ⇒ (12 - 5) = 7
    P4 ⇒ (2 - 2) = 0

    Hence, avg. waiting time =
    P1 + P2 + P3 + P4
    =
    5 + 7
    = 3.0
    44