Re: Reader/writer semaphores

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

 



On Wed, Apr 02, 2008 at 11:22:17AM -0700, bhanu nani wrote:
> My understanding: Semaphore are the tools to protect a region of code
> by bloking access to other threads access while the first thead is
> accessing it.

You shouldn't protect a region of code. Semaphores (and other locking
primitives) should be used to protect *data*, not to protect *code*.
It's not bad if two threads execute the same *code* at the same time,
as long as they don't access the same *data* at the same time.


Erik

-- 
Erik Mouw -- mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[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