Escolar Documentos
Profissional Documentos
Cultura Documentos
Process Management
In a distributed environment process
management deals with the best use
of the processor resources of the
entire system by sharing them among
all the processes.
There are three important concepts
used to achieve this goal:
1.Processor Allocation.
2.Process Migration.
3.Threads.
Process Migration
It is the relocation of the process from
the source node to the destination node
to which it has been assigned.
Process migration involves the following
steps:
1. Selection of the process that has to
be migrated.
2. Selection of the destination node to
which the process has to be migrated.
3. Actual transfer of the process node
Desirable features of good
process migration
Transparency
1.Object Access Level
2. System call & Interprocess
communication level
Minimal Interference
Minimal Residual dependencies
Efficiency
Robustness
Communication between co-processes
of a job
Process transfer mechanisms..
Four major sub-activities are involved in
the process migration:
i) Freezing the process at its source
node and restarting the process at
the destination node.
ii) Transfer of the process address space
from the source to the destination.
iii) Forwarding the messages meant for
the migrant process.
iv) Handling the cooperation between
the processes that have been
seperated due to process migration
Mechanisms for freezing and restarting a
process:
Immediate and delayed blocking of
the process.
Fast & slow I/O operations
Information about open files.
Reinstantiating the process on the
destination node.
Address space transferring
mechanisms.
Total freezing
Pretransferring
Transfer on reference
Total freezing mechanisms.
Time Source node Destination node
Execution
suspended
Migration decision made
FRE-
ZZING Transfer of address
space
TIME
Execution resumed
Pretransfer mechanisms
Time Destination node
Source Node
Execution
suspended Transfer of
address
Freezing space
time
Execution
resumed
Transfer on reference
Source node Destination node
Time
Execution
suspended Migration decision made
Freezing
time
Execution resumed
On demand transfer
of addressing space
Message forwarding mechanisms
Ensure that all pending, en-route and
future messages arrive at process’s
new location.
Messages to be forwarded can be
classified into :
i. Message received at source node after process’s
execution stopped on its source node and not yet
started on destination node.
Message received at source after execution
started on destination.
Messages to be sent to migrant process from any
other node after it has started executing on
destination node.
Mechanisms for message
forwarding
Deserializing
1 2
8 External data
3 Bounds
Processor Processor
type 4
representation type 2 complexity of
7
4 translation s/w
6 5
Processor
type 3
Issues in handling Floating point
number representation
Handling Exponent
-problem with design of external data
representation.
-guarantee that external data representation
have at least as many bits as longest
exponent of any processor in the
distributed sys.
Handling Mantissa
Handling Signed- infinity & signed-zero
representation
Advantages of Process Migration
Reducing avg. response time of
processors
Speeding up individual jobs
Gaining higher throughput
Using resources effectively
Reducing n/w traffic
Improving Sys. Reliability
Improving Sys. Security
Threads
Threads
A thread is a light-weight process (LWP), a means of achieving
multitasking.
LWP shares all (or most of) its logical address space and
system resources with other processes and has its own private
Process ID and parenthood relationships with other processes.
A LWP is scheduled as a regular process.
Advantages of Threads
Creating a thread is cheaper than a process (~10-20 times)
Switching to a different thread in same process is (much)
cheaper (5-50 times).
Threads allow parallelism to be combined with sequential
execution and blocking system calls.
Threads within same process can share data and other
resources more conveniently and efficiently .
Thread Implementation
Combining kernel-level lightweight
processes and user-level threads.
Multithreaded Servers
Model Characteristics
Dispatcher-workers model:
In this model ,the process consists of a single dispatcher
thread and multiple worker threads.
Dispatcher-worker model.
Models for organizing threads
Contd..
Team Model:
All the threads behave as equals as there is no dispatcher-
worker relationship for processing client’s requests.
Pipeline Model :
In this model the threads of the process are pipelined so that
the output generated by the first thread is used for processing
by the second thread and the output generated by the second
thread is used for processing by the third thread and so on.
Issues in designing a Threads
package
Threads Creation:
Threads can be created either statically or dynamically.
Static approach :
In the static approach, the number of the threads of a process remains fixed
for it’s entire lifetime.
Dynamic approach:
The number of threads of a process keeps changing dynamically.
Threads Termination:
Thread may either destroy itself when it finishes it’s job by making an exit
call or can be killed from outside by using the kill command.
Threads Synchronization:
Some mechanism must be used to prevent multiple threads from trying to
access the same data simultaneously. For this to occur safely ,each thread
must ensure that it has exclusive access for this variable for some time.
Issues in designing a Threads
package-Contd
A segment of the code in which a thread may be accessing
some shared variables is called critical region.Hence the
threads using the same data must be mutually exclusive in
time.
Two mostly used mutually exclusive techniques :
i) mutex variable
ii) condition variable
i) Mutex variable:
• A mutex variable is like a binary semaphore that is always in
one of the two states ,locked and unlocked.
• A thread that wants to execute in a critical region performs a
lock operation on the corresponding mutex variable.
Issues in designing a Threads package-
Contd
• Only one thread can hold a particular lock at a time. Once a thread acquires
a lock, other threads cannot get that same lock until the first thread releases
the lock.
• If the mutex variable is already locked ,then either the thread is blocked and
entered in the queue or status code indicating failure is returned to the
thread.
Disadvantage:
Their use is limited to guarding entries to critical regions.
Threads scheduling:
Priority Assignment facility:
In this facility, priority is assigned to various threads of an application
to ensure that the important ones can be run on higher priority.
The priority based scheduling is either pre-emptive or non-preemptive.
Issues in designing a Threads
package-Contd..
Flexibility to vary quantum size dynamically:
A scheduling scheme may vary the size of the time quantum inversely with
the total number of threads in the system to timeshare the CPU cycles
among the threads.
Handoff Scheduling:
This mechanism allows a thread to name it’s successor.
Affinity Scheduling:
In this scheme,a thread is scheduled on the CPU it last ran on and that
part of the address space is still in that CPU’s cache.
Signal Handling:
The signal provide software generated interrupts and exceptions.
Interrupts are externally generated disruptions of a thread or a
process,whereas exceptions are caused by the occurrence of unusual
conditions using a thread’s execution.
Implementation of Thread Package