Usually the reactor pattern use one process and one thread. The main goal of Reactor pattern is to seperate the application sepecific code. But some time IO is the bottleneck of performance. so I try to apply the Reactor pattern in a multithreaded enviroment. The detailed code is here! .
If you run into a situation that you need to allocate a specific object very frequently. Obviously the traditional way will cause the memory fragment because of frequent allocation on heap, and you will get more risk for failure of allocation after a certain running period. so this situation the memory pool definately is your best choice.
As we knew, The queue is the core component of the producer and consumer pattern. and the another important one is how to wake up one of the consumer. Because Most of time, we get more than one comsumer. Fortunately we can combine the queue and condition variable to achieve this goal using C++ 11.
*Blocking IO
*NonBlocking IO
*IO Multiplexing
*Signal-Driven
*Asynchornours IO
I am going to illustrate the Read function to explain these types of IO model.
Accroding to the MSDN website, the definition of l-value like below:
Expressions that refer to memory locations are called “l-value” expressions. An l-value represents a storage region’s “locator” value, or a “left” value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers.