Finding issues in concurrent implementation of carpark overflow control
For the first task think about what might happen, if the loop in Overflow is not run for each car.

For the second task, look at the following things:


How is the opening and closing of bars linked to arriving cars?
Does the overflow bar really open at the $100-\max$-th car?
The specification requests a specific order of opening and closing the bars. Is this enforced?


In the third task you should address the problems identified in the first two tasks by adding semaphores and possibly additional variables and atomic operations to the code.

Concerning your attempt and the questions therein:


The setting as described assumes that no car leaves the car park.
You may assume that eventually 100 cars will have arrived. (Otherwise you could not ensure termination.)
You should mostly keep the operations m1-m4 and o1-o3 (depending on your approach you might change one or two of them). Just add additional code around and inbetween them, in order to address the problems.
You use $100+\max$ twice, where you probably intended to use $100-\max$.
Using max in Process Main is changing its scope, since in the original code it is a variable local to Process Overflow.
Also your code does not solve most of the problems I hinted at for task 2. (This is no surprise, given that you had not identified them, when writing the code.)