Re: spin_lock and scheduler confusion

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

 



Dear Viral...

On Thu, Jan 6, 2011 at 05:23, Viral Mehta <Viral.Mehta@xxxxxxxxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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