Thread
A "thread" in computing is the smallest unit of a process that can be managed independently by a scheduler. Multiple threads within the same process share its memory space and resources, allowing them to execute code concurrently and communicate efficiently. This enables multitasking within a single application, where each thread represents a separate flow of execution with its own program counter, stack, and registers.
Key characteristics
Shared resources: Threads within a single process share its address space, code, and other resources, which makes communication between them fast but also means one thread can impact others.
Independent execution: Each thread has its own set of registers and stack, which allows it to pause and resume execution independently of other threads.
Lightweight: Threads are often called "lightweight processes" because they have less overhead than a separate process.
Unit of scheduling: The operating system allocates processor time to individual threads, which is why a thread is considered the basic unit of CPU utilization.