[LIP] Question about Linux kernel

Rakesh Avichal Ughreja <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Samsung India Software Operation
Message-ID <[email protected]>
Is Linux kernel pre-emptive ?

I have a question about Linux kernel. I am writing a char driver, in which I
have implemented my own queues for reader and writer. I don't know if such
queues are already available in Linux.

Whenever my driver receives interrupt from device, it gets the packet from
devices memory and enqueues into the Rx queue.

In the device_read call, i want to dequeue packet from this queue and want
to send it to user using copy_to_user.

How do I take care of mutual exclusion here ? One obvious thing is whenever
ISR is getting executed I am sure its an atomic operation and my reader
process will not get chance to run, but I don't know what will happen if an
interrupt comes while reader is dequeueing the packet from the queue.

How can I make enqueue and dequeue functions atomic ?

Thanks in advance.

Regards,
Rakesh

-----------------------------------------------------------
"Behind every successful woman, is a man who is surprised."



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.