November 1999
Intermediate to advanced
336 pages
6h 29m
English
The previous chapter stayed entirely within the realm of a single-threaded environment. The memory pool was owned by a single thread and concurrency issues were absent. We now extend our design to a multithreaded environment. The memory pool will no longer belong to any particular thread; instead it will be shared among all threads in the application process.
The allocators developed for the single-threaded environment will not work properly in a multithreaded environment. To allow multiple threads to allocate and free memory concurrently, we must add mutual exclusion to the allocator methods. We could duplicate the single-threaded implementations and add locking at the right spots, but this brute force ...
Read now
Unlock full access