22 Introduction to Concurrency in Programming Languages
of a process. Threads do not require the more intrusive setup and tear-down
overhead of a process, and instead exist within a process that already has
been created. Threads represent a very simple execution unit that differs
from processes in that:
• Threads share a single memory space with peers within the same process.
• Threads share I/O resources within a process.
• Threads have independent register state and stacks.
• Threads may have private, thread-local memory.
Threads are important for concurrent programming. They are simpler than
processes and can require significantly less overhead to create or destroy. The
amount of overhead depends on the method of thread implementation by the
underlying ...