Quantitative Analysis
Parallel Processing
Numerical Analysis
C++ Multithreading
Python for Excel
Python Utilities
Services
Author

I. Installation.
II. Threading primitives.
1. Encapsulation of primitives.
2. Preventing starvation.
A. RWMutex.
B. Exception safe locking of RWMutex.
3. Preventing race condition.
4. Barriers.
III. NonBlockingQueue.
IV. ThreadPool.
V. ThreadMaster.
VI. OTS Scheduler.
VII. Bibliography
Downloads. Index. Contents.

Preventing starvation.


onsider several threads reading some piece of data. We protect that data with a shared mutex. Each thread obtains a shared lock before accessing the data and releases the lock after the access is completed. It is possible that the data is being read by at least one thread at all times. If some thread also aims to write into the data field then such thread needs exclusive ownership. If the thread simply attempts a lock of the shared mutex and waits for the exclusive ownership then the waiting time may be too long. This is a situation of starvation: one of the threads is unable to obtain a resource that it requires. The RWMutex provides a solution for the difficulty.




A. RWMutex.
B. Exception safe locking of RWMutex.

Downloads. Index. Contents.


















Copyright 2007