Bounded-Buffer Problem Using Messages

This Java applet demonstrates the bounded-buffer consumer/producer problem using messages. The bounded-buffer producer/consumer problem is solved using the mutual-exclusion power of message passing. Two mailboxes are used, mayConsume and mayProduce. The producer generates data and send it as message to mayConsume mailbox, allowing the consumer to consume the message. Hence the mailbox mayConsume serves as the buffer. Initially, the mayProduce mailbox is filled with a number of null messages equal to the size of the buffer. The number of null messages in mayProduce decrease by one with each production and increase by one with each consumption.