Fully functional code. Semaphores used to communicate between the two screens.