September
2004, Issue 170
Test Your
EQ
|
Answer
7Read-modify-write
operations must be protected by additional access controls
only when more than one process can write to the variable
in question. If only one process writes to a particular
variable, no additional controls are required.
In
the case of the simple queue mentioned previously, only
the sending process writes to the data array and to the
head index. Only the receiving process writes to the tail
index. No additional access controls are needed on either
index.
On
the other hand, if there were multiple sending processes,
then the head index would need a mutex. And if there were
multiple receiving processes, the tail index would need
one.
Contributor:
David Tweed