Messages in this thread | | | Date | Wed, 1 Dec 1999 01:09:33 +0100 | From | Jamie Lokier <> | Subject | Re: Shared memory not SMP safe to user-mode code. |
| |
Adam D. Bradley wrote: > On Wed, 1 Dec 1999, Jamie Lokier wrote: > > > It protects against signals handlers, interrupts and other processes. > > But on SMP, "addl" is not atomic. You have to use "lock; addl" on SMP. > > I seem to recall that you can use the "xaddl" for atomic addition without > the "lock" prefix... only on 486 and later though...
You are correct. You can also use cmpxchg in a loop. Basically, some instructions imply a lock without the lock prefix. The point is on SMP you have to use one of those, rather than a non-locked single instruction which is safe if there's only one device accessing the memory.
-- Jamie
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |