Re: [LIP] Question about Linux kernel

"Amod Malviya" <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Linux kernel is not pre-emptive. But you should be writing re-entrant drivers, since on SMP machines, re-entrancy would come into picture. Also, the kernel may go for a pre-emptive nature later on (maybe its there in 2.6, not sure since haven't tried it till now). Queues are already implemented in linux, with mutual exclusion features. However, you can use your own. Regarding the mutual exclusion, you can use either semaphores or spinlocks. A good documentation to start with is Rubini's Writing Linux Device Drivers ( http://http://www.xml.com/ldd/chapter/book/ )

--Amod

----- Original Message -----
From: Rakesh Avichal Ughreja <[email protected]>
Date: Mon, 31 May 2004 12:13:26 +0530
To: LIP <linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [LIP] Question about Linux kernel

> 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
> _______________________________________________
> linux-india-programmers mailing list
> linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/linux-india-programmers

-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze


-------------------------------------------------------
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.