[Format recovered--see http://www.lemis.com/email/email-format.html]
On Monday, 18 September 2000 at 20:55:19 -0700, Mohan Krishna P wrote:
> hi,
It would make things a *lot* easier to read if you made your lines all
the same length. I've fixed it here.
> i am implementing a pseudo-devicer, many instaces of this device may
> be active, all have to share a resource. all instances have to
> synchronize their access to the resource. trying to implement this,
> i ended up with a less powerful version of semaphores. since the
> resultant code became little complex, i want to replace that with
> the more generic semaphores.
>
> i checked the include files, but i couldn't find any semaphore
> functions(semget,semctl,semop) which are specific or meant for use
> inside kernel. does it mean they aren't available inside kernel??
> if i am wrong, can someone suggest me how to use them??
You're probably thinking about System V user-accessible semaphores.
This particular semaphore implementation is complicated and slow, and
the implementation is flawed. You don't want them in the kernel, and
yes, they're not available at the moment, though you could probably do
it.
> does it mean they aren't available inside kernel?? if i am wrong,
> can someone suggest me how to use them??
Well, the real question is, what exactly do you want to use them for?
As John Baldwin says, we now have mutexes, though they won't show in a
-RELEASE version for quite some time. We're still discussing the
evolution of locking primitives, but at the moment it looks like we
can distinguish between semaphores and "mutexes" in the following way:
- A "mutex" (in quotes because "mutex" is also a generic term; this is
more like a simple lock) is used for short term serialization when
accessing critical data or code. Only one process can take the
mutex at a time.
- A semaphore may be held for longer periods of time. Multiple
processes (for small values of "multiple") can take the semaphore at
the same time. This means that, unlike mutexes, semaphores don't
have "owners", and the process which "releases" the semaphore may
not be the one that took it.
Which better describes your usage?
Greg
--
When replying to this message, please take care not to mutilate the
original text.
For more information, see http://www.lemis.com/email.html
Finger [EMAIL PROTECTED] for PGP public key
See complete headers for address and phone numbers
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message