Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2004 01:29:31 -0600
From:      "William M. Grim" <wgrim@siue.edu>
To:        eirikn@kerneled.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: machine/atmoic.h
Message-ID:  <402F1FDB.8020907@siue.edu>
In-Reply-To: <20040214092308.GA15818@eirikn.net>
References:  <20040214092308.GA15818@eirikn.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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@siue.edu




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?402F1FDB.8020907>