Use the test and increment (P and V) semaphore operations to simulate the traffic flow at the intersection of two one-way streets. The following rules should be satisfied:
· Only one car can be crossing at any given time.
· A car should be allowed to cross the intersection only if there are no cars coming from the other street.
· When cars are coming from both streets, they should take turns to prevent indefinite postponements in either street.