For this homework assignment, you will modify the multithreaded directory listing code provided in class to use a shared file set that is thread-safe. The shared file set must use a custom lock that allows concurrent reads and non-concurrent write or read/write operations.
You must submit this homework to your SVN repository using Eclipse. Your homework, including the src directory and all required source code files must be at the following location:
https://www.cs.usfca.edu/svn/<username>/cs212/homework07/
where <username> is your CS username in all lowercase letters. Failure to properly submit your homework will result in a point deduction.
You must submit this programming homework by 11:59pm on Friday, March 29, 2013.
You have been provided two template files: MultiReaderLock.java and SharedFileSet.java. You must fill in the missing code of those two classes such that:
The SharedFileSet class is thread-safe. As a result, classes that use SharedFileSet do not need to worry about synchronization, as the class handles all synchronization necessary for maintaining consistent data.
The SharedFileSet class should use a MultiReaderLock to protect the inner data structure.
The MultiReaderLock must allow concurrent reads (i.e. allow multiple readers at once), but non-concurrent write and read/write operations (i.e. only one writer is active at once, and no readers are active while a writer is active).
You may add additional methods as necessary to the template code, including adding logging messages. However, you may not modify the method names or keywords used for the methods specified in the template code.
Finally, you should modify the multithreaded directory listing code on the Advanced Multithreading lecture page to use your shared file set. You will no longer need to do as much synchronization inside of the directory listing code since the SharedFileSet takes care of the synchronization itself. You will have to make moderate modifications to the code to use your SharedFileSet data structure correctly.
Use the provided unit tests to test your code. Keep in mind your code may also be reviewed for proper code style, and that passing the unit tests does not guarantee a 100% grade.