0% found this document useful (0 votes)
27 views30 pages

Lecture-5 - Processes F23

Uploaded by

Tahira Anjum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views30 pages

Lecture-5 - Processes F23

Uploaded by

Tahira Anjum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

DISTRIBUTED COMPUTING

Iftikhar Hussain Babur


System Analyst
Quaid-e-Azam Academy for Educational Development
Govt. of the Punjab, Wahdat Road Lahore
[email protected]

Superior University, Gold Campus


Today’s Topic

Processes

9/22/2023 Superior University, Gold Campus 2


Processes
• A process- a running instance of a program
• Virtual processors
• Process table (CPU register values, memory maps, open files,
accounting information, privileges, etc.)
• Independent address space
• Switching the CPU between two processes
• Swapping processes between main memory and disk

9/22/2023 Superior University, Gold Campus 3


Threads
• A traditional process has a single thread of control and a single
program counter.
• Modern operating systems provide multiple threads of control
within a process at the kernel level - these are called Threads or
lightweight processes. (A heavyweight process is an instance of a
program).
• All threads within a process share the same address space.
• A thread shares its code and data section with other threads.

• Each thread has its own program counter, stack and register set.
• The program counter determines which instruction the thread is
currently executing.
• The register set saves the thread’s state when it is suspended and
reloaded into the machine registers upon resumption.

9/22/2023 Superior University, Gold Campus 4


Threads
Types:
• User Threads
• Kernel Threads
Benefits of multithreaded processes:
• Increased responsiveness to user:
• Resource Sharing
• Economy
• Utilization of Multiprocessor Architectures
• Many applications are easier to structure as a collection of
cooperating threads.

9/22/2023 Superior University, Gold Campus 5


Thread Implementation

• Thread package (create and destroy, synchronization


variables and condition variables).

• Mutex - mutual exclusion object.

• Two approaches to implement a thread package.

9/22/2023 Superior University, Gold Campus 6


Thread Implementation
1. Construct a thread library that is executed entirely in user
mode.
Advantages:
• Cheap, switching in few instructions
Disadvantage:
• Blocking system call
2. Have the kernel be aware of threads and schedule them.
Advantages
• Eliminates blocking problem.
Disadvantage:
• Every thread operation (creation, deletion, synchronization, etc.),
will have to be carried out by the kernel, requiring a system call.

9/22/2023 Superior University, Gold Campus 7


Combining kernel-level lightweight processes and user-level threads.

9/22/2023 Superior University, Gold Campus 8


Multithreading Models
Three common ways of establishing a relationship
between user level threads and kernel-level threads
1. Many-to-One
Many user-level threads mapped to single kernel thread.
2. One-to-One
Each user-level thread maps to a kernel thread.
3. Many-to-Many
Allows many user level threads to be mapped to many
kernel threads.

9/22/2023 Superior University, Gold Campus 9


Threads in distributed systems

Clients
• to hide network latency
• e.g. multithreaded web client:
• Multiple request-response calls to other machines:
Servers
• In servers, the main issue is improved performance and
better structure
• Improve performance:
• Better structure:

(Page 7-10)
9/22/2023 Superior University, Gold Campus 10
Virtualization
• Virtualization creates an external interface that hides an underlying
implementation
a) General organization between a program, interface, and system.
b) General organization of virtualizing system A on top of system B.

9/22/2023 Superior University, Gold Campus 11


Common uses of the term
Divided into two main categories:
Platform virtualization involves the simulation of virtual machines.
Resource virtualization involves the simulation of combined,
fragmented, or simplified resources.

9/22/2023 Superior University, Gold Campus 12


Role of Virtualization in Distributed Systems

Issue-1:
• While hardware and low-level systems software change
reasonably fast, software at higher levels of
abstraction(e.g., middleware and applications), are much
more stable - legacy software cannot be maintained in
the same pace as the platforms it relies on.
Solution:
• Virtualization can help here by porting the legacy
interfaces to the new platforms and thus immediately
opening up the latter for large classes of existing
programs.

9/22/2023 Superior University, Gold Campus 13


Role of Virtualization in Distributed Systems

Issue-2:
• Networking has become completely pervasive.
• Connectivity requires that system administrators
maintain a large and heterogeneous collection of server
computers, each one running very different applications,
which can be accessed by clients.
Solution:
• The diversity of platforms and machines can be reduced
by letting each application run on its own virtual
machine, possibly including the related libraries and
operating system, which, in turn, run on a common
platform.

9/22/2023 Superior University, Gold Campus 14


Role of Virtualization in Distributed Systems

Issue-3:
• Management of content delivery networks that support
replication of dynamic content becomes easier if edge
servers supported virtualization, allowing a complete
site, including its environment to be dynamically copied.
• As we will discuss later, it is primarily such portability
arguments that make virtualization an important
mechanism for distributed systems.
Solution:
• Virtualization provides a high degree of portability and
flexibility making it an important mechanism for
distributed systems.

9/22/2023 Superior University, Gold Campus 15


Architectures of Virtual Machines
Various interfaces offered by computer systems.

9/22/2023 Superior University, Gold Campus 16


Virtualization can take place in two different ways:
1. Process virtual machine
• Build a runtime system that provides an abstract instruction set
that is to be used for executing applications.
• Instructions can be interpreted (as is the case for the Java runtime
environment), but could also be emulated as is done for running
Windows applications on UNIX platforms.
2. Virtual machine monitor (VMM)
• Implemented as a layer completely shielding the original
hardware, but offering the complete instruction set of that same
(or other hardware) as an interface.
• This interface can be offered simultaneously to different programs.
• Possible to have multiple, and different operating systems run
independently and concurrently on the same platform.
• Example: VMware and Xen (website).
9/22/2023 Superior University, Gold Campus 17
Virtualization
(a) A process virtual machine, with multiple
instances of (application, runtime) combinations.

(b) A virtual machine monitor, with multiple


instances of (applications, operating system)
combinations.

9/22/2023 Superior University, Gold Campus 18


Clients
Networked User Interfaces
Two ways to support client-server interaction:
1. For each remote service - the client machine will have a
separate counterpart that can contact the service over the
network.
• Example: an agenda running on a user's PDA that needs to synchronize with
a remote, possibly shared agenda.
• In this case, an application-level protocol will handle the synchronization, as
shown in Figure(a).
2. Provide direct access to remote services by only offering a
convenient user interface.
• The client machine is used only as a terminal with no need for local storage,
leading to an application neutral solution as shown in Figure(b).
- thin-client approach - everything is processed and stored at the server

9/22/2023 Superior University, Gold Campus 19


A general solution to allow access to remote
applications.

A networked application with its own


protocol.

9/22/2023 Superior University, Gold Campus 20


Servers
• A server is a process implementing a specific service on behalf of a
collection of clients.
• Each server is organized in the same way:
Several ways to organize servers:
• Iterative server
• Concurrent server

• Where do clients contact a server?

9/22/2023 Superior University, Gold Campus 21


State of Server:
A stateless server is a server that treats each request as
an independent transaction that is unrelated to any
previous request.
• A stateless server does not keep information on the state
of its clients, and can change its own state without
having to inform any client.
A stateful server remembers client data (state) from one
request to the next.
• Information needs to be explicitly deleted by the server.
• Improves performance of read and write operations as
perceived by the client.

• Advantages / Disadvantages (web search)

9/22/2023 Superior University, Gold Campus 22


Server Clusters
A server cluster is a collection of machines connected through a
network, where each machine runs one or more servers.

A server cluster is
logically organized
into three tiers

First tier - consists of a (logical) switch through which client


requests are routed.
• Switches vary:

9/22/2023 Superior University, Gold Campus 23


Server Clusters
A server cluster is a collection of machines connected through a
network, where each machine runs one or more servers.

A server cluster is
logically organized
into three tiers

Second tier: application processing.

9/22/2023 Superior University, Gold Campus 24


Server Clusters
A server cluster is a collection of machines connected through a
network, where each machine runs one or more servers.

A server cluster is
logically organized
into three tiers

Third tier: data-processing servers - notably file and database


servers.

9/22/2023 Superior University, Gold Campus 25


Code Migration

• Instead of passing data around, why not moving code?


• What for?
• Improve load distribution in compute-intensive systems
• Save network resource and response time by moving processing
data closer to where the data is
• Improve parallelism w/o code complexities
• Dynamic configuration of distributed systems

9/22/2023 Superior University, Gold Campus 26


Process Mobility
A process consists of three segments:
• Code segment –
• Resource segment –
• Execution segment –
Types of Process Mobility:
• Weak mobility - Transfer only the code segment, along with some
initialization data.
• Strong mobility - execution segment is transferred as well.

9/22/2023 Superior University, Gold Campus 27


Migration Initiation
Sender-initiated - migration is initiated at the machine
where the code currently resides or is being executed.

Receiver-initiated - Initiative for code migration is taken


by the target machine.
• Java applets are an example.
• Receiver-initiated migration is simpler than sender-
initiated migration.

9/22/2023 Superior University, Gold Campus 28


Migration Initiation
• Code migration usually occurs between a client and a server,
where the client takes the initiative for migration.
• Downloading code can often be done anonymously.
• The server is not interested in the client's resources.
• Code migration to the client is done only for improving client side performance.
• Only a limited number of resources need to be protected, such as memory and
network connections.

9/22/2023 Superior University, Gold Campus 29


9/22/2023 Superior University, Gold Campus 30

You might also like