NPTEL Operating System Fundamentals Week 6 Assignment Answers 2024
1. Assume that the following processes are scheduled using the Shortest-Job-First process scheduling policy. Determine the average waiting time.
Process | Arrival time | Burst time |
P1 | 1 | 3 |
P2 | 0 | 2 |
P3 | 3 | 2 |
P4 | 2 | 4 |
(A) 3.5
(B) 2.5
(C) 1.5
(D) 4.5
(E) 0.5
Answer :- For Answers Click Here
2. Choose the correct statement about “Exponential Averaging” when predicting the next CPU burst length in SJF scheduling.
(A) Exponential Averaging gives equal weight to all past CPU bursts.
(B) Exponential Averaging discards all previous history when predicting the next burst length.
(C) Exponential Averaging gives more weight to the recent CPU bursts while still considering the entire history.
(D) Exponential Averaging is only applicable to non-preemptive scheduling algorithms.
(E) Exponential Averaging requires a fixed-size queue to store past burst length
Answer :- For Answers Click Here
3. The following processes are scheduled using the Robin process scheduling policy with a time quantum of 3ms. Determine the average waiting time.
Process | Arrival time | Burst time |
P1 | 0 | 6 |
P2 | 1 | 2 |
P3 | 3 | 8 |
P4 | 5 | 3 |
P5 | 2 | 4 |
(A) 5.6
(B) 8.6
(C) 7.6
(D) 4.5
(E) 6.6
Answer :- For Answers Click Here
4. Assume the following processes are scheduled using the Priority Scheduling process scheduling algorithm. Determine the average waiting time. Assume a lower value in priority means higher priority.
Process | Priority | Burst time | Arrival time |
P1 | 2 | 2 | 0 |
P1 | 1 | 3 | 0 |
P3 | 3 | 5 | 0 |
P4 | 5 | 7 | 0 |
P5 | 4 | 4 | 0 |
(A) 6.4
(B) 5.0
(C) 6.8
(D) 5.8
(E) 5.2
Answer :-
5. Which of the following process scheduling algorithms does not suffer from the starvation problem?
(A) Shortest Job First (SJF)
(B) Priority Scheduling
(C) Shortest Remaining Time First (SRTF)
(D) First-Come First-Served (FCFS)
(E) Multilevel Queue Scheduling
Answer :-
6. The “Progress” condition in the context of the Critical Section Problem refers
(A) If no process is in the critical section and some processes wish to enter it, the selection of the next process must not be indefinitely postponed.
(B) Only one process can be in the critical section at a time.
(C) No process should wait forever to enter the critical section.
(D) If a process is in the critical section, no other process can enter until it has finished.
(E) Processes must be allowed to enter the critical section based on their priority.
Answer :- For Answers Click Here
7. The “race condition” in the context of the critical section problem
(A) occurs when multiple processes enter their critical sections simultaneously, leading to unpredictable results.
(B) happens when a process is forced to wait indefinitely before entering its critical section.
(C) arises when the OS fails to schedule processes fairly.
(D) refers to the situation where two or more processes compete for CPU.
(E) is a condition where a process preempts another process in the middle of its critical section.
Answer :-
8. The solution to the critical section problem ensures which of the following(s)?
(A) Mutual exclusion
(B) Progress
(C) Bounded waiting
(D) Mutual Exclusion and Progress
(E) Mutual exclusion, Progress, and Bounded waiting
Answer :-
9. Consider the producer-consumer problem with a bounded buffer. The processes share a variable “count”. The initial value of the count is 5, and the maximum size of the buffer is 10.
Producer process | Consumer process |
while (true) { /* produce an item in next produced / while (count == BUFFER_SIZE); / do nothing */ buffer[in] = next_produced; in = (in + 1) % BUFFER_SIZE; count = count +1; } | while (true) { while (count == 0); /* do nothing / next_consumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; count = count – 1; / consume the item in the next consumed */ } |
The statement count = count + 1 is implemented as
SP0: register1 = count
SP1: register1 = register1 + 1
SP2: count = register1
The statement count = count – 1 is implemented as SC0: register2 = count SC1: register2 = register2 – 1 SC2: count = register2
Assume that the CPU schedules the producer-consumer problem as follows: SP0, SC0, SP1, SC1, SP2, and SC2. What is the final value of the count?
(A) 6
(B) 4
(C) 5
(D) 3
(E) 2
Answer :-
10. To solve the critical section problem, the general structure of a process Pi includes
(A) entry section
(B) exit section
(C) critical section
(D) remainder section
(E) All of the above
Answer :- For Answers Click Here