RE: spinlock on uniprocessor systems

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

 



Dear Fawad,

What I can understand from the following description given by you is:

The spinlock if implemented on a Uniprocessor non-preemptable kernel
will lead to kernel crash.
REASON:
The second process will be in busy loop not allowing the Scheduler to
schedule the task. It will hang. 

My questions:
scheduler_tick() is a called at regular system routine that the kernel
periodically calls and marks processes as needing rescheduling. This
call occurs in the timer interrupt context. 

Now, Lets say that the second process (B) called the spinlock_lock() and
is waiting for the first process (A) to unlock. In the mean time, it is
sure that scheduler_tick()will be invoked in timer interrupt context.
This should take care of the rescheduling the task with this new Process
B. Then where is the case of system getting hanged completely.

Pleas help me get more clarity on this.

Thanks & Regards,
Mukund Jampala

> Spinlock is a busy-wait lock means that a task will spin at the
> spinlock (keep processor busy) until it won't able to acquire it. So
> on SMP machine one processor can spin on spinlock and the other one
> can release the lock after doing stuff with-in lock and unlock ! Now
> if the system is uniprocessor and no preemption is enabled tries to
> acquire the lock (which is already acquired by some other process, but
> the process must schedule itself after acquiring lock to make this
> happen as uniprocessor system without preemption won't allow other
> process to execute at the same time) then it will spin on the lock and
> won't allow the CPU to give time to the other process which is
> supposed to release the lock !



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