Professional Documents
Culture Documents
CONCURRENCY
INTRODUCTION
Introduction to the introduction:
the beginnings...
I/O OVERLAPPING
I/O OVERLAPPING
Yes, it all started with I/O overlapping. What’s i/o overlapping? To cut a
long story short: in programs where i/o operations are required,
i/o devices can interrupt the processor to notify the completion
of an operation. The processor may then branch to a specific
subroutine perform some tasks and later on branch back to the
point where the interruption happened. Also, when a program
required an i/o operation that could take long to be completed,
instead of making the processor idle-wait until the end of the
operation, control could be transferred to another program,
minimizing wasting cpu-time.
Introduction to the introduction:
the beginnings...
DMA...
Introduction to the introduction:
the beginnings...
... And then came
TIME-SHARING BASED MULTI-USER SYSTEMS
(TIME-SLICING)
Introduction to the introduction:
the beginnings...
... And eventually came parallelism
USE SEVERAL PROCESSORS AND DO MORE THAN
ONE THING IN PARALLEL!
Deterministic?
Execute the same “ordinary” program twice with the same
data and you’ll get exactly the same results.
CONCURRENT program
A PROCESS is a sequential program in execution
Totally or partially loaded into memory
Has (may have) resources allocated (files,...)
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
a b c d e f g
a b c d e f g
Overlapping Overlapping
1 2 a b 3 c d e 4 5 6 7 f 8 g 9
Interleaving
1 a 2 b 3 c 4 d e 5 6 f 7 8 9 g
Interleaving
p1 q1
And
q1 p1
Granularity and the concurrent update
problem
Now Let’s assume that n n +1
cannot be performed atomically (for
instance because it requires the use
of an intermediate temporal
variable...)
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
6 different traces (13
possible states) and
2 possible outcomes
YES, CONCURRENCY IS DIFFICULT!!!
The concurrent update problem