|
|
1.1 ! root 1: Sample: Read/Write Synchronization Demonstration ! 2: ! 3: Summary: ! 4: ! 5: This article refers to the file DATABASE.C, a part of the ! 6: READWRIT sample, which is one variation of the classical ! 7: synchronization problem Reader/Writers. The Reader/Writer ! 8: problem first stated and solved by Courtois revolves around ! 9: a shared resource which is typically a database. The issue ! 10: here is to allow both readers and writers access to the ! 11: database without corrupting it. ! 12: ! 13: More Information: ! 14: ! 15: Typically one allows multiple readers to access the database ! 16: as long as a writer is not accessing it. However, when a ! 17: Writer is accessing the database no other Readers or Writers ! 18: are allowed access. There are several variations of this ! 19: problem around. The simplest will favor readers to the ! 20: exclusion of writers or visa versa. ! 21: ! 22: The implementation used by the READWRIT sample allows as ! 23: many readers in the database at one time until a writer ! 24: wished entrance in. Then no other reader can enter the ! 25: database until this writer is finished. All readers ! 26: currently in the database, however, can finish. This way no ! 27: starvation of either the readers or writers which is ! 28: inherent in the simpler methods will happen. ! 29: ! 30: In order to keep this sample focused,the user interface is ! 31: very simple; to run this sample at the command prompt type: ! 32: ! 33: READWRIT ! 34: ! 35: What you will see are the values the readers put on the ! 36: screen. These are the running total of the threads that ! 37: wrote to the database. ! 38: ! 39: ! 40:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.