View worked solution
Answer: 7
To find the largest initial value of the counting semaphore (let it be ) for which at least one operation remains blocked at the end of the execution:
- Each operation decrements the semaphore and requires resource unit. Total operations = .
- Each operation increments the semaphore and releases resource unit. Total operations = .
The total number of resource units available during the entire execution is the sum of the initial value and the units released by operations:
For at least one operation to remain blocked at the end, the total available resources must be strictly less than the total number of requested operations:
Thus, the largest integer value of is .
Free practice · Your answers on this page are not saved.
