Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc P:
- always_loop:
- v = produce()
- remove(availableJob) //If theres no available job, the buffer is full
- post(product, v) //The buffer is no longer empty
- proc C:
- always_loop:
- remove(product, v) //If there is no product, the buffer is empty
- post(availableJob) //The buffer is no longer full
- consume(v)
- main:
- n := WhataverBufferCapacityYouMayLike
- for 1...n
- post(availableJob) //Create n jobs for the producer
- for 1...numProducers
- run proc P
- for 1...numConsumers
- run proc C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement