Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 1.34 KB

File metadata and controls

23 lines (19 loc) · 1.34 KB

System V IPC Exercise

This is an exercise on the producer/consumer problem using System V IPC

The producer:

To run the producer, use the following arguments.
./producer {COMMODITY_NAME} {MEAN} {STD_DEV} {SLEEP_INTERVAL} {BUF_SIZE}
e.g.
./producer NATURALGAS 7.1 0.5 200 40 would run a producer that declares:
1- The current price of Natural Gas
2- Is to be declared every 200ms
3- The change is according to a normal distribution with parameters (mean=0.5 and variance=0.25).
4- The size of the shared bounded buffer is 40 entries.

The Consumer:

The consumer simply prints the price of each commodity with the text color changing with the price and it takes the size of its buffer as argument.
It should be something like this: image

The Results:

This terminal is called terminology, used to split the screen into multiplte terminals to easily access each running terminal.
This is an example of running 11 different producer processes and 1 consumer process, all of which are accessing the same memory. image