Petri nets

Standard finite state machines contain only a single current state. Whereas in Petri nets, multiple locations, more or less comparable with states in a finite state machine, can include one or more tokens. A finite state machine is single-threaded while a Petri net is concurrent.

A real-life example of Petri nets: ordering at a restaurant.

  • Scenario 1:

Waiter takes order from customer 1; serves customer 1; takes order from customer 2; serves customer 2.

  • Scenario 2:

Waiter takes order from customer 1; takes order from customer 2; serves customer 2; serves customer 1.