- Asked 3/15
- 2070 Chaitra · 2+2 marks
- 2070 Asar · 4 marks
- Model question
Process vs threads; importance in DS
Short answer
A process has its own address space and resources; a thread shares its process's address space, making creation and switching cheap. Threads are crucial in distributed systems for multithreaded servers handling concurrent clients, hiding network latency (e.g., web browser fetching images while rendering), and overlapping I/o and computation to improve scalability.
Define and differentiate between process and threads. Explain the importance of threads in distributed system with suitable examples.
Process and thread
- A process is a program in execution with its own address space (code, data, heap), resources (open files) and at least one thread of control.
- A thread is a lightweight unit of execution inside a process. It has its own program counter, registers and stack, but shares the address space, data and open files of its process.
| Point | Process | Thread |
|---|---|---|
| Address space | Own, protected | Shared with other threads of the process |
| Creation / switch cost | High | Low |
| Communication | Needs IPC (pipes, messages) | Direct through shared memory |
| Protection | Strong isolation | None between threads |
| Failure | One process does not affect another | A faulty thread can crash the process |
| Resources | Own set | Share process resources |
| Also called | Heavyweight process | Lightweight process |
Importance of threads in distributed systems
- Multithreaded servers: a server handles many client requests at once. One dispatcher thread takes requests and worker threads process them, so a slow request (disk or network wait) does not block others. Example: a web server creates a thread per request, a file server serves many clients.
- Hiding latency in clients: a web browser uses one thread to fetch the page while others fetch images and render, so the user is not blocked on network delay.
- Overlap of computation and I/O, which improves performance and throughput, and makes use of multiprocessors.
- Cheap communication and switching: shared memory between threads is more efficient than between processes.
- Simpler program structure: blocking system calls (RPC, RMI) can be used in each thread while the program continues in others.
- Better scalability as a server handles more clients per machine.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Threads, checkpoint, distributed commit · Distributed System, chapter 3
- Autonomous vs distributed system · Distributed System, chapter 1
- DS as a single coherent system · Distributed System, chapter 1 · asked 2×
- DS vs centralized; layers of transparency · Distributed System, chapter 1
- Centralized vs distributed; design issues · Distributed System, chapter 1
- Network OS vs distributed OS · Distributed System, chapter 3
- Process vs thread; user and kernel threads · Operating System, chapter 2
- Data analytics process and distributed computing · Big Data Technologies, chapter 1
- Lumped vs distributed analysis, applications, protocols · RF and Microwave Engineering, chapter 1
- User-level versus kernel-level threads · Embedded System, chapter 6 · asked 2×