0 votes 0 votes A: B: while true do while true do { { wait(p); wait(p); wait(q); wait(q); x=x+1; y=y+1; y=y-1; x=x-1; signal(p); signal (q); signal(q); signal(p); } } Two processes A and B, Is bounded guaranteed , if yes then how ? Jibran asked Sep 15, 2018 Jibran 430 views answer comment Share Follow See all 9 Comments See all 9 9 Comments reply Shaik Masthan commented Sep 15, 2018 reply Follow Share their entry sections are equal.... and note that those are semaphore ( semaphores have QUEUE ) ∴ Bounded Waiting Satisfied. 0 votes 0 votes srestha commented Sep 15, 2018 reply Follow Share what is initial values of P and Q? 0 votes 0 votes Shaik Masthan commented Sep 15, 2018 reply Follow Share i hope those are Binary semaphores, if initial values of P and Q assign 1) 0 and 0 2) 0 and 1 3) 1 and 0 4) 1 and 1 in these 4 cases, by taking only 4th case we can conclude is BW satisfied or not? remaining cases we can't answer about BW. 0 votes 0 votes Jibran commented Sep 15, 2018 reply Follow Share Both are initialized to 1 0 votes 0 votes Jibran commented Sep 15, 2018 reply Follow Share suppose process A is running and it executed wait(p) and got preempted then came process B, it executed wait(p) and got blocked then A came again executed wait(q) entered into critical section then executed signal(p) which will wake up the process B and then A will execute signal(q) and gets completed. After its completion what if process A comes again and again which will starve process B thus no bounded waiting guaranteed. Am I right or do I have some sort of confusion? 0 votes 0 votes Shaik Masthan commented Sep 15, 2018 reply Follow Share executed signal(p) which will wake up the process B and then A will execute signal(q) and gets completed. After its completion what if process A comes again and again after wakeup of B, B strucked at wait(q), after A will execute signal(q), then immediately B enter into CS. A is completed come and struck at wait(p). until B execute signal(p), A will wait there only. 0 votes 0 votes Jibran commented Sep 15, 2018 reply Follow Share Is it necessary that after A will hit signal(p) and B wakes up, he will execute wait(p) and will make p=1 so that A again cant enter? 0 votes 0 votes Shaik Masthan commented Sep 15, 2018 reply Follow Share Is it necessary that after A will hit signal(p) and B wakes up yes. when A hit signal(p), it means if any blocked process in the queue of semaphore p , then should be take one of them in FIFO(by default) order. 0 votes 0 votes Jibran commented Sep 15, 2018 reply Follow Share Got your point shaik masthan thankyou 0 votes 0 votes Please log in or register to add a comment.