semaphore locks

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

 



hi,
The protocol used for protecting global data is using a semphore,.
the standard protocol says:
//
assuming 'a' is a global variable

down(&my_sem);

a++;

up(&my_sem);

//

now if in other thread i do not follow the protocol of acquiring a lock before access to the global variable and simply write
//
//no lock acquired here

a--;

//no lock released here
//

Is atomicity lost?
will the global variable 'a' be decremented?
Is the consistency lost?
What happens if someone does not follow the standard protocol as in the example above?

cheers,
Nikhil


[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