/bounded-buffer

The producer consumer problem.

Primary LanguageC

#Producer–Consumer Problem

A bounded-buffer, an array of finite size, is pushed to by a prodcucer and pulled from by a consumer. Producers cannot push to a full buffer and consumers cannot pull from an empty buffer. Producers push integers into the buffer that incement sequentially. Consumers will pull integers from the buffer in first-in-first-out, FIFO, manner.

##Build
Issuing the following command:
gcc –pthread –o buffer <file-name>.c

##Run
Issue the following command to run:
./buffer <sleep-time> < number-of-producer-threads> <number-of-consumer-threads> <first-integer-to-produce>
For example execute the following command: ./buffer 10 2 2 10

##Aditional Notes:
When building and running, buffer refers to the assembly that is built when the C file is compiled.
Unnamed semiphores are not supported in Mac OSX.