spin_lock and scheduler confusion

Mulyadi Santosa mulyadi.santosa at gmail.com
Thu Jan 6 22:56:34 EST 2011


Dear Viral...

On Thu, Jan 6, 2011 at 05:23, Viral Mehta <Viral.Mehta at lntinfotech.com> wrote:
>
> Hi ,
>
> I need your help to solve below confusion.
>
> 1. I know that spin_lock_irqsave, disables premption and local_irq.
> 2. There is some below piece of kernel code running on Quad core Machine.
>     spin_lock_irqsave(&lock, flags);
>     some_large_critical_section //sleep of 5 minutes
>     //I know there should be as small as possible task in critical section
>     // treat this as an example only
>     spin_lock_irqrestore();
> 3. One of the CPU core tries to execute this code and so acquires the lock.
> 4. Now, second core is also goes to execute same piece of code and so will
> keep spinning for lock
>
> Now, the question is
> Will EVER second CPU core get chance to execute another task ?
> Ever if timeslice is over for the current task ?


If interrupt is also disabled, then I think it's a game
over...preemption won't happen on that CPU.....i mean, not system
triggered preemption...the process must voluntarily yield itself, thus
giving others time to run.

This, assuming HPET signaling also based on interrupt...hence affected
by irq disabling...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com



More information about the Kernelnewbies mailing list