... continued
This lesson continues the discussion on asynchronous programming.
We'll cover the following...
WebServers
A common application of the asynchronous paradigm is in web servers, which spend most of their time waiting for network I/O. A more recent approach to implementing web servers uses event loops. An event loop is a programming construct that waits for events to happen and then dispatches them to an event handler. Languages such as JavaScript, Ruby (MRI implementation) and Python (standard C implementation) enable the asynchronous programming model using an event loop. The idea is that a single thread runs in a loop waiting for an event to occur. Once an event arrives, it is appropriately dispatched to an event handler. The event loop's thread immediately goes back to listening for another event. The event handler may run on another thread if the language supports multiple threads. This design achieves very high concurrency if an application is ...