Self Studies

Operating System Test 2

Result Self Studies

Operating System Test 2
  • Score

    -

    out of -
  • Rank

    -

    out of -
TIME Taken - -
Self Studies

SHARING IS CARING

If our Website helped you a little, then kindly spread our voice using Social Networks. Spread our word to your readers, friends, teachers, students & all those close ones who deserve to know what you know now.

Self Studies Self Studies
Weekly Quiz Competition
  • Question 1
    1 / -0
    Shortest job first scheduling algorithm uses _______ data structure and has ________ time complexity.
    Solution

    Shortest job first scheduling algorithm uses min heap data structure for its implementation. 

    If there are n tasks and each task has to be inserted to the heap and later extracted from the heap, it results in a running time of O(nlogn).

    Therefore, Shortest job first scheduling algorithm uses min heap data structure and has O(nlogn) time complexity.​

  • Question 2
    1 / -0

    The length of seventh CPU burst is 8 ms and its corresponding predicted CPU burst is 6 ms. The smoothening factor is 0.7. What is the predicted value of the eighth CPU burst in milliseconds? (answer up to 1 decimal places)

    Solution

    Data:

    7th burst time = t7 = 8 ms

    \({\tau _7}\) = 6

    α = 0.7

    Formula:

    \({\tau _{n + 1}} = \;\alpha {t_n} + \left( {1 - \alpha } \right){\tau _n}\)

    Calculation:

    \({\tau _8}\) = 0.7(8) + (0.3)6

    \({\tau _8}\) = 5.6 + 1.8 = 7.4 ms

  • Question 3
    1 / -0
    Which of the following is/are about the Round robin Scheduling Algorithm?
    Solution

    The performance of the Round Robin algorithm depends heavily on the size of the time quantum.

    • If time quantum is too large, RR reduces to the FCFS algorithm.
    • If time quantum is too small, overhead increases due to the amount of context switching needed.

    Round robin scheduling algorithm is designed especially for time-sharing systems

    Average waiting is Shortest remaining time first is always less than or equal to round robin scheduling algorithm. Therefore option 4 is not true.

  • Question 4
    1 / -0

    Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is pre-emptive shortest remaining-time first. 

    Process

    Arrival Time

    Burst Time

    P1

    0

    11

    P2

    3

    6

    P3

    7

    1

    P4

    8

    3

     

    The absolute difference between the average turnaround time and the waiting time and of these processes is_______ milliseconds.
    Solution

    Scheduling Algorithm: Shortest Remaining Time First

    Gantt chart:

    P1

    P2

    P3

    P2

    P4

    P1

    0          3            7           8           10          13        21

    Process Table:

    Process

    Arrival Time (AT)

    Burst Time (BT)

    Completion Time (CT)

    Turn Around Time (TAT)

    Wating time (WT)

    P1

    0

    11

    21

    21

    10

    P2

    3

    6

    10

    7

    1

    P3

    7

    1

    8

    1

    0

    P4

    8

    3

    13

    5

    2

     

    Average turnaround time = \(\frac{{21 + 7 + 1 + 5}}{4} = 8.5\)

    Average waiting time = \(\frac{{10 + 1 + 0 + 2}}{4} = 3.25\)

    | 8.5 - 3.25 | = 5.25

    Important Points:

    TAT = CT - AT

    WT = TAT - BT

  • Question 5
    1 / -0

    Consider the following set of processes, with the arrival time and the CPU burst time given in milliseconds.

    Process Id

    Arrival time

    Burst time

    1

    3

    2

    2

    6

    1

    3

    0

    3

    4

    5

    X

     

    If the average waiting time is 0.75 millisecond for these processes with the shortest job first algorithm then what is the value of X? 

    Solution

    Gantt chart:

    P3

    P1

    P4

    P2

    0             3             5            X+5        X+6

    Process table:

    Process Id

    Arrival Time (AT)

    Burst Time (BT)

    Completion Time (CT)

    Turn Around Time (TAT)

    Waiting Time (WT)

    1

    3

    2

    5

    2

    0

    2

    6

    1

    X + 6

    X

    X - 1

    3

    0

    3

    3

    3

    0

    4

    5

    X

    X + 5

    X

    0

     

    Average waiting time = \(\frac{X -1 }{4} = \frac{3}{4}\)

    X - 1 = 3

    ∴ X = 4 ms

    Important Points:

    TAT = CT – AT

    WT = TAT – BT 

  • Question 6
    1 / -0

    An operating system uses SRTF process scheduling algorithm. Consider the following table for arrival time and execution time.

    Process

    Arrival Time

    CPU burst time

    P1

    0

    8

    P2

    2

    5

    P3

    3

    12

    P4

    3

    10

     

    How many context switches are needed excluding the context switches at time zero and at the end?

    Solution

    Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. This task is known as a context switch. When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run. Context-switch time is pure overhead, because the system does no useful work while switching.

    Gantt chart for above process:

    P1

    P2

    P1

    P4

    P3

     

     Here, total 4 context switch occur. From process P1 to P2, from process P2 to P1, from process P1 to P4  and from P4 to P3. 

  • Question 7
    1 / -0

    Let S = {P1, P2  P3, P} be the set of processes arriving at time 0 and the length of CPU burst time given in milliseconds

    Process

    CPU Burst time (ms)

    P1

    5

    P2

    7

    P3

    6

    P4

    4

     

    Assume that processes being scheduled with Round-Robin Scheduling Algorithm with Time Quantum 4ms and P1 is having the highest priority while P4 is having lowest priority. Then the average waiting time is _________ ms. (Answer up to two decimal places)

    Solution

    Scheduling Algorithm: Round-Robin

    Time Quantum: 4 milliseconds

    Gantt chart:

    P1

    P2

    P3

    P4

    P1

    P2

    P3

     

    0 4 8 12 16 17 20 22

    Process Table:

    Process

    Arrival Time (AT)

    Burst Time (BT)

    Completion Time (CT)

    Turnaround Time (TAT)

    Waiting Time (WT)

    P1

    0

    5

    17

    17

    12

    P2

    0

    7

    20

    20

    13

    P3

    0

    6

    22

    22

    16

    P4

    0

    4

    16

    16

    12

     

    the average waiting time = \(\frac{12+13+16+12}{4} = 13.25\)

    Formula used:

    TAT = CT – AT

    WT = TAT – BT

  • Question 8
    1 / -0

    Consider the following five processes with the length of the CPU burst time given in milliseconds together with their arrival time and priority.

    ProcessArrival TimeBurst timePriority
    P10104
    P2031
    P3382
    P44163
    P5725

    In priority preemptive scheduling the average waiting time will be (Assume lowest number schedule has highest priority)

    Solution

    PROCESS

    CTTAT(CT-AT)WT(TAT-BT)
    P137       37      27
    P23         3       0
    P311         8       0
    P427       23       7
    P539       32      30

    AT: ARRIVAL TIME

    CT:    COMPLETION TIME

    TAT:  TURN AROUND TIME

    WT:    WAITING TIME

    BT:     BURST TIME(CPU TIME)

    GANTT CHART:

    P2(0-3)P3(3-11)P4(11-27)P1(27-37)P5(37-39)
Self Studies
User
Question Analysis
  • Correct -

  • Wrong -

  • Skipped -

My Perfomance
  • Score

    -

    out of -
  • Rank

    -

    out of -
Re-Attempt Weekly Quiz Competition
Selfstudy
Selfstudy
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now