[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inter Module communication
On Fri, 1 Oct 2004 00:07:24 +0530, Dhiman, Gaurav <gaurav.dhiman@xxxxxx> wrote:
> If anybody else knows some other synchronizing mechanism in kernel, then
> please do mail about that.
There are reader-writer versions of the locking primitives that you
describe below. Linux 2.6 also introduces two new locking types:
*). Completion variables - tasks often use this to sync up their actions.
*). Seq locks - simple retry locks (but as rml points out, they do
favour writers).
> Semaphore: This is a heavy synchronizing mechanism and should be used if
> our critical section is big enough ......
There's a fundamental distinction between semaphores and spinlocks you
need to note - semaphores only work in a process context as they may
sleep. With the preempt stuff on in the kernel we have to worry about
more than just SMP systems, but spinlocks will still disable
pre-emption if necessary by changing preempt_count for us.
Jon.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/