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

  1. Asynchronous Thread tells Kernel what IO Device it wants to be done ( “please read from this socket” or “please write to this file”)
  2. The kernel provides an I/O handle to the thread for monitoring the request
  3. Kernel adds the request to a list of items to babysit.
  4. The thread continues on with life, periodically checking the I/O handle for events.
  5. Kernel posts an event to the I/O handle whenever something interesting happens via Upcall - callback
  6. 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


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 (并行性)