3. 10.1 Introduction
• P and V operations and using wrong semaphores are
typically errors with heavy consequences for program
execution.
• With monitors there exist the danger of incorrectly using
the condition variables or the wait and signal operations.
• In general the following problems can occur through
programming errors during process synchronization
– 1. Inconsistent Data
– 2. System Lockup (Deadlock/Livelock)
• The ways of dealing these problems, ways to avoid them,
problem of load balancing, and achieving an efficient
loading all processors will be dealt in the following
sections.
4. 10.2 Inconsistent Data
• A data element, or a relation between data, is inconsistent
after the execution of parallel operations if only if it does
not have the value that it would have received from
sequential processing of the operation.
• Without adequate concurrency control mechanism,
erroneous data may easily occur during execution of
parallel processes.
• There are tree basic classes of problem
– 1. Lost update problem
– 2. Inconsistent analysis problem
– 3. Uncommitted dependency problem
5. Lost Update Problem
• Mr. miller’s salary comes to $1000.
•
• Process 1 should raise the salary by %50.
•
• Process 2, executes in parallel with P1, should increase the
salary by %10 salary.
•
• Depending the sequence of the execution;
•
• Figure 9.1 (8.1)
6.
7. Inconsistent analysis problem
• A typical example of this problem is a money transfer at a
bank.
• The sum of the two accounts involved is identical before
and after transaction.
• Figure 9.2 (8.2)
• While P1 executing money transfer, the relation between
the two data elements is incorrect for a short time of
period.
8.
9. Uncommitted Dependency
Problem
• The possibility of uncommitted transaction is a typical
database problem.
• Since a transaction may succeed or fail, the changes of
global data made by a transaction are only valid with the
proviso (sözleşme) of the transaction’s successfully
termination.
• If transaction A changes global data, transaction B then
read this data, and transaction A subsequently fails, then
transaction B has using invalid data.
• A successful transaction will always be completely
executed (commit), while a failing transaction has to be
cancelled completely (rollback).
10. 10.3 Deadlocks
• Deadlock describes the situation in a parallel system where
a number of processes permanently block each other
(incorrect process synchronization).
• A livelock is a special type of blocking, in which the
processes remain active but carry out only unproductive
operations (waiting> busy) in an endless loop.
• Figure 9.3 show the danger of deadlock.
• The following conditions must be met before deadlock can
occur.
11.
12. • 1. Resource can only be used exclusively (mutual
execution).
• 2. Processes have resources allocated while requesting
new one (incremental request).
• 3. Resource cannot be forcibly taken from process (no
preemption).
• 4. A circular chain of processes exist in which each
process has a resource that is requested by the next process
in the chain (circular wait).
• Breaking down condition 3: when deadlock occurs, the
resources already allocated to the process can be forcibly
de-allocated.
• Breaking down condition 2; every process must request all
required resources at one time.
14. Load balancing (2)
• Another large problem area in asynchronous parallel
programming, although without the drastic consequences
of the earlier mentioned problem areas, is load balancing.
• Figure 9.4 (8.3) shows an example for unbalanced load.
• In a simple scheduling model, a static distribution of
processes among the processors is used.
• This means is that processes does not move at run time
(heavily loaded to lightly loaded).
• In order to avoid such inefficiencies, extended scheduling
models have been developed (dynamic load balancing by
reshuffling already assigned processes depending on the
local process load in relation to a threshold).
15.
16. • Tree principle methods for controlling process migration.
• 1. Receiver Initiative: Process with little load request more
process. Well suited for heavy system load.
• 2. Sender Initiative: Processes with heavy loads attempt to
hand processes to other processors. Well suited for light
system load.
• 3. Hybrid model: Switching between sender and receiver
initiative depending on global system load.
17. Advantages and disadvantages
of load balancing method
• + Higher process usage is achieved without giving up any
possibility of parallelism.
• +/- Circular ‘process migration’, the continually passing of
the same process between processors, must be avoided by
using suitable parallel algorithms and bounding values.
• - Considerable administrative cost...
• - Moving a processes from a more lightly loaded processor
is and expensive operation…
• - All of methods of load balancing are engaged to late
(Additional information is required)…
• - Under heavy parallel system load, all forms of load
balancing is pointless…