home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / aix / 11492 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  2.5 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!ut-emx!ibmchs!auschs!awdprime.austin.ibm.com!chukran.austin.ibm.com!rudy
  2. From: rudy@chukran.austin.ibm.com
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: swap instruction in assembler?
  5. Keywords: n
  6. Message-ID: <1992Nov11.173552.1501@awdprime.austin.ibm.com>
  7. Date: 11 Nov 92 17:35:52 GMT
  8. References: <471@bertha.HyperDesk.com> <1992Nov6.165216.652@awdprime.austin.ibm.com>
  9. Sender: news@awdprime.austin.ibm.com (USENET News)
  10. Reply-To: chukran@austin.vnet.ibm.com(Rudy Chukran)
  11. Organization: IBM Advanced Workstation Division
  12. Lines: 33
  13.  
  14. In article <1992Nov6.165216.652@awdprime.austin.ibm.com>, ransom@perelandra.austin.ibm.com (Jeff Peek) writes:
  15. |> The hardware doesn't have a test-and-set instruction available. However,
  16. |> the operating system has implemented in AIX 3.2 a fast SVC called cs().
  17. |> The prototype is int cs(int *, int, int). This does cause a "trap" to the
  18. |> OS, but this code is fast pathed through the system call handler and is
  19. |> coded in a few assembler instruction that will atomically do the operation.
  20. |> As long as the address passed is not misaligned, there should be no problem.
  21. cs has been there since AIX 3.1, if anybody cares. However, to put in a "plug"
  22. for an interface new in AIX 3.2:
  23.  
  24. If you need a light weight semaphore, Id suggest also looking into the
  25. msem_lock binary semaphore interface.  It uses cs to set the lock word
  26. in shared memory. It will block if the word is already locked.
  27. Measurements show that msem_lock is 30 times faster than semop when the
  28. semaphore isnt already locked (uncontended case).
  29.  
  30. Otherwise, the process which contends the lock must do something. If it
  31. it should do some useful processing, then do it. If it must sleep, then
  32. Id recommend using the msem_lock. It is the most efficient on AIX for
  33. multiple waiters.
  34.  
  35. Im just trying to get the word out about a little known interface that
  36. is new to AIX 3.2 that solves a very specific problem with fast
  37. process syncronization.  The set of interfaces to look up are
  38. msem_init, msem_lock, msem_unlock.
  39. -- 
  40. *********************************************************************
  41. Rudy Chukran                |       EMAIL:            
  42. IBM AIX Technical Consulting| RSCS: CHUKRAN at AUSTIN 
  43. 11400 Burnet Rd.            | AWDnet:rudy@chukran.austin.ibm.com    
  44. Internal ZIP 2830           | internet: chukran@austin.vnet.ibm.com
  45. Austin, Texas 78758         |
  46. *********************************************************************
  47.