Subj : Re: Consistency of a byte shared variable To : comp.programming.threads From : Joseph Seigh Date : Mon Jan 31 2005 08:21 am On 30 Jan 2005 21:47:50 -0800, theepan wrote: > Hi all, > Does a shared byte variable is consistent in its state(without any > sort of locking ), among threads? > thanks. > > Yes, simple fetch and store of bytes are atomic on probably all architectures. You might have word tearing on some architectures like early Alpha processors which could only load and store works so to update a byte required loading the word, replacing part of the word and storing it back out. This could clobber adjacent bytes if they were just modified by another processor. This is called word tearing. Bits are atomic too and have the same problem if adjacent bits are being concurrently modified. The Posix standard doesn't address this issue. You just have to know what you're doing and be careful. -- Joe Seigh .