Abstract


  • Responsible to carry out some features of a Process (进程)
  • Threads in a process share the same Address Space & other per-process items as shown below


More Performant

Since thread doesn’t have the need to perform Expensive Context Switching. It is 10-100 times faster than Process.

Faster to create and destroy compared to process, because it can be created without making System Call (系统调用) to the underlying Kernel.

Easier to program

Unlike process, different parts of program able to communicate without the use of Interrupts (中断) and Inter-Process Communication (IPC) etc.

No protection among threads

One thread can read, write, or even wipe out another thread’s stack. It is also able to bring down the entire Process.

Forking

Should we copy over all the threads or just a single one?

Interrupt Handling

For Software Interrupt handling - which thread should handle it?

Blocking Thread

  • Known as Synchronised Thread
  • Thread doesn’t do anything while waiting for IO Operations or Network Operations etc
  • Super-simple to use and understand!

Thread Table


PThread