Threading

Experience with multitasking systems showed that a smaller unit of control was required than the process itself. Two inter-requirements presented themselves:

  • The need for a single process to perform multiple activities
  • The need for these activities to share data with each other

The process model, where each process has its own address space and program counter and an expensive context switch is required to change the instruction stream, was a poor fit for these requirements. In particular, the feature of the context switch, in which the process's memory was swapped out directly contradicted the need for data sharing.

The solution was the idea of threads. A thread is like a process in that it is a sequence of instructions with an associated ...

Get Mastering IPython 4.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.