Java Swing Layout Manager Event Handling Inner Classes Swing Applet Exceptions Threads![]() Multitasking & Multithreading![]() What is a Thread![]() Sequential Flow of Control![]() Life Cycle of a Thread![]() Subclassing Thread![]() Controlling Thread![]() Implementating Runnable![]() When to Use the Runnable Interface![]() Multithreading Example![]() Pre-emptive Scheduling![]() Synchronization (Consumer/Producer)![]() The Producer![]() The Consumer![]() Testing![]() Mutual Exclusion ![]() Exercise![]() Deadlock Java I/O Network Programming Resources | Mutual ExclusionJava uses an approach based on monitors to express mutual exclusion in a program. A monitor collects together a number of functions (methods in Java's case) which are critical regions, and enforces the constraint the only one of those critical regions be runnable at any one time. A thread may obtain exclusive access to an object/class via:
Synchronization method of the Object Class:
|