Computer Science/Operating System
Threads and Multithreading
JTB
2025. 8. 11. 23:44
What is a Thread?
- A thread is the smallest unit of execution within a process.
- A single process can have multiple threads.
- Unlike processes, which each have their own code, data, and heap,threads share the code, data, and heap of their process. → This allows multiple tasks to run concurrently within a single process.
Multithreading
- Multithreading is a technique where multiple threads within a process share the workload.
- Since threads share memory and resources, it is more efficient in terms of memory usage, faster than inter-process communication, and generally provides better performance.