Q3Operating System
Question
2 marks
What is a Thread?
Answer
A thread is the smallest unit of CPU execution within a process, sharing the process's resources while having its own program counter, registers, and stack.
A thread (or lightweight process) is a basic unit of CPU utilization within a process. Each thread has its own thread ID, program counter, register set, and stack. However, all threads of the same process share the process's code section, data section, heap, and OS resources (open files, signals). Multithreading allows a program to perform multiple tasks concurrently. Examples: A web browser uses one thread to display images while another thread retrieves data from the network. Threads are faster to create and switch between compared to processes.