...
- Each train has a trainnumber.
- Apart from identification the trainnumber is used for prioritization, when multiple trains compete for the same track.
- Lower numbers mean higher priorities, e.g. train 0 has the highest priority.
- Priorities can't be changed dynamiclydynamically.
- Each train has one home-track.
- For binding purposes the variable should have the name trainNum.
...
- When attempting to reserve more than one segment (Entering entering a station, passing a junction) a separate protocol for deadlock prevention must be adhered to.
- In each tick the controller must check if only partial permissions were granted.
- If partial permission was granted the train waits for one tick and releases all locks.
- In the following tick the locks are requested again.
- As a special case the controllers passing through KIO_LN_0 or KIO_LN_1 must wait an additional tick after releasing the requests.
- A sample controller can be found in the repository at /doc/deadlocks/resolve_deadlock.sct