Linux Kernel – atomic operations – bit operations – sample code

The below sample code provides a sample implementation to the reader on different atomic operations that are available. 

The following sample code merely provides a simple illustration of a few atomic bit operations. There are more atomic bit operations and the interested reader can look at “asm/bitops.h” for the specific architecture that he/she is working on (e.g. – x86/ARM etc).

The below Makefile can be used to compile the code. 

save the above makefile as “Makefile” in the same directory as first_code.c and execute the “make” command on the terminal.

Kernel Locking mechanisms – spinlock

 

Comments

  1. Pingback: Linux Kernel – atomic operations – sample code | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *