Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1972
This Technical Report is brought to you for free and open access by the School of Computer Science at Research Showcase @ CMU. It has been
accepted for inclusion in Computer Science Department by an authorized administrator of Research Showcase @ CMU. For more information, please
contact research-showcase@andrew.cmu.edu.
PROBLEM
D. L. P a m a s
July, 1972
This work was supported in part by the Naval Research Laboratory under
project WF-15-241-601 and in part by the Advanced Research Projects Agency
of the Office of the Secretary of Defense (F44620-70-C-0107) and is monitored
by the Air Force Office of Scientific Research. This document has been
approved for public release and sale; its distribution is unlimited.
ABSTRACT
that Patil s proof overlooks important capabilities for P and V which were
used by Dijkstra in his original report.
Introduction
In a widely circulated and referenced memorandum
[1,2],
Problem".
and
primitives introduced
the
and
In this paper we
Problem, discuss
The Problem
To avoid the possibility of misinterpretation of the problem,
and because the problem is defined with some quite arbitrary
restrictions, we quote the following statement of the problem
directly from the paper by Patil [1].
[1]
Problem
[1]
smoking of a cigarette; p
performs
c
P[s]
P[s]
V[b]
V[a]
V[a]
V[c]
V[c]
V[b]
qo to
qo to r
P[Y]
P[Z]
V[s]
V[s]
qo to P_
P[s]
qo to r
P :
the agent
*b
r :
[1]
P :
y
P[X]
V[s]
qo to
qo to P
initially s = 1
and a,b,c,X,Y
and Z = 0
a :
x
a :
P[b]
P[a]
P[b]
the smokers
V[X]
V[Y]
V[Z]
go to a
go to a
a
2
J:
The smokers' problem is to define additional semap w W 7 ~ a n d processes and to introduce appropriate P
"and V "statements so as to make them deadlock free.
No"~aIteration may, however, be made to the processes
defining the agent."
t;
(initially 0)
semaphore array
6
(initially 1)
S[l:6];
(initially 0)
P (a) 7
P (b) 7
P (c) 7
(mutex)7
(mutex)
t + 2;
t + 4
(mutex);
t +~ t + 1;
t4-
V(S[t]) 7
V(S[t]) 7
V(S[t]) 7
V (mutex) ;
V (mutex) 7
V (mutex)
30_to 6 ^ 7
go to 5^7
go to 6 ?
X
be
Y
ac
P(S[5]) ;
ab
t*-0;
V (Y) ;
go to
go to a ;
x
Optional:
l S
go to a ;
2
if overflow is a problem
P(S[1]);
go to
a y
6 ;
1
6 :
2
P(S[2]);
go
to >2'>
P(S[4]) ;
go to 63
Comments
The last three processes are superfluous unless one worries
about the ill-defined problem of semaphore overflow.
The solution
On Patil* s Proof
Patil
Patil states
P[S] has
V[S],
S."
and
Since these
(where
represents an arbitrary
P.
The evaluation
languages
P(s,E) where
is a
by value
by name.
We consider this
operations.
In this author s
[6].
Although
(without
PV
in the way that we assign tasks to processes and the way that
we assign interpretations to the semaphores in use.
Often
It would be artificial
P" and "V" are deliberately designed so that when there are
Perhaps some
and
V (and conditionals).
10
such processes, one should build the operations, but they need
not be built as "primitives".
the authors of
are suggested.
The operations suggested by Patil have been called "parallel"
operations because they simulate simultaneous activities on many
semaphore variables.
process which does tasks which could have been done by several
cooperating sequential processes.
In this
11
Both
Acknowledgement
I am also grateful to P.
References
1
[1]
[2]
[3]
[4]
[5]
[6]
P. J. Courtois; private
communication.
O R I G I N A T I N G
classification
A C T I V I T Y
of title,
(Corporate
body
of abstract
and indexing
annotation
must
be entered
author)
2a.
R E P O R T
when
the overall
R E P O R T
report
S E C U R I T Y
is
classified)
C L A S S I F I C A T I O N
UNCLASSIFIED
2b.
G R O U P
T I T L E
N O T E S (Type
of report
Scientific
5- A U T H O R ( S ) (First
and
inetuaive
datea)
Final
name,
middle
initial,
last
name)
D. L. Parnas
6.
R E P O R T
D A T E
7a.
T O T A L
9a.
O R I G I N A T O R ' S
July, 1972
8a.
C O N T R A C T
O R
N O . O F
P A G E S
7b.
N O . O F
15
G R A N T
N O .
R E F S
6
R E P O R T
N U M B E R ( S )
WF-15-241-601
b.
P R O J E C T
N O .
9b.
O T H E R
this
R E P O R T
report)
N O ( S ) (Any
other
be
assigned
v
C.
10.
d.
D I S T R I B U T I O N
S T A T E M E N T
11.
S U P P L E M E N T A R Y
N O T E S
TECH OTHER
12.
S P O N S O R I N G
M I L I T A R Y
A C T I V I T Y
information Systems
Naval Research Laboratory
Washington, D. C. 20390
DD , r..1473
N
_ _ _ _ _ _
Security
Classification
Security
Classification
O R I G I N A T I N G
classification
A C T I V I T Y
of title,
(Corporate
body
of abstract
and indexing
annotmtion
R&D
must
be entered
author)
2.
R E P O R T
2b.
report
S E C U R I T Y
la
classified)
C L A S S I F I C A T I O N
G R O U P
T I T L E
N O T E S (Type
of report
Scientific
5.
the overall
UNCLASSIFIED
when
R E P O R T
A U T H O R ( S ) (First
and inctuaive
dates)
Final
name,
middle
initial,
last
name)
D. L. Parnas
6-
R E P O R T
D A T E
7a.
T O T A L
8a.
C O N T R A C T
N O . O F
7b.
P A G E S
N O . O F
15
July, 1972
O R G R A N T
O R I G I N A T O R ' S
N O .
R E F S
6
R E P O R T
N U M B E R ( S )
F44620-70-C-0107
b.
P R O J E C T
N O .
9769
96.
C-61102F
"681304
D I S T R I B U T I O N
10.
O T H E R
Me
R E P O R T
report)
N O I 9 I (Any
other
number*
that may be
aeatfred
S T A T E M E N T
S U P P L E M E N T A R Y
N O T E S
TECH OTHER
13.
12.
S P O N S O R I N G M I L I T A R Y
A C T I V I T Y
, , , v
A B S T R A C T
DD , r ,1473
N
Security
Classification