
Soon we found the pages describing the readers and writers problem and (several) solution outlines. We thus decided to write the desired synchronization object ourselves: CMutexRW.įormal readers and writers solution using semaphoresSince our problem has extensively been studied (since 1960?) we first turned to some old college-books on parallel formal semantics to refresh our knowledge about the problem. Searching the MSDN, resulted in finding several synchronization objects ( CCriticalSection, CMutex, etc.) of which none seem to fulfill our demands: Multiple read-access when not writing. To achieve this without corrupting data, synchronization is necessary. Obviously, all the threads need access to the received and / or translated packet. We developed a solution that consists of one receiving thread, multiple translator threads, and even more sending threads (since we do not want to block the server if a client fails to receive). As this datafeed represents the continuously (but on a non-regular time base) changing (stock/option) market prices, fast relaying is crucial. Some time ago at work, we had to implement a server that relays and translates his incoming datafeed to multiple (typically > 32) clients. Assuming no writer is accessing the database, any number of readers may concurrently execute transactions. To preclude interference between transactions, a writer process must have exclusive access to the database. Each transaction, if executed in isolation, transforms the database from one consistent state to another. The database is assumed initially to be in a consistent state (i.e., one in which relations between data are meaningful).
WE HAF TO GIVE THE ANSWERS IN SEMAPHOR UPDATE
Readers execute transactions that examine database records writer transactions both examine and update the database.

Two kinds of processes - readers and writers - share a database.

Readers/Writers Problem - Classic definition It is also an eminently practical problem. Like the dining philosophers, it is often used to compare and contrast synchronization mechanisms. IntroductionThe readers/writers problem is one of the classic synchronization problems.
