The bitwise operation of the Linux kernel driver atomic_t is good in integer arithmetic. However, it cannot work well when you need to perform an atomic operation on a single bit. Therefore, the kernel provides a set of functions to modify or test a single bit atomically. Because the entire operation occurs in a single step, no interruption (or other processors) can interfere. Www.2cto.com atomic bit operations are very fast, because they use a single machine command for operations, and at any time the Low-layer platform does not need to prohibit interruption. The function is system dependent and declared in. They are atomic, even on SMP computers, and are useful for cross-processor consistency. Unfortunately, data in these functions is also dependent on the system. The nr parameter (indicating which bit to operate) is often defined as int, but in several systems it is unsigned long. the address to be modified is often an unsigned long pointer, but several systems use void * instead. Various bit operations are: void set_bit (nr, void * addr); set the nr bit in the data item pointed to by addr. Void clear_bit (nr, void * addr); clears the unsigned long data located at the addr. Its semantics is opposite to that of set_bit. Void change_bit (nr, void * addr); flip this bit. Test_bit (nr, void * addr); this function is the only bit operation that does not need to be atomic; it simply returns the current value of this bit. Int test_and_set_bit (nr, void * addr); int test_and_clear_bit (nr, void * addr); int test_and_change_bit (nr, void * addr); the atomic action is as listed above, besides, they also return the previous values of this bit.