Synchronization
is a mechanism which is used to avoid two or more kernel threads entering a
critical path at a same time. Ace kernel has two methods – spinlocks and atomic
operations.
Wiki:
An atomic operation in computer science refers to a set of operations that can be combined so
that they appear to the rest of the system to be a single operation with only
two possible outcomes: success or failure.
Atomic
operation on an integer is much useful on kernel because it avoid locks. By
using atomic operations locks can be avoided at the same time there won’t be
race conditions also.
Atomic
operations can be used in following situations. To decrement or increment
reference count of an object without taking lock.
spinlock.c is architecture dependent because it uses inline
assembly. (It can be rewritten completely in C using atomic operations).
It
also supports single bit locks.