cs system call on RS/6000

cs system call on RS/6000

Post by Tim Atchis » Sat, 08 Dec 1990 03:36:59

I am looking for a test-and-set instruction (or something like it) on the
IBM RS/6000. I know that the assembly code is proprietary, but I found a
compare-and-set (cs) system call that looks like it does the same thing.
Unfortunately, I can't find this command in my doc set. Could someone show
me how to use this call ?

The only information that I have is:

int cs (int *dest, int compare, int value)

It has the following logic:

if (compare == *dest) {*dest = value; return(0);}
else return(1);

Timothy M. Atchison                     UUCP: mit-eddie!progress!tma

5 Oak Park
Bedford, MA  01730


cs system call on RS/6000

Post by m.. » Tue, 11 Dec 1990 22:33:37

"cs" follows the "compare and swap" strategy used in the IBM S/370.
It is described in the on line documentation, which includes an
example.  The call is:

cs(int *dest, int comp, int value);

and the idea is that it will store value in destination only if
destination's old value was comp.  This is of course done atomically.
cs returns 0 if it succeeds, 1 if the old value of destination did not
match comp.

For examle, to set a simple spin lock in

int lock

where the lock is 0 when free and 1 when held:

while (cs(&lock,0,1));

compare and swap can also be used to do many linked list manipulations
directly without ever setting a lock at all.

Marc Auslander


1. RS/6000 error msgs (Was: Re: RS/6000 survey - will post summary)

[LANG=En_US]  ksh: kjj: 0403-016 Cannot find or open the file.
[LANG=C]      ksh: kjj: cannot open

[LANG=En_US]  0506-764 ln: /tmp: Cannot use this command with a directory.
[LANG=C]      ln : </tmp> directory

 Canonicalizing all the error msgs by assigning them numbers and more
verbose explanations isn't such a bad idea, but it will hardly make
the system usable by secretaries. It does nothing to prevent an
accidental "rm *" or hide the details of the filesystem from the user.
Secretaries will run Motif and shrink-wrapped applications in
which case they will probably never [want to] use Unix shells. And they
shouldn't need to.
 The big gain here will be made by IBM SEs who will now be able to
look up customers' complaints by the error number.

    I haven't heard about IBM shipping *anything* on a Powerstation
yet. You can buy SunOS 4.1 *today* which is B2 certified.
And AT&T is advertising System V/MLS which is B1
certified -- I don't know if it's shipping yet.
    If security is important to you, you sure don't want to go with
a measly C2 rated system.


Jason Martin Levitt    P.O. Box 49860  Austin, Texas 78765  (512) 459-0055

UUCP    : cs.utexas.edu!hackbox!jason |  the American spirit and continues to
BIX     : jlevitt                     |  show us the way to follow our dreams."
                                      |             -Ronald Reagan [1990]

2. protest: .br being banned from many #linux channels on IRC networks....

3. Fonts for InfoExplorer on RS/6000 (was: Re: Font problems on RS/6000 running X11R5)

4. 2.5.24 : fs/intermezzo/psdev.c compile error

5. FS: IBM RS/6000 Risc System/6000 SERVER POWERSTATION currently at $49.00

6. HPUX: How much is a single license?

7. Calling date and time in Fortran on RS/6000


9. What is the significance of 6000 in RS/6000?

10. Re. SPARC to RS/6k Re. SPARC to RS-6000

11. Sorry!! RS/6000 instead RS/2000 ;-)

12. RS-422 cluster controllers for RS/6000?

13. Need RS-485 interface for RS/6000