producer/consumer code (working)

This commit is contained in:
Remzi H. Arpaci-Dusseau
2019-04-22 10:51:36 -05:00
parent ac329a7f8f
commit d532b42eda
3 changed files with 127 additions and 0 deletions

View File

@@ -24,6 +24,25 @@ prompt> make
prompt> ./binary
```
# Producer/Consumer
Code for the working producer/consumer solution from the text,
found in `producer_consumer.c`.
Run `make` to build, and `producer_consumer` to test it.
The program takes a few different arguments:
- The number of buffers between the producer/consumer
- The number of times a producer should produce something
- The number of consumer threads
```sh
prompt> make
prompt> ./producer_consumer 1 1000 1
```
The output should print each produced item once, and show which
consumer consumed each produced item.
# Dining Philosophers