Thanks for your reply, it clears my doubt of keeping two locks, one for read and one for write. As this info can be stored in one element only, we dont need two. > You're right, but in fact, the implementation has been so that both > information are encoded inside a single integer. You don't really need > two counters, but : > - a counter of readers why we need to keep a count of readers, does that matter ? > - a bit indicating whether a writer owns the lock or not > So, in fact, one bit of the integer is reserved to "mark" the rwlock as > owned by a writer or not. Have a look at include/asm-i386/rwlock.h, and > particularly the definition of RW_LOCK_BIAS. Can you let me know whats the significance of this flag, is this flag used to mark the writer and other bits used for keeping a count of reades. > > Have a look at the implementation of __build_read_lock_const() and > __build_write_lock_const() is the same file. cud not understand this assembly code, where is the helper function defined, it is calling ? > Sincerly, > > Thomas > -- > Thomas Petazzoni > thomas.petazzoni@xxxxxxxx > -- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/