Device manager

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pepito

Device manager

Post by pepito »

Hello:

I understand that MUTEX is abbreviation of 'mutual exclusion', a technique used to guarantee that never two process access to a 'shared object' at the same time.

Some devices are used concurrently (by many process at the same time) and then a 'semaphore' object is needed to control the access to those devices.

My quiestion is:

This 'semaphore' must be placed into the 'device driver', or at kernel level?

I know it could be as I want, but where it is normally placed?

Thank you very much!

pepito
ezanahka

RE:Device manager

Post by ezanahka »

Personally I would put the mutex wrap as close as possible to the critical section because what would be the point of protecting code and data that does not need protection from concurrent access. So I would first determine where and what the critical section is and then wrap it with a mutex... where you have a critical section depends totally upon your architecture. You have a critical section everywhere you have shared data that must not be accessed more than two threads/processes at the same time (this issue is nonetheless a little more complicated because you could allow more than one reader access the shared object at the same time). There might be much of those both in the driver and in the kernel.

I don't know if there is a normal place for it. I suspect that it is highly system architecture dependant.

- Esa
pepito

RE:Device manager

Post by pepito »

Thank you very much your soon response...

I believe you are right, I´ll place the semaphores into the device drivers.

pepito
Post Reply