Abstract
- Thread carries out other tasks if the current tasks require it to wait for IO Operations or Network Operations etc
- Goes back to the current task when the waiting ends - Call back
- However, the thread still get blocked when the task is CPU Bounded
Even Loop
- Asynchronous Thread tells Kernel what IO Device it wants to be done ( “please read from this socket” or “please write to this file”)
- The kernel provides an I/O handle to the thread for monitoring the request
- Kernel adds the request to a list of items to babysit.
- The thread continues on with life, periodically checking the I/O handle for events.
- Kernel posts an event to the I/O handle whenever something interesting happens via Upcall - callback
- Thread grabs each event, processing it, and checking for more events until the requested operation is complete
Responsive
Suitable for Process (进程) that need to respond to events, such as a graphical user interface (GUI) program.
Asynchronous Single Threading
- Basically takes the benefits of Multi-threading without the worry for Race Condition (竞态条件) & Deadlock (死锁), thanks to Asynchronous Thread
No Parallelism
There is only one single Thread, so can’t take advantage of Multi-core Chip. A CPU Bounded task can block the execution of the entire program, thus no Parallelism (并行性)