NetBSD-Users archive

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

atomic_ops vs mutex



The following is from the atomic_ops(3) man page:

Performance
Because atomic memory operations require expensive
synchronization at the hardware level, applications should take care to
minimize their use.  In certain cases, it may be more appropriate to
use a mutex, especially if more than one memory location will be
modified.

I have two questions:

1. Are all atomic_ops functions, or some of them macros?

2. In what cases would it be better to use atomic_ops, instead of
locking and unlocking mutex?


Home | Main Index | Thread Index | Old Index