Preparation for Quiz 1 ====================== This quiz will be open book, open notes, and 90 minutes long. Make sure you are familiar with: Basic terms Program, Process, Thread, Multprocessing, Multithreading Concurrency, Distribution Shared Resources, Synchronization Basic issues Modeling - interleaved sequences Granularity - at least four grains Scheduling - thread states Communication - shared memory vs. message passing Synchronization - why it is required Language intrinsic vs. Library concurrency support Basic programming in Ada, Java, Perl, C++/pthreads, and C++/Win32 Thread declarations Thread creation Thread startup and shutdown Joining Very basic locking Correctness Criteria The two ways to deal with races on shared resources Serialize all access on a single thread Protect it with a critical region Safety Race conditions Critical regions Deadlock Livelock Starvation Liveness Weak Fairness Strong Fairness Linear Waiting FIFO Operations Regular subroutine calls Asynchronous calls Blocking calls Timeout calls Conditional calls Mutual Exclusion Requirements Two main approaches Bare machine approaches Why non-atomic test and set fails Why atomic test and set works Peterson's algorithm (Bakery algorithm would go here, but we didn't cover it) Scheduler-Assisted Approaches Barriers Semaphores Smart data objects that protect themselves Notification Mechanisms Ada protected objects Explicit Locking Dining Philosophers Why we care about this classic Variations on the implementation How to write a good proof of the absence of deadlock Java, Java and more Java The thread class - what it gives you and what it doesn't Thread objects Thread states (ALL SIX) Creating threads Starting threads Stopping (remember the thread itself should permit this) Uncaught exceptions Synchronization (at least seven approaches) Atomic Objects Volatile Fields Synchronized Statement Explicit Locks (reentrant simple locks, read/write locks) Explicit vs. Implicit Locking Condition Synchronization Wait/notify vs. Condition interface Sync objects countdowns - to wait for n things to happen barriers - to wait for n threads to arrive at some point semaphores - to allow n threads to use a resource at a time exchangers - to allow two threads to exchange data Interrupts Suspension (should be on the suspendee's terms only) The massive collection API Which collections are threadsafe and which aren't Copy on write stuff Iterators and concurrent modification exceptions Swing Keeping event handlers short Serializing access to components as opposed to locking them invokeLater and invokeAndWait Thread Scheduling Why this isn't really your business Why priorities don't matter a hell of a lot Thread Pools The Executor interface and friends The Executors utility class How the bouncing balls example works Scheduling taks with the ScheduledExecutorService and Timers