* Omanakuttan (omanakuttan@tataelxsi.co.in) wrote: > > My doubt is that, in a uniprocessor system, shall I protect instances > variable with a semaphore? I know that the kernel paths are non > preemptible. Does it mean that unless the driver calls a schedule(), the > kernel paths executions will not be interleaved? 2.4.7 doesn't sound like something that has preempt ;-) But, yes you should protect this counter for proper coding. If it were code that could happen in interrupt context it would need protection even on UP. Anyway, if all you have is a counter, make it atomic_t and use atomic_inc/atomic_dec. If you have anymore critical code to protect, a spin_lock would make more sense. Take a look at the kernel-locking doc in Documentation/DocBook for more detailed info. thanks, -chris -- Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/