Distributed System: Processes in DS
Distributed System: Processes in DS
Chapter 3
Processes in DS
Objectives
•After accomplishing of this chapter, Students will be able to understand:
•A process is a program that is loaded into memory, found under executing and
it is a collection of one or more threads (What is thread??) and associated
system resources.
•Process can create one or more other processes referred to as child processes
and these processes in turn can create child processes.
•Related Processes that are cooperating to get some job done often need to
communicate with one another and synchronize their activities.
Definition of Process (Computing)
•In computing, a process is the instance of a computer program that is being executed
by one or many threads.
•It contains the program code, its activity and depending on the operating
system (OS).
•Several processes may be associated with the same program, for example, opening
up several instances of the same program often results in more than one process
being executed.
Cont…
• To understand the role of threads in distributed systems, it is important
to understand what a process is, how processes and threads relate.
• Apart from saving the CPU context (which consists of register values,
program counter, stack pointer, etc.), the operating system will also have to
modify registers of the memory management unit (MMU).
Cont…
Cont…
Cont…
Generally Process is
• A process is often defined as a program in execution, that is, a program
that is currently being executed on one of the operating system's virtual
processors.
• But because they operate so fast, they can be made to appear to run many
programs and serve many users simultaneously.
• This illusion is created by rapidly multiplexing the processor over the set
of active tasks.
• The processor operates at speeds that make it seem as though all of the
user's tasks are being performed at the same time.
Cont…
• The concept of multitasking is really quite straightforward: a number of
programs (we will call them “tasks”) appear to be running on the same
CPU simultaneously.
• This is achieved by allowing each task to run for a short while and then
interrupting it, saving its machine registers’ contents, loading the
registers with the data for the next task, and continuing processing.
Cont…
•Multitasking is a method to allow multiple processes to share processors (CPUs)
and other system resources.
•It is therefore deeply related to the OS capability for managing shared resources,
and in particular for arbitrating conflicts resulting from resource over-commitment.
• New tasks can interrupt already started ones before they finish, instead of waiting for them to
end.
• As a result, a computer executes segments of multiple tasks in an interleaved manner, while the
tasks share common processing resources such as central processing units (CPUs) and main
memory.
• Multitasking automatically interrupts the running program, saving its state (partial results,
memory contents and computer register contents) and loading the saved state of another
program and transferring control to it.
Cont…
Cont…
Cont…
•A common form of multitasking is provided by CPU's time-sharing that is a
method for interleaving the execution of users processes.
•Prevention has an important side effect for interactive process that are given
higher priority with respect to CPU bound processes.
•Requests then execute asynchronously under the control of the operating system and
the listener process could also provide an immediate initial response to the client if
required.
•The problem however is that process creation can be quite slow as the operating
system has to find sufficient free memory space for the process and set up other parts
•This is a more saleable approach from the operating system's point of view as it is a more efficient use of system
resources.
•Coordination and synchronization between the cooperating parts of the server process are achieved more efficiently
with shared memory mechanisms.
•Threads allow parallelism to be combined with the easily understood blocking communication of the client/server
model.
Cont…
•We can retain the model of our sequential process interaction with blocking calls
but still achieve parallelism in the application with threads.
•This is because when a thread in a process blocks, waiting for a reply from a
server, another thread within that process can be scheduled and so the process does
•Threads share the CPU just as processes do: first one thread runs, then another does and can
create child threads and can block waiting for system calls to complete.
•All threads have exactly the same address space and they share code section, data section, and
OS resources (open files & signals).
•They share the same global variables and one thread can read, write, or even completely wipe
out another thread’s stack.
Advantage of Thread
Useful for Clients: if a client wants a file to be replicated on multiple servers, it can
Handle Signals: such as interrupts from the keyboard and instead of letting the signal
interrupt the process, one thread is dedicated full time to waiting for signals.
Producer-Consumer Problems: are easier to implement using threads because threads
It is possible for threads in a single address space to run in parallel, on different CPUs.
Cont…
•The main contribution of threads in distributed systems is that they allow clients and servers to
be constructed such that communication and local processing can overlap, resulting in a high
level of performance.
•Virtualization allows an application, and possibly also its complete environment including the
operating system, to run concurrently with other applications, but highly independent of the
underlying hardware and platforms, leading to a high degree of portability.
•Moreover, virtualization helps in isolating failures caused by errors or security problems and It
is an important concept for distributed systems, and we pay attention to it in a separate section.
Why Do We Need Threads?
•Simplifying: The programming model: since many activities are going on at once
more or less independently.
•They are Easier: To create and destroy than processes since they do not have any
resources attached to them.
and let the client exit the client application, this will break the connection to the server,
the server will tear down the connection assuming that the client had crashed.
Web server.
Code Migration
•Code Migration is when programs are moved from one machine to another, often
•Code Migration is often used for load distribution, reducing network bandwidth,
•To Reduce Communication: move a client application that performs many database
operations to a server if the database resides on the server, then send only results to the
client.
•To Exploit Parallelism: copies of a mobile program (called a mobile agent or a crawler
as is called in search engines) moving from site to site searching the Web.
•An interface agent is an agent that assists an end user in the use of one or more
applications and has learning capabilities (it is adaptive), e.g., those that bring
•An information agent is an agent that manages information from different sources
such as ordering and filtering.
THANK YOU!!!
QUESTIONS???