Re: semaphore locks

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

 



On 03:34 Mon 07 Apr     , Nikhil Talpallikar wrote:

...

> Is atomicity lost?

Yes, it is.

> will the global variable 'a' be decremented?

Yes, it will.

> Is the consistency lost?
> What happens if someone does not follow the standard protocol as in the
> example above?

He creates a racing condition. This means that there is a chance that you get
unexpected results. When the code is not executed very often this chance is
quite small. The result are weird, non reproduceable bugs. Do not do this. The
maintenance will be a nightmare!

Besides, you con do an atomic increment/decrement, too.
	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.homelinux.net


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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