jssp181@gmail.
com
NPTEL » Operating System Fundamentals
Course outline
About NPTEL
How does an NPTEL online course work?
Week 0
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Lecture 26 : Scheduling (Contd.)
Lecture 27 : Scheduling (Contd.)
Lecture 28 : Scheduling (Contd.)
Lecture 29 : Process Synchronization
Lecture 30 : Process Synchronization (Contd.)
Lecture Materials
Feedback for week 6
Quiz: Week 6 : Assignment 6
Assignment 6 Solution
Week 7
Week 8
Week 9
Week 10
Week 11
Download Videos
Text Transcripts
Books
Problem Solving Session - July 2024
Week 6 : Assignment 6
The due date for submitting this assignment has passed.
Due on 2024-09-04, 23:59 IST.
As per our records you have not submitted this assignment.
1) Assume that the following processes are scheduled using the Shortest-Job-First process scheduling policy. 1 point
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
No, the answer is incorrect.
Score: 0
Accepted Answers:
(C) 1.5
2) Choose the correct statement about "Exponential Averaging" when predicting the next CPU burst length in SJF 1 point
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 lengths.
No, the answer is incorrect.
Score: 0
Accepted Answers:
(C) Exponential Averaging gives more weight to the recent CPU bursts while still considering the entire history.
3) The following processes are scheduled using the Robin process scheduling policy with a time quantum of 3ms. 1 point
Determine the average waiting time.
Process Arrival time Burst time
P1 0 6
P1 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
No, the answer is incorrect.
Score: 0
Accepted Answers:
(B) 8.6
4) Assume the following processes are scheduled using the Priority Scheduling process scheduling algorithm. 1 point
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
No, the answer is incorrect.
Score: 0
Accepted Answers:
(A) 6.4
5) Which of the following process scheduling algorithms does not suffer from the starvation problem? 1 point
(A) Shortest Job First (SJF)
(B) Priority Scheduling
(C) Shortest Remaining Time First (SRTF)
(D) First-Come First-Served (FCFS)
(E) Multilevel Queue Scheduling
No, the answer is incorrect.
Score: 0
Accepted Answers:
(D) First-Come First-Served (FCFS)
6) The "Progress" condition in the context of the Critical Section Problem refers 1 point
(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.
No, the answer is incorrect.
Score: 0
Accepted Answers:
(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.
7) The “race condition” in the context of the critical section problem 1 point
(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.
No, the answer is incorrect.
Score: 0
Accepted Answers:
(A) occurs when multiple processes enter their critical sections simultaneously, leading to unpredictable results.
8) The solution to the critical section problem ensures which of the following(s)? 1 point
(A) Mutual exclusion
(B) Progress
(C) Bounded waiting
(D) Mutual Exclusion and Progress
(E) Mutual exclusion, Progress, and Bounded waiting
No, the answer is incorrect.
Score: 0
Accepted Answers:
(E) Mutual exclusion, Progress, and Bounded waiting
9) Consider the producer-consumer problem with a bounded buffer. The processes share a variable “count”. The initial 1 point
value of the count is 5, and the maximum size of the buffer is 10.
Producer process Consumer process
while (true)
{ while (true)
/* produce an item in {
next produced */ while (count == 0);
while (count == /* do nothing */
BUFFER_SIZE); next_consumed = buffer[out];
/* do nothing */ out = (out + 1) %
buffer[in] = BUFFER_SIZE;
next_produced; count = count - 1;
in = (in + 1) % /* consume the item in the
BUFFER_SIZE; next consumed */
count = count +1; }
}
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
No, the answer is incorrect.
Score: 0
Accepted Answers:
(B) 4
10) To solve the critical section problem, the general structure of a process Pi includes 1 point
(A) entry section
(B) exit section
(C) critical section
(D) remainder section
(E) All of the above
No, the answer is incorrect.
Score: 0
Accepted Answers:
(E) All of the above