1
CDA 4630/5636: Embedded Systems
Midterm (Duration: 50 minutes)
–
March 1, 2017
Instructor:
Prabhat Mishra
NAME
UFID
1.
This is a
50 minutes (50 points)
,
closed-book/notes
exam.
2.
You are allowed to bring
hand-written
note
on one side
of a US letter size paper, and a
calculator
.
3.
This exam contains
four pages
(including this one) and
nine questions
.
4.
Write all answers on the white space provided below the question.
5.
Make reasonable assumptions when you think the question is not providing all necessary details. Points will be
deducted if you make an assumption to simplify the problem when the information is directly/indirectly available.
1.
[
4 points
] Consider the following predicate/transition Petri Net model for the dining philosopher problem with
5
philosophers. Both (left and right) forks are needed for eating. Assume that the following arrangement in a linear (not
circular) dining table: f1 P1 f2 P2 f3 P3 f4 P4 f5 P5 f6. In this case, P1 has left fork of f1 and right fork of f2, etc.
Here, the five philosopher tokens are P1 to P5, and six fork tokens are f1 to f6. In this figure
, ‘x’ is the philosopher, ‘t’
implies thinking, ‘f’ implies forks, ‘e’ implies eating, and ‘l(x)’ and ‘r(x)’ implies left and right forks, respectively, of
philosopher ‘x’.
This model
has two transitions, ‘u’ and ‘v’, that indicate start
-eating and done-eating, respectively.
a)
[4] Show the tokens
for the
initial
state
assuming philosophers 2 and 4 are eating. No explanation required.
b)
[4] List all possible combinations
(scenarios) of philosophers that can be in eating state at the same time. In
other words, each entry in your list can have one or more philosophers that can eat together while satisfying the
constraints outlined above. For example, only P1 eating is a valid scenario. No explanation required.
P1
P2
P3
P4
P5
P1, P3
P1, P4
P1, P5
P2, P4
P2, P5
P3, P5
P1, P3, P5
f1
P2
P1
P3
P4
f6
P5

2