Producer: W: new thread, S: execute command, A: move left, D: move right
Consumer: K: new thread, I: execute command, J: move left, L: move right
Producer: Fill the buffer with 8 items
Consumer: Empty the buffer
Both: Have no remaining threads with items, display semaphores correctly.
Each red block is a thread. Move your stack of threads left and right and execute commands with the top thread.
Produce/Consume: Use this command to produce an item, or consume an item in your thread.
Lock: Use this command to acquire the lock, or release the lock if you've already acquired it. Threads will be woken up when the lock is available. Locks can only be held for 5 seconds.
Read/Write: Use this command to read and write to the buffer. You may end up with duplicate data if you do not do this with the lock.
Semaphores: Increment or decrement the Empty and Full semaphores to display the correct values. If they go negative, your thread will be put on the waitlist. If they get to 8, empty and unlocked threads will be discarded.