Reputation: 1363
For this situation: Process B will wait Process A release spin,so preemt OK ???
Process A:
-->spin lock --> do strict call --> before unlock time int
Time int ISR:
--> Process A time slice finished --> need schedule
-->ISR ret --> schedule to Process B
Process B:
-->spin lock for same resource --> failed --> spin wait
Upvotes: 0
Views: 113
Reputation: 65878
In the situation you provided Process B will busy wait until its slice ends and rescheduling to Process A occures. So, whole time slice would be a wasting of the time.
Things may be worse if switching from Process B to Process A is never occures. E.g., if priority of the Process B is more than one of the Process A. In that case it is deadlock.
Disabling preemption in spin_lock
protects from both wasting of time and deadlock described above.
Upvotes: 2