retagged by
498 views

2 Answers

Best answer
2 votes
2 votes
TSL during it's execution locks the memory bus.

Here, process P0 enter_region() sets the lock to 1 untill it's C.S. execution is performed completely and leave_region() sets back it to 0.

When another process tries to access the C.S., remember the lock value is 1. So it goes to busy waiting, untill the lock is free.

So there is no deadlock. Deadlock occurs when both processes are not able to execute. But clearly process P0 is being executed.
selected by
0 votes
0 votes
well, deadlock is completely different from spin lock...
deadlock happens when multiple process in block state and depends on one another
where as spin lock happens when one process in ready state and other in running state..
suppose process p1 entered into critical section(cs).. suddenly a process with higher priority has come into action p1 will be pre empted then cpu schedules p2 but the thing is that p1 doesnt leave cs until it gets execute.. p2 doesnt leave cpu until it gets execute... spinlock

Related questions