Mutual Exclusion

Here are Uppaal models of the mutual exclusion algorithms discussed in Appendix A of William Stallings, Operating Systems: Internals and Design Principles, Seventh Edition, Pearson Education Limited 2012:

Test and set

Here is a model of the use of the compare and swap instruction for mutual exclusion, as described by Stallings on pages 230-231: