Overview

A thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack. It shares with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals.

Figure 4.1 Single-threaded and multithreaded processes.

Benefits

Responsiveness Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation.

Resource Sharing

  • Processes can only share resources through techniques such as shared memory and message passing.
  • However, threads share the memory and resources of the process by default.

Economy In general it is significantly more time consuming to create and manage processes than threads.

Scalability The benefits of multithreading can be even greater in a multiprocessor architecture, where threads may be running in parallel on different processing cores

results matching ""

    No results matching ""