Hi Jikos/ Jim/ Tim, Thanks for the replies. One small one, do we have the Work Queue interface in the 2.4 kernel too? If not what do we do for the case if we want to use conventional locking mechanism? Is there a performance related issue when using spinlocks(spinlock_t) instead of semaphores? Thanks, Vishwas -----Original Message----- From: Jirka Kosina [mailto:jikos@xxxxxxxx] Sent: Thursday, June 23, 2005 12:13 AM To: Vishwas Manral Cc: kernelnewbies@xxxxxxxxxxxx Subject: Re: Taking semaphores On Wed, 22 Jun 2005, Vishwas Manral wrote: > I have Googled and gone through a lot of links and as well as browsed > through the Linux code but could not figure this one out. I wanted to > know if we could take semaphores in timer routine - bottom-half context > (I guess not). What mechanism (softirq, tasklets, etc) can be used if we > want to use semaphores? Any links would be of great help. The only thing you can use to synchronize softirqs and tasklets are enabling and disabling processing the bottom halves on the current processor completely (local_bih_disable() and local_bh_enable()). However, you can use conventional locking mechanisms when you are using workqueues, as they are run in process context and therefore they can be safely rescheduled. -- JiKos. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/