|
|
Microsoft Windows NT Build 297 06-28-1992
Summary: This article refers to the file Database.c which is one variation of the classical synchronization problem Reader/Writers. The Reader/Writer problem first stated and solved by Courtois revolves around a shared resource a DataBase typically. The issue here is to allow both readers and writers access to the database without corrupting it. Typically one allows multiple Readers to access the database as long as a Writer is not in there. However when a Writer is in the database no one else is allowed in either Reader or Writer. There are several variations of this problem around the simplest will favor Readers to the exclusion of Writers or visa versa. The implementation I used I believe was modeled after Dijkstra; however I've long since misplaced my operating systems book so can't verify it. His method would allow as many readers in the database at one time until a Writer wished entrance in. Then no other Reader can enter the database until this Writer is finished. All Readers currently in the database however can finish. This way no starvation of either the Readers or Writers which is inherent in the simpler methods will happen. More Information: In order to keep this sample focused, I've left the user interface simple; to run this sample at the command prompt type ReadWrit What you will see are the values the Readers put on the screen. These are the running total of the threads that wrote to the database. Enjoy
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.