Tutorial 3
Subject Name – Operating System Subject Code – BTCS 106T
Note: - Dear Students, attempt all numerical and conceptual questions clearly and
accurately, ensuring proper steps, reasoning, and structured presentation throughout.
1) A binary semaphore S is initialized to 1. Four processes P1, P2, P3, and P4 request entry
into the critical section at the same time.
If the scheduler is non-preemptive inside the semaphore operations, determine the
maximum number of context switches required for all processes to complete their
critical sections.
2) A counting semaphore is initialized to 3. The following sequence of operations occurs:
wait, wait, wait, wait, signal, wait
Determine:
Final value of semaphore
Number of blocked processes
3) In a system, the time spent in the critical section is 4 ms and in the remainder section is
16 ms.
If there are 4 identical processes repeatedly executing and mutex locking is used, compute
the percentage of time the critical section is busy.
4) Consider a bounded buffer of size 6 using semaphores:
mutex = 1, empty = 6, full = 0
If 5 producers and 3 consumers execute successfully, determine the final values of
empty and full.
5) Two processes P1 and P2 share two resources R1 and R2 (one instance each).
Current state:
P1 holds R1 and requests R2
P2 holds R2 and requests R1
Determine whether the system is in:
a) Safe state
b) Deadlock
c) Starvation
6) A system has:
Process P1:
Allocation = (1, 0, 1)
Max = (3, 1, 2)
Check whether request (1, 1, 0) by P1 can be granted immediately.
7) Given the system snapshot:
Available = (1, 0, 2)
Process P3:
Allocation = (0, 1, 1)
Max = (1, 2, 3)
Determine whether the system remains safe if P3 requests (1, 0, 1).
8) Consider the following data:
Total resources = (7, 5, 3)
Available = (3, 3, 2)
Process P0:
Allocation = (0, 1, 0)
Max = (2, 2, 1)
Find the Need matrix for P0 and determine whether request (2, 1, 1) is valid.
9) In a monitor, the buffer size is 10. At some instant:
Produced items = 40
Consumed items = 33
Determine:
Items currently in buffer
Whether producer must wait
10) Three processes are waiting on condition variable y in order P1, P2, P3.
If one signal(y) is executed followed immediately by a broadcast(y), determine the order
in which processes resume.
11) A spinlock protects a critical section that lasts 15 µs.
If polling interval is 3 µs and a process arrives just after the lock is acquired, compute
the maximum waiting time before entering the critical section.
12) In a mutex-based system, 6 processes repeatedly execute:
Critical section = 5 ms
Remainder section = 25 ms
Assuming perfect scheduling and negligible overhead, compute the throughput
(entries into CS per ms).