Ben Leber
CS33211 - Operating Systems
Dr. Guan
March 28, 2025
This is the submission for project 1, the Consumer-Producer Problem. For this submission, I used sys/mman.h for shared memory access, so the program is only usable in a linux environment.
There are two ways to go about compiling:
make clean
makeg++ consumer.cpp -pthread -lrt -o consumer
g++ producer.cpp -pthread -lrt -o producerTo run the processes at the same time, use:
./producer & ./consumer &Once the consumer is done, use CTRL + C to end the consumer program. The producer will still be running in the background, so in order to stop the process you need to use ps to list all processes running. Once you find "producer," use the PID from ps to run kill INSERT_PID.
Additionally, you can run make kill, to kill both processes at once.