RE: sharing data (can ISR be pre-empted???)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi all,
i've heard that the linux kernel is preemptive from 2.5 onwards....
so can an ISR be preempted by the kernel. as i understand an ISR doest not
have a process context, so then what can preempt it????

thanx

- /dev/mandeep


-----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of Tyler Sent: Friday, June 04, 2004 1:35 PM To: kernelnewbies@nl.linux.org Subject: Re: sharing data



1. I share a data between a kernel thread and an ISR. ( this is a uniprocessor system). In kernel thread I do spin_lock_irqsave

and then unlocking. Where as accessing the data from the ISR I do not use any spin lock coz I know when the ISR is running the kernel thread does not get a chance to run. Am I right ???

It is only true if you are not in a SMP environment (and think of those
who have multiprocessors) and also if you are not in a preemptive
envirnoment (Linux kernel is preemptive since 2.5). So you should
protect your data in the ISR too.

2. I want to implement a message quque send and recv routine between two kernel threads. ( here I can not use the standard message quques)


What I do is in recv call I check if there is any message in the queue. If no then I sleep on a wait queue.

While sending a message I always add the message to the queue and and use wake up call on wait queue.

Is my implementation leak proff?..or there are some flaws???


Yes it looks good :)





-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/

_________________________________________________________________
The new MSN toolbar! As convenient as it gets! http://toolbar.msn.co.in/ Click here to download now!



-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux