SAMPLE: READWRIT - Sample Application

PSS ID Number: Q103350
Article last modified on 08-24-1993

3.10
WINDOWS

----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Windows Software Development Kit (SDK) for Windows
   version 3.1
----------------------------------------------------------------------

READWRIT: Demonstrates Read/Write Synchronization
READWRIT implements a variation of the reader/writer synchronization
problem, first stated and solved by Courtois. The reader/writer
problem revolves around a shared resource, which is typically a
database. The goal is to allow 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 accessing it. However, when a writer accesses the
database, all other readers or writers are denied access. There are
several variations of this problem. The simplest variations favor
readers to the exclusion of writers or vice versa.
The implementation used by the READWRIT sample allows multiple readers
in the database until a writer asks for entry. At this point, no other
reader can access the database until the writer is finished. All
readers who are currently accessing the database, however, can finish
their tasks. This method avoids the starvation of readers and writers
that is inherent in the simpler methods. The user interface is
intentionally very simple to keep the sample focused.
To run READWRIT, type
   READWRIT
at the command prompt.
The Microsoft® Windows NT™ version 3.1 operating system was not
available at the time this sample was acquired for the Microsoft
Developer Network CD. For this reason, the CD includes only the source
files for the sample, not the executable file or any DLLs. If you have
Windows NT version 3.1 installed on your system, you may copy the
source files to your hard drive and invoke the Windows NT make file to
build the sample.
KEYWORDS: CD4
For Microsoft OnLine customers, READWRIT is available in the
Software/Data Library as 4X79.ZIP and can be found by searching on the
word READWRIT, the Q number of this article, or S14281. For CompuServe
Customers, READWRIT can be downloaded from the file 4-79.ZIP in
library section number 4 of the MSDNLIB forum. READWRIT was archived
using the PKware file-compression utility.

Additional reference words: 3.10
KBCategory:
KBSubcategory:
Copyright Microsoft Corporation 1993.