Subject: Re: SMP API (why not use standards?)
To: Gordon W. Ross <email@example.com>
From: Stefan Grefen <Stefan.Grefen@tantau.com>
Date: 07/29/1999 08:57:09
"Gordon W. Ross" wrote:
> Why invent a new API for the mutex locks?
> Using mutex_t, mutex_lock(), mutex_unlock(), mutex_trylock, etc.
> in the kernel seems easier to document, at least...
> (and otherwise apparently has identical semantics)
As already noted, there is a *BSD standard for this. Also there is
no standard for MP-semantics in the kernel. I yet have to find
2 UNIX systems with the same (ok at least one lesser known SYS5R4
variant shares it with UNIXWARE).
There is no standard ... and never will be if you ask me.
The only thing from R4 we could use is the ATOMIC stuff.
E.g.. define a data-type atomic (int/long) and define the
basic services on it (and, or , add , sub, incr, decr, bitfield).
Machines that have atomic instructions (like the i386) can with
nearly no overhead do basic instructions on those.
Other machines have to create a lock for this.
Keeping counters and statistics coherent is much easier this way.
The implementation must be done carefully to not hurt those
machines, which don't have the instructions.