Professional Documents
Culture Documents
sTask3
and sTask4 initially are 0s
Codes
task.
Counting-semaphore
scnt at an instance reflects the initialized
value minus the number of times it is taken
plus the number of times released.
Counting Semaphore application
example
Assume that a task can send on a network the
stacks into 8 buffers.
Each time the task runs it takes the semaphore and
sends the stack in one of the buffers, which is next
to the earlier one.
Assume that a counting semaphore scnt is
initialized = 8. After sending the data into the
stack, the task takes the scnt and scnt decrements.
When a task tries to take the scnt when it is 0, then
the task blocks and cannot send into the buffer
ACVM Example
Consider Chocolate delivery task.
It cannot deliver more than the total number
total.
Each time, the new chocolates loaded in the