1

What is the maximum amount of time CPU can be in critical section after acquiring Spin lock in Linux kernel?

red0ct
  • 4,840
  • 3
  • 17
  • 44
Rahul Ravi
  • 819
  • 7
  • 5
  • 1
    It could be as much as you want until you do `spin_unlock()`. It could even be a dead-lock if you do it the ugly way. Another matter is "how to implement spin-locking properly" – red0ct Apr 06 '21 at 12:23
  • Until it affects other code. – stark Apr 06 '21 at 13:34
  • Will it also not depend on the time slice of that thread as well? AFAIK each process/thread has a time slice till it executes on a CPU. However, if it again gets its time slice, it might still be in critical section. So, I think, the processor can execute other tasks, but the thread acquiring spinlock can be in waiting state forever. Correct me if I am wrong. – Kamal Pandey Jun 10 '22 at 01:35

0 Answers0