machine/atmoic.h

William M. Grim wgrim at siue.edu
Sat Feb 14 23:29:39 PST 2004


Atomic functions often serve purposes in mutexes and SMP.  You want to 
be able to lock a mutex in one cycle (at least few enough cycles 
guaranteed to be executed before another process is scheduled).  If you 
try to lock a mutex without using atomic functions, then two processes 
might try to lock a mutex at the same time and both get stuck in a 
deadlock.  This would sorta suck.

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.
>
>
>  
>

-- 
William Michael Grim
Student, Southern Illinois University at Edwardsville
Unix Network Administrator, SIUE, Computer Science dept.
Phone: (217) 341-6552
Email: wgrim at siue.edu




More information about the freebsd-hackers mailing list