Spinlock

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2023 Aug 23 15:42
Editor
Edited
Edited
2023 Nov 19 15:56
Refs

Spinlock (software-only)

  1. turn only ping-pong like one-to-one problem
  1. flag only symultaniously raising flag problem
  1. Peterson's algorithm use flag and turn variable
    1. repeat flag[i] := true; turn := j; while (flag[j] and turn = j) //cation to and //busy waiting = spinning critical section flag[i] := false; //else code until false;
 

spinlock (hardware atomic)

by hardware support atomic operation
atomic operation: cannot be disturbed
 
acquire()/lock(): before critical section release()/unlock(): after critical section
 
 
Lock (computer science)
In computer science, a lock or mutex (from mutual exclusion) is a synchronization primitive: a mechanism that enforces limits on access to a resource when there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy, and with a variety of possible methods there exists multiple unique implementations for different applications.
 
 

Recommendations