option A) deadlock p1 : line1|p2:line3| p1: line2(block) |p2 :line4(block)
so here p1 want s(x) which is held by p2 and p2 want s(y) which is held by p1 ...
so its circular wait (hold and wait condition) .. so there is deadlock
option B) deadlock p1 : line 1| p2 line 3|p1: line 2(block) |p2 : line 4(block)
so here p1 wants sy which is held by p2 and p2 wants sx which is held by p1...so its circular wait (hold and wait ) so deadlock
option c) p1 :line 1|p2 :line 3| p2 line 4(block) |p1 line 2 (block) here p1 wants sx and p2 wants sy .. but both will not be release by its process p1 and p2 because there is no way to release them ...so stuck in deadlock ..
option d) p1 :line 1 |p2 : line 3(block because need sx ) |p1 line 2 |p2 : still block |p1 : execute cs then up the value of sx |p2 :line 3 line 4(block need sy)| p1 up the sy |p2 :lin4 4 and easily get cs ..
we can start from p2 also ... as I answered according only p1 ... but we get same answer ....
so option D) is correct