PiercePickett/OS
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
While making this program I decided to make a semaphore where the producer puts a random character on the buffer for the consumer to consume. It has come to my attention that the use of the rand() function may affect the output of the program which I would recommend running the program a couple of times in the case the the output isnt exactly:
Produced: A Produced: B Consumed: A Consumed: B
To compile the program use a bash terminal with the files in a folder. to get an execution file for the two files use:
g++ producer.cpp -pthread -o producer
g++ consumer.cpp -pthread -o consumcer
Then to run both of the execution files at the same time use:
./producer & ./consumer &

