A thread is a fundamental unit of CPU utilization that forms the basis of multithreaded computer systems.
A thread is a flow of control within a process. A multithreaded process contains several different flows of control within the same address space.
4.1 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 shared with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals.
4.1.2 Benefits
1. Responsiveness. A web browser can display large image while response user action
2. Resource sharing. Threads share the memory and resources of the process to which they belong by default.
3. Economy. Allocating memory and resources for process is costly.
4. Scalability. Multithreading on a multi-CPU machine increases parallelism.
4.1.3 Multicore Programming
In general, five areas present challenges in programming for multicore systems:
1. Dividing activities.
2. Balance
3. Data splitting
4. Data dependency. In instance where one task depends on data from another, programmers must ensure that the execution of the tasks is synchronized to accomm