-
Synchronous blocking I/O
-
Synchronous non-blocking I/O
- In this model, a device is opened as non-blocking. This means that instead of completing an I/O immediately, a read may return an error code indicating that the command could not be immediately satisfied (EAGAIN or EWOULDBLOCK)
- Application may call numerous times to await the read completion.
- This can be extremely inefficient.
-
Asynchronous blocking I/O
-
Asynchronous non-blocking I/O (AIO) Our interest
- The read request returns immediately, indicating that the read was successfully initiated.
- The application can then perform other processing while the background read operation completes.
- When the read response arrives, a signal or a thread-based callback can be generated to complete the I/O transaction.
- When many slow I/O call happens, threads can be fully operational regardless of I/O blocking.
ref : Boost application performance using asynchronous I/O ref(translated in Korean) : Asynchronous IO 개념 정리
- Asynchrony, in computer programming, refers to the occurrence of events independent of the main program flow and ways to deal with such events.
- 메인 프로그램을 blocking(wait) 하지 않고 수행 -> 병렬 컴퓨팅 가능(parallel computing)
- 일반적으로 subroutine 을 통해 처리
- ex) procedure, function(callback), method, routin, subprogram 등으로 불림
- future or promise
ref : Wikipedia : Asynchrony
- single threaded event loop
- worker thread pool (to enable it, node.js uses libuv)
- libuv : libuv (Unicorn Velociraptor Library) is a multi-platform C library that provides support for asynchronous I/O based on event loops.
- It supports epoll(4), kqueue(2), Windows IOCP, and Solaris event ports.
- libuv : libuv (Unicorn Velociraptor Library) is a multi-platform C library that provides support for asynchronous I/O based on event loops.
- V8 javascript engine
- V8 compiles JavaScript directly to native machine code before executing it





