Eirik Nygaard wrote:
Hi...

I am just wondering what the atomic_* functions in machine/atmoic.h does.
I have read the assembly code and more or less understood it, but I still
don't see the need for it. So if anyone would enlighten me that would be great.

Think about parallel threads of execution (threads or a kernel with SMP). If the thread gets interrupted in the middle of non-atomic operation (say, an int is incremented via a temporary register), then the result of the operation (the value of that integer) cannot be reliably addressed in the other thread. These functions in machine/atomic.h help you to perform certain functions uninterrupted, possibly via a single assembly instruction, hence the "atomic" prefix.


-- Lev Walkin [EMAIL PROTECTED]

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to