Linux Kernel Programming - atomic_t datatype - atomic variables and APIs


Given below is the summary of the above video.

1. atomic_t datatype is a faster alternative to spin-locks and mutexes in some scenarios as it's directly supported by the hardware.

2. It is guaranteed to be 32 bits irrespective of the CPU architecture i.e. even if the CPU architecture is 64 bits, atomic_t will still be 32 bits.

3. atomic64_t is a 64 bit alternative to atomic_t. atomic64_t is guaranteed to be 64 bits even on 32 bit CPUs.

4. Various supporting functions/macros are available for working with atomic_t e.g. atomic_read(), atomic_set(), ATOMIC_INIT() etc.

5. Websites like https://elixir.bootlin.com/ are good to see and learn how these data types are used/implemented in actual implementations.













Comments