- Click the START button to initialize the buffer size (n) and the count value.
- Now, click on either 'Producer' or 'Consumer' to initiate their respective code.
- To execute the 'Producer/Consumer' code line by line, click their respective 'Next Line' button.
- Repeat step 3 until the code for the initiated process is completed.
- After each click, observe the comment section and changes in variables.
Try different simulation scenarios such as:
- Consuming the product before producing it.
- Producing/consuming more than one item simultaneously.
- Explore context switching scenarios by not executing all lines of code and instead, clicking on either 'Producer' or 'Consumer'.
NOTE 1: An in-built interruption for each process will be generated in the producer code.
NOTE 2: The algorithm used to resume a process from the waiting list is 'First-in, First-out'.
NOTE 3: To understand the instructions in the code, hover over the line.
NOTE 4: Read all the alerts carefully.