It seems, in this tough economy, people are resorting to borrowing books and dvds from the library rather than buying or renting from stores. Your…

It seems, in this tough economy, people are resorting to borrowing books and dvds from the library rather than buying or renting from stores.  Your library continues to thrive.  You have expanded and added staff – besides you, you now have two library assistants, Peter and Jane.  Peter is assigned to receive returned books, dvds and magazines, while Jane is in charge of lending out books and items.

As you only have a finite amount of titles to lend, you have also instituted a “Wait List” for your borrowers.  If the book or dvd they’re borrowing is not available, they will be put on “wait list”.  Note that for every one title, there could be only be ONE borrower on the “wait list” at a time.

Being new to your library, you must devise a system for Jane and Peter to follow so that:

i) Jane can check the “wait list” when someone is borrowing ii) Peter can update the “wait list” when a book is returnediii) If the book recently returned is immediately borrowed on the same day, Jane should be able to come to Peter to get the book and update the “wait list” herself.  Otherwise, Peter, at the end of the day, should put it back to the shelf.iv) Jane and Peter can generate a report summarizing the titles borrowed and returned that day.

The key here is Jane and Peter should be synchronized in what they are going to do.  Device a solution (an algorithm, pen-and-paper approach, or series of steps) to enable this new process. A software is not a solution (ie – use an SQL database or a third party program). Apply methodologies such as test-and-set, Wait-and-signal and semaphores to assist you in synchronization.