I am implemnting a character device driver for uniprocessor system, kernel 2.4.7.
mydev_open is the implementation of open system call.
the devices are /dev/mydev1, /dev/mydev2, etc with minors starting at 0.
While a Process 1 opens mydev_open for /dev/mydev1, it will update the instance variable which is global in the driver.
Like,
instances = 0 ; mydev_open() { .... instances ++; .... } mydev_close () { ... instances --; ... }
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?
Thanks Om.
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/