Blocking/Non-blocking vs Sync/Async
When an I/O function is invoked:
- Blocking: Waits for the process to complete before returning.
- Non-Blocking: Returns immediately, regardless of whether the task has finished.
In terms of who oversees task completion for the I/O function:
- Synchronous: Managed by the application.
- Asynchronous: Overseen by the kernel.
epoll vs kqueque
Kqueue allows one to batch modify watcher states and to retrieve watcher states in a single system call. With epoll, you have to call a system call for every modification. Kqueue also allows one to watch for things like filesystem changes and process state changes, epoll is limited to socket/pipe I/O only.
Reactor pattern
didawiki.cli.di.unipi.it/lib/exe/fet…
The Reactor pattern allows event-driven applications to demultiplex and dispatch synchronously and serially service requests that are received simultaneously from one or more clients.
• It waits for indication events to occur on some event sources.
- Indication event: event that identify the arrival of a request.
• Non-blocking Synchronous I/O strategy
- the control is returned to the caller immediately: the call was performed and the results are ready, or the system has no resources to execute the requested operation.
Proactor pattern
The Proactor pattern allows event-driven applications to demultiplex and dispatch service requests in an efficient asynchronous way.
. It waits for completion events to occur on some event sources.
- Completion event: event that identify the end of the execution of an asynchronous operation.
• Non-blocking Asynchronous I/O strategy
- the control is returned to the caller immediately, indicating that the requested operation was initiated. The called system will notify the caller.