What is spin lock?

Ankur Kulhari

Locks are used in operating system to reserve critical section resources for mutual exclusion.
Suppose a task is running and a little time (execution time) is left for its completion, That is:

  • The running time left for it is less compared to the time that would be taken in blocking it and context switching.
  • Under this situation it is not worth to swap-out running process.
  • There is an innovative concept of spin locking in certain schedulers.
  • A spin lock is useful only in the situation described above.
  • A spin lock does not let a running task be blocked instantly, rather it first successively tries decreasing the trial periods before finally blocking a task.

What do you think about the article?

This site uses Akismet to reduce spam. Learn how your comment data is processed.