Re: Interruption and preemption

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

 



Nilanjan Roychowdhury wrote:

-----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Eric BEGOT Sent: Friday, April 30, 2004 8:35 PM To: kernelnewbies@nl.linux.org Subject: Interruption and preemption

Hi all,
I've some questions about the preemption of the kernel. In the Linux 2.2 and 2.4, there are a lot of spin_lock_irqsave to disable interrupt like :
spin_lock_irqsave() ;
CRITICAL SECTION
spin_lock_irqrestore() ;
In a non preemptive kernel, the critical section is executed as an atomic operation that's sure. But in a preemptive kernel, the kernel can be interrupted by a process. So the kernel has a timeslice and if the timeslice finishes in the CRITICAL section, there's a problem.



if the timeslice finishes then kernel will be notified by a timer >>>>>>>interrupt.But as the interrupts are disbled the process wont get >>>>>>>scheduled inside the CRITICAL section. What do ya say ???
Yes I agree. But if the timeslice of the kernel finishes, then the kernel can be replaced by another process. And if in the new current process, the structures in the CRITICAL SECTION are accessed to, there can be a problem no ?
If it is a completely preemptive kernel.
Of course we don't care of interrupts if interrupts are disabled :)




And this code in SMP environment doesn't work neither, does it ? It only protects the interrupts of 1 processor no ?
Just some thoughts about synchronization :)


Thx :p

Eric


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


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




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