---
title: "Context switching; distributed vs network OS"
subject: "Distributed System"
chapter: 3
key: "semester_7/distributed_system:context-switch-dos"
source: https://www.bctengineer.com/q/semester_7/distributed_system/context-switch-dos
site: BCT Engineering
---

# Context switching; distributed vs network OS

Distributed System · Chapter 3: Operating System Support

- Asked in: 2074 Chaitra, 2+4 marks
- Video: [Context Switch](https://www.youtube.com/watch?v=vTgccrbYHYs) — Neso Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/context-switch-dos
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-3

## Question

What do you mean by Context Switching in distributed system? How is distributed OS different from network OS?

## Short answer

Context switching saves the state of one process/thread and loads another’s, occurring on each node during scheduling or remote calls. A distributed OS offers a single system image with global resource management and transparency, while a network OS exposes multiple independent machines and requires users to know locations.

## Answer

#### Context switching in a distributed system
**Context switching** is the saving of the state (registers, program counter, stack pointer, memory map) of the running process or thread and loading of the state of another one, so that the CPU is shared. In a distributed system it occurs on each node whenever the scheduler changes the process, and when a process blocks on a remote call (RPC/RMI) or a message. Entering the kernel through a system call needs a cheaper mode switch between user mode and kernel mode.

- Process context switches are costly (address space, caches, TLB), thread switches are cheaper, which is why multithreaded servers are used.
- Process **migration** also needs the context to be transferred to another machine.
- The overhead should be reduced by threads, lightweight IPC and a microkernel.

#### Distributed OS versus network OS
| Point | Distributed OS | Network OS |
|---|---|---|
| View | Single system image | Collection of separate computers |
| Transparency | High | Low; users know the location |
| Resource management | Global, by the OS | Local on each node |
| Process placement | OS decides, may migrate | User chooses the machine |
| OS on nodes | Same (homogeneous) | May differ |
| Communication | Message passing/RPC built in | File transfer, remote login via services |
| Fault tolerance | Better | Depends on user |
| Examples | Amoeba, Mach | Windows Server, UNIX + NFS |

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does a context switch involve?
   A. Copying a file to another node
   B. Saving the state of the running process and loading the state of another
   C. Restarting the machine
   D. Changing the network protocol
   Answer: B. It saves registers, program counter, stack pointer and memory map of one process and loads another's so the CPU is shared. (Key point: Context switching)

2. Why are multithreaded servers used to reduce context switch overhead?
   A. Thread switches are cheaper than process switches
   B. Threads need no stack
   C. Threads avoid all system calls
   D. Threads run on separate machines
   Answer: A. Process switches change address space, caches and TLB, while thread switches are cheaper. (Key point: Process vs thread cost)

3. Who decides where a process runs in a distributed OS compared with a network OS?
   A. User chooses in DOS, OS decides in NOS
   B. User chooses in both
   C. OS decides in both
   D. OS decides in DOS (and may migrate it), user chooses in NOS
   Answer: D. A DOS gives global resource management and process placement; in a NOS the user picks the machine. (Key point: DOS vs NOS placement)

4. In a distributed system, which event causes a context switch?
   A. A process blocking on a remote call or message
   B. Only a power failure
   C. Only creation of a file
   D. Never during RPC
   Answer: A. Switches happen on scheduler changes, blocking on RPC/RMI or messages, and user/kernel mode changes. (Key point: When switches occur)

## Related in Distributed System

- [Network OS vs distributed OS](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anos-vs-dos-diff) — Distributed System, chapter 3
- [Short note: Distributed OS](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Ados-note) — Distributed System, chapter 3
- [Autonomous vs distributed system](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aautonomous-vs-distributed) — Distributed System, chapter 1
- [Models of distributed system](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Amodels-of-ds) — Distributed System, chapter 1
- [True distributed system; middleware organisation](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Atrue-ds-middleware) — Distributed System, chapter 3
- [Nested vs distributed transaction; 2PC](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anested-vs-distributed-2pc) — Distributed System, chapter 8, asked 2×

## Related in other subjects

- [Process vs thread; context switching](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Athread-context-switching) — Operating System, chapter 2
- [Context switching in RTOS](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Acontext-switching) — Embedded System, chapter 6, asked 3×
- [Context switching, 5-state model, MLFQ](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Acontext-switch-5state-mlfq) — Operating System, chapter 2
- [T/F: switching surge ratio vs system voltage](https://www.bctengineer.com/question.md?key=semester_8%2Ftransmission_and_distribution_system_design%3Atf-ssr-system-voltage) — Transmission and Distribution System Design, chapter 3, asked 4×
