spin_lock and scheduler confusion

Viral Mehta Viral.Mehta at lntinfotech.com
Wed Jan 5 17:23:07 EST 2011


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 ?

What if scheduler code is running on CPU core-3 and sees that
timeslice for task running on CPU core-2 has expired ?

I guess timeslice expire case is not as same as preemption. Or may be I am terribly wrong.

Please help,
Thanks,
Viral


________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"

______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110106/2de907f8/attachment-0001.html 


More information about the Kernelnewbies mailing list