Skip to content
SEE Exam Prep

Question 2 of 11 · Set 1 · 6 marks

Open in ChatGPT

Explain the differences between threads and software agents. Explain how virtualization and code migration influence process execution in distributed systems.


Introduction

A distributed system has to decide where computation runs before it can run anything. Threads, agents, virtual machines and migration are four answers to that, and they differ in what moves and what state stays behind.

Threads versus software agents

Point Thread Software agent
Nature A unit of execution inside a process An autonomous entity that acts on its owner's behalf
State Stack, registers, shared address space Code plus its own state, possibly goals and history
Mobility Runs on one machine Can move between machines
Communication Shared memory or IPC Messages, with the agent's identity
Failure Killed with the process Can continue elsewhere

A thread is a scheduling concept; an agent is a software concept with autonomy and location.

Virtualisation

  • A hypervisor runs several virtual machines on one host, each with its own operating system and its own illusion of hardware.
  • In a distributed system this gives isolation (one tenant cannot affect another), consolidation (many services on one host), and mobility: a whole running VM is a unit that can be stopped, moved and resumed.

Code migration

  • Weak migration moves only the code; the process starts fresh with an empty state.
  • Strong migration moves the code and the execution state (stack, registers), so execution resumes exactly where it stopped.
  • Migration is initiated by the sender (push), the receiver (pull), or the process itself.

How they change process execution

  1. Execution becomes location-independent. The same binary or the same image runs on any host, so the scheduler can choose the host by load or by data locality.
  2. Failure handling changes. A VM or an agent can be restarted elsewhere; a thread cannot.
  3. State must be made portable. Registers, file descriptors, open sockets and references to other objects are the hard part of strong migration, which is why most systems do it at the VM or container boundary instead of the process boundary.
  4. Consistency gets harder. A process that moves while holding a lock or a cached copy leaves both behind, so migration protocols must transfer or release them.

Example

A cloud scheduler moves a running VM to a host with free memory: the guest never notices. Moving an ordinary process with open sockets to another host would break every connection, which is why strong migration in practice means VM or container snapshots, not process state.

Conclusion

Virtualisation makes the machine mobile; code migration makes the computation mobile. Threads stay inside one process on one host, and agents are the abstraction that makes moving them meaningful.