Department of Computer Science & Engineering
BABU BANARASI DAS
NORTHERN INDIA INSTITUTE OF TECHNOLOGY
Affiliated to Dr. A.P.J. Abdul Kalam Technical University (AKTU Code : 056)
AKTU Code: 056 Approved by All India Council for Technical Education (AICTE) Sector II, Dr
Akhilesh Das Nagar, Faizabad Road, Lucknow (UP) – India, 226028 Website :
www.bbdniit.ac.in
CSE SECOND YEAR/FOURTH SEMESTER / 2024-25
Questions Bank
1. Name of Subject: Operating System
2. AKTU Subject Code: BCS 401
3. NBA Subject Code : C 212
4. Unit : II
Q# Question Description CO BTL
Write the use of semaphore? And also explain how semaphore works?
1 2 K1
A counting semaphore S is initialized to 10. Then, 6 P operations and 4 V
2 operations are performed on S. What is the final value of S? 2 K3
Give two process synchronization solutions to meet critical section requirements. 2 K3
3
4 Give solution for synchronization of cooperative n-process of Bakery algorithm. 2 K3
5 Explain the readers/writers problem. And give a solution to solve problem. 2 K3
6 Differentiate between looping and blocking? 2 K2
Suppose we want to synchronize two concurrent processes P and Q using binary
semaphores S1 and S2. The code for the processes P and Q is shown below-
Process P Process Q
while(1) while(1)
{ {
P(S1); P(S1);
7 2 K3
P(S2); P(S2);
Critical Section Critical Section
V(S1); V(S1);
V(S2); V(S2);
} }
This ensures-
1. 1. Mutual Exclusion 2. Deadlock 3. Starvation but not deadlock
8 Draw the process state diagram and explain each state. 2 K1
A shared variable x, initialized to zero, is operated on by four concurrent processes
W, X, Y, Z as follows. Each of the processes W and X reads x from memory,
increments by one, stores it to memory and then terminates. Each of the processes
Y and Z reads x from memory, decrements by two, stores it to memory, and then
9 2 K3
terminates. Each process before reading x invokes the P operation (i.e. wait) on a
counting semaphore S and invokes the V operation (i.e. signal) on the semaphore S
after storing x to memory. Semaphore S is initialized to two. What is the
maximum possible value of x after all processes complete execution?
Consider the methods used by processes P1 and P2 for accessing their critical
sections whenever needed, as given below. The initial values of shared Boolean
variables S1 and S2 are randomly assigned.
Method used by P1 Method used by P2
while (S1 == S2); while (S1 != S2);
Critical Section Critical Section
10 S1 = S2; S2 = !S1; 2 K3
Which one of the following statements describes the properties achieved?
1. 1. Mutual exclusion but not progress 3. Progress but not mutual exclusion
2.Neither mutual exclusion nor progress 4. Both mutual exclusion and progress
CO: Course Outcome BTL: Bloom's Taxonomy Level MM: Max Marks
Name of Faculty:
Waseem Ahmad
BBDNIIT 2024-25(Even Semester)