Chapter 3
Chapter 3
Distributed Systems
Chapter 3 - Processes
by Mintesinot Getachew
❑ Introduction to Threads
❑ Threads in DS
Outline
❑ Clients
❑ Servers
❑ Code Migration
❑ Virtualization
❑ PlanetLab
2
Process
4
Inter-Process Communication (IPC)
❑ Since processes are isolated, they require special IPC
mechanisms to exchange data.
❑ Common IPC techniques include:
▪ Pipes (used for parent-child communication).
▪ Message queues (used for structured communication).
▪ Shared memory (allows processes to access a common memory
space).
▪ Sockets (used for network-based IPC).
6
Threads
7
Threads in Distributed Systems
❑ Concurrency: Threads enable simultaneous task execution in distributed
systems for better performance.
❑ Distributed Processing: Threads operate across multiple machines,
facilitating distributed computing. Each machine runs threads that
communicate over a network.
❑ Resource Sharing: Threads share resources like data and memory for
collaborative tasks.
❑ Scalability: Threads support adding more machines for load distribution.
❑ Fault Tolerance: Enhance system reliability through redundancy and failover
mechanisms.
8
Threads in Distributed Systems Cont.d
9
Clients and Threads in DS
❑ Clients in a distributed system are software entities that request and
consume services from servers.
❑ Clients often use multiple threads to interact with servers concurrently,
making efficient use of resources.
❑ Client applications may utilize thread pools to manage and control the
number of threads used for server communication.
❑ Threads are used to enable asynchronous communication between clients
and servers, allowing clients to perform other tasks while waiting for server
responses.
❑ Clients may employ threads for load balancing, distributing requests to
multiple servers for improved performance.
10
Clients and Threads in DS
• Example: Online Video Streaming Service (Netflix, YouTube)
When a user watches a video:
• A thread fetches video data in small chunks.
• Another thread downloads subtitles.
• A separate thread preloads upcoming video segments for smooth playback.
11
Clients and Threads in DS Cont.d
❑ Distributed clients can use threads for redundancy and failover strategies to
maintain service availability.
❑ Developing thread-safe client applications is essential to prevent race
conditions when multiple threads access shared client resources.
❑ Clients often use synchronization mechanisms like locks and semaphores to
manage shared resources and ensure data consistency.
❑ Threads can be employed to manage local caches, reducing the need for
repeated requests to the server and improving response times.
❑ Threads are used for processing and handling server responses, allowing
clients to perform parallel tasks efficiently
12
Server and Threads in DS
❑ Servers in distributed systems are software entities that provide services to
clients over a network.
❑ Servers use threads to manage and process incoming client requests.
❑ Threads are dynamically created by servers to handle client connections.
❑ Threads enable servers to handle multiple client requests simultaneously,
improving system performance.
❑ Servers use threads to process and execute client requests efficiently.
13
Server and Threads in DS Cont.d
❑ Threads are employed to manage and maintain server state information for
various clients.
❑ Server clusters may use threads to distribute client requests across multiple
instances for load balancing.
❑ Threads help allocate server resources like CPU, memory, and network
connections to client requests.
❑ Server applications often use thread pools to efficiently manage and reuse
threads for client interactions.
❑ Threads in servers may require synchronization to ensure data integrity and
consistent service delivery to clients.
14
Code Migration
❑ Code migration is used to optimize resource utilization in distributed
systems by moving code or processes to nodes with available resources.
❑ It helps balance the load across nodes, ensuring that no single node is
overwhelmed with processing tasks.
❑ Code migration allows distributed systems to adapt to changing workloads
and network conditions in real-time.
❑ It can enhance fault tolerance by redistributing work in case of node failures,
ensuring continuous service availability.
❑ Code migration can be used to conserve energy in data centers by
consolidating workloads on fewer nodes during periods of low demand.
15
Code Migration Cont.d
Advantages
❑ Code migration can improve system performance by reducing contention
and resource bottlenecks.
❑ It contributes to scalability by enabling systems to handle increased
workloads without significant performance degradation.
❑ It allows for better resource utilization and reduces the overall number of
active nodes, leading to cost savings.
❑ Code migration adds adaptability to distributed systems, making them
responsive to varying demands.
16
Code Migration Cont.d
Implementation
❑ Code migration can be implemented using mechanisms such as process
migration, thread migration, or VM migration, depending on the system's
requirements.
❑ Transfer: During migration, it's necessary to transfer the state of the migrating
code, including variables, context, and open files, to the destination node.
❑ Data associated with the migrating code might also need to be transferred to
ensure consistent operations.
❑ Synchronization mechanisms are used to coordinate and manage code
migration to prevent data corruption and ensure atomicity.
❑ Implementation should consider network latency and bandwidth when
migrating code to minimize performance impact. 17
PlanetLab
❑ Research Network: PlanetLab was a worldwide network of distributed
nodes, typically hosted by universities and research institutions.
❑ Resource Sharing: It provided a platform for researchers to share resources
such as computing power, storage, and network connectivity.
❑ Network of Nodes: It consisted of hundreds of geographically distributed
nodes, allowing researchers to conduct experiments in diverse network
environments.
❑ Virtualization: Virtualization technologies were used to isolate and manage
experiments running on PlanetLab nodes.
❑ Experimentation: Researchers used PlanetLab for a wide range of
experiments, including network protocol testing, distributed systems
18
research, and Internet service development.
PlanetLab Cont.d
❑ Open Access: It is open to researchers around the world, offering a common
infrastructure for experimentation.
❑ Slice-based Architecture: PlanetLab used a slice-based architecture,
allowing researchers to reserve a subset of nodes for their experiments.
❑ Challenges: Maintaining a large and geographically distributed network
posed challenges in terms of resource availability and security.
❑ Legacy: While it was a groundbreaking platform, PlanetLab faced challenges
related to aging hardware and evolving research needs.
❑ Impact: PlanetLab contributed significantly to the development of
distributed systems and networking research by providing a global platform
for experimentation and innovation.
19
Virtualization in DS
❑ Resource Partitioning: Virtualization divides physical resources into isolated
virtual environments, allowing thread management.
❑ Isolation: Strong isolation enhances security and stability for threads within
virtual environments.
❑ Thread Migration: Virtualization supports dynamic thread migration for load
balancing and fault tolerance.
❑ Resource Allocation: Precise resource allocation ensures threads have what
they need.
❑ Optimized Utilization: Virtualization and thread management optimize
resource usage for improved performance.
20
Summary questions
1. What is the advantage of multithreading.
2. What’s the difference between thread and process.
3. Explain why is code migration needed in a Distributed system.
4. Discuss about Planet Lab Distributed system.
5. Explain the Role of virtualization.
21