What is the difference between a process and a thread in operating systems?
a) A process is an independent program in execution, while a thread is a lightweight process that shares resources with other threads
b) A thread is more memory-intensive than a process
c) Threads cannot communicate with each other, while processes can
d) A process can only run on a single core, while threads can run on multiple cores
Answer:
a) A process is an independent program in execution, while a thread is a lightweight process that shares resources with other threads
Explanation:
A process is an independent program in execution with its own memory space and system resources. In contrast, a thread is a smaller, lightweight unit of a process that shares resources such as memory and file handles with other threads within the same process.
Threads allow for more efficient execution of tasks by enabling parallelism within a single process, making them ideal for scenarios where multiple tasks need to be performed simultaneously without the overhead of creating separate processes.
Processes are isolated from each other and require inter-process communication (IPC) to share data, whereas threads within the same process can easily communicate and share resources.