2. The next Petri net model contains two processes A and B accessing the files F1
and F2. For both processes there are places representing the following states:
- the process has been started .
- the process uses the first file (F1 for the process A, F2 for B) .
- the process uses both files .
3. For both processes there are transitions representing the following actions:
- the process takes the first file (F1 for the process A, F2 for B),
- the process takes the second file (F2 for the process A, F1 for B),
- the process finishes.
4. The files are modeled by tokens in places F1 and F2 respectively. The tokens in
places "process starts" represent the fact, that the processes have been started.
At the beginning there are two enabled transitions (both processes may start).
The second step decides whether there will be a deadlock or not. If both
processes take one file, no process can continue. If the process which took the
first file takes also the second one, everything is OK. The next example shows the
solution to this deadlock problem.