Skip to content

Basic Architecture of Simple Examples Assignments

Jonas Mellin edited this page Oct 4, 2017 · 2 revisions

To maintain the semantics of the examples, data structures that should be available to all parts of the program are put in the class GlobalProgramState as member variables declares as public and static. Further, this class contains the main function that starts the program. For example, see Producer/Consumer example.

In the examples, the default thread interface is hidden in the class AndrewsProcess that requires people to implement their multithreaded programs using the Runnable interface rather than extending the Thread class. The rationale is to force students to employ Runnable interface and to hide away details that are not addressed in the course.

Further, to simplify startup, a factory method andrewsProcessFactory that takes an array of RunnableSpecification starts the threads.

Clone this wiki locally