I have a practice problem that I'm not sure how to solve:Use sephamores to solve the following synchronization requirement. We have 4 processes: P1, P2,P3 and P4. P1 must run before any of the other processes, P2 must run before P3 and P2 and P4 run concurrently.This is how I solved it:initialize 3 sepahmores s1,s2 and mutex;s1 ,s2 = 0;mutex = 1;Process P1 {  signal(s1) //sends the signal saying P1 is done}Process P2 {  wait(s1) //locks P2 so it doesn't process until P1 sends the signal  signal(s2)  do {    wait(mutex) //makes sure only one process at a time has access to the Crit section    //Critical Section    signal(mutex)  }  while(TRUE)}Process P3 {  wait(s2) //locks P3 so it doesn't process until P2 sends the signal}Process P4 {  wait(s1)  do {    wait(mutex) //makes sure only one process at a time has access to the Crit section    //Critical Section    signal(mutex)  } while(TRUE)}Is this the most efficient way to use sephamores for this question? If it is, does this solution satisfy the requirements (P1 before everything else, P2 before P3 and P2 and P4 run concurrently)?
Using sephamores to solve happens-before requirements
concurrency;synchronization