Re: sleeping and waiting

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

 



raja wrote:
> Hi,
>    I have read in a book that some locking mechanisms put the task sleep
> till it aquires lock and some mechanisms simply busy wait.
> wht is the basic difference between sleeping and waiting?Is the both
> same?

nope.

"sleeping" implies invoking the scheduler and yielding the CPU to some
other task.
"busy waiting"/"spinning" means just that: the same task is continuously
testing the condition until it succeeds acquiring the lock.

both have advantages/disadvantages and restrictions,  therefore they are
used under (very) different circumstances. refer to a good kernel book
for details (LDD3 has already been recommended to you -
http://lwn.net/Kernel/LDD3/).


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