Create modifiacation in semaphore

this code will fulfill all condition of semaphore