What Is Still Difficult With Events
Let's discuss some other issues with the event-based approach for concurrency.
We'll cover the following
There are a few other difficulties with the event-based approach that we should mention.
On multiple CPUs
When systems moved from a single CPU to multiple CPUs, some of the simplicity of the event-based approach disappeared. Specifically, in order to utilize more than one CPU, the event server has to run multiple event handlers in parallel; when doing so, the usual synchronization problems (e.g., critical sections) arise, and the usual solutions (e.g., locks) must be employed. Thus, on modern multicore systems, simple event handling without locks is no longer possible.
Integration with system activities
Another problem with the event-based approach is that it does not integrate well with certain kinds of systems activity, such as paging. For example, if an event-handler page faults, it will block, and thus the server will not make progress until the page fault completes. Even though the server has been structured to avoid explicit blocking, this type of implicit blocking due to page faults is hard to avoid and thus can lead to large performance problems when prevalent.
Code management
A third issue is that event-based code can be hard to manage over time, as
Integration with a network I/O
Finally, though asynchronous disk I/O is now possible on most platforms, select()
interface to manage all outstanding I/Os, usually some combination of select()
for networking and the AIO calls for disk I/O are required.
Get hands-on with 1200+ tech skills courses.