Monday, May 15, 2006

Java Threading

This weekend I decided to clean up some of my threading skills in java. I bought the O'Reilly book, Java Threads, which has been a good read. I always find the O'Reilly books very insightful. Anyway I went ahead a wrote a small Reader/Writer program using threads. It follows a simple algorithm using a basic FIFO policy with the exception of reads, if a read has 10 "time units" left and a second read comes that only needs 5, that read is allowed to take place at the same time. Here is the applet, with the code in the base dir.

http://wwwcsif.cs.ucdavis.edu/~merz/RW.html