Spinlock versus Semaphore

后端 未结 11 687
广开言路
广开言路 2020-11-28 17:19

What are the basic differences between a semaphore & spin-lock?

When would we use a semaphore over a spin-lock?

11条回答
  •  时光取名叫无心
    2020-11-28 17:40

    spin lock can be held by only one process while semaphore can be held by one or more processes. Spin lock wait until the process releases a lock and then acquires a lock. Semaphore is sleeping lock i.e waits and goes to sleep.

提交回复
热议问题