syllabus | announcements | assignments | discussion
E-Mail: redmond@lasalle.edu |
|
Fall 2002
Some of these use an updated version of RedmondMsgIn.java ================================================================= Very basic, almost silly examples.
SillyUseThread.java - OR view Text version of SillyUseThread.java ================================================================= Test for prime examples. First is unsynchronized - gets count of factors wrong.
TestPrimesImplRunThread.java - OR view Text version of TestPrimesImplRunThread.java Pressure gauge example - uses two files - first two are unsynchronized - device blows up because pressure gets out of hand. Second is safer - synchronized.
Pressure.java - OR view Text version of Pressure.java
SafePressure.java - OR view Text version of SafePressure.java ================================================================= Example for communicating, synchronized code. Dr Longo's producer and consumer example. This may seem abstract, but communicating threads tend to either produce something that other thread needs or consume what is produced. In this case, code is simple since what is produced and consumed are merely integers.
Consumer.java - OR view Text version of Consumer.java
================================================================= A banking example using threads. Still need some willful suspension of disbelief, but better than on earlier assignment. This example actually has each customer handled by a different thread - and setup and shut down handled by a different thread (main in this case)
AccountSynch.java - OR view Text version of AccountSynch.java
================================================================= Class to be used with thread assignment:
ChessPiece.java - OR view Text version of ChessPiece.java ================================================================= Example for communicating, synchronized code using PipedInputStreams. Dr Longo's piped version of producer and consumer example.
Consumer.java - OR view Text version of Consumer.java ================================================================= |