First, I explain the function of these two data items:
The variable true indicates whose true it is to enter its critical section.
The flag array is used to indicate if a process is ready to enter its critical section.
I now prove this solution is correct. If this solution is correct, it should meet the following requirements:
- Mutual exclusion is preserved
- The progress requirement is satisfied
- The bounded-waiting requirement is met