I have a project for my operating systems class in which we need to write a program using multiple threads and no semaphores , i understand how to do it in pseudo code but as I'm thinking about implementation I can't figure out how to declare shared variable all I can think of is having another thread holding all shared variables Edit 1: to synchronize we have to use while(busywait true) {}
edit 2: Through its implementation, this project will familiarize you with the creation and execution of threads, and with the use of the Thread class methods. In order to synchronize the threads you will have to use (when necessary), run( ), start( ), currentThread( ), getName( ), join( ), yield( ), sleep(time), isAlive( ), getPriority( ), setPriority( ), interrupt( ), isInterrupted( ), maybe synchronized methods. In synchronizing threads, DO NOT use any semaphores. DO NOT use wait( ), notify( ) or notifyAll();