semaphores or spinlocks ?

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

 



Well i'm writing a little driver and I don't know if i have to use semaphores or spinlocks to synchronize it. I know that spinlocks are prefered on SMP environment becoz there's no reschedule so no process switch.
I guess that if the blocking time will be long, i have to use a semaphore. But on my driver, this time depends on the user operations and can vary from seconds to minutes. Well in fact, even a second is long for a processor. But you see what i mean i'm sure :)
By reading the linux source code, i found a lot of spinlocks and few (less than spinlocks :) ) semaphores. So spinlocks are really the prefered synchronization method ?



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