home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / vms / 17760 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  2.3 KB

  1. Path: sparky!uunet!news.tek.com!ogicse!decwrl!pa.dec.com!engage.pko.dec.com!ramblr.enet.dec.com!moroney
  2. From: moroney@ramblr.enet.dec.com
  3. Newsgroups: comp.os.vms
  4. Subject: Re: sys$hiber/sys$wake problems?
  5. Message-ID: <1992Nov11.004917.10003@engage.pko.dec.com>
  6. Date: 11 Nov 92 00:28:22 GMT
  7. Article-I.D.: engage.1992Nov11.004917.10003
  8. Sender: newsdaemon@engage.pko.dec.com (USENET News Daemon)
  9. Organization: Digital Equipment Corporation
  10. Lines: 56
  11.  
  12. In article <BxIrqM.2pF@unx.sas.com>, sasjzs@falcon.unx.sas.com (Joseph Slater) writes...
  13. >   And all others that responded via e-mail. You are correct, 
  14. >however we aren't the ones calling sys$wake. After leaving
  15. >sys$hiber the next-to-last time, the bit pcb$v_wakepen bit is
  16. >clear. The next time we start to enter sys$hiber it is set and
  17. >we don't call sys$wake anywhere in between. (This is what 
  18. >upsets us as we hope to set up things before calling sys$wake, 
  19. >and when we don't we exit from hiber in an unknown state).
  20.  
  21. Your code should be robust enough to deal with random wakes, as there
  22. may or may not be system code or other ASTs or timers that do $WAKES.
  23. Unlike event flags, there is only one "thing" so everyone must share.
  24.  
  25. > I
  26. >suspect (thanks Matt) the PPL$ runtime library as this scheme 
  27. >has worked successfully for many years and PPL is the only new 
  28. >variable in the scheme.
  29.  
  30. Probably right.
  31.  
  32. > My next task is to try to trap calls 
  33. >to sys$wake from the main and sharable images.
  34.  
  35. You should recode your WAKE code as follows:
  36.  
  37. AST routine:
  38.  
  39. insert request in a queue
  40. SYS$WAKE(0,0)
  41.  
  42.  
  43. mainline code:
  44.  
  45. initialize request queue (empty)
  46. exit_loop = false;
  47. do {
  48.   try to remove request from request queue;
  49.   if queue was empty {
  50.     SYS$HIBER();
  51.   } else {
  52.     process work item;
  53.   }
  54. } while not(exit_loop);
  55.  
  56. If you follow this logic, first random wakes for no reason don't bother the
  57. process, it just checks and sees there's no work to do and goes back to sleep.
  58. It also handles the case of the AST firing like a machine gun, there can be
  59. many items at once, without an extra HIBER that can cause things to get out
  60. of sync.
  61.  
  62. With this type of code, the PPL$ routines (or whoever) can $WAKE all it
  63. wants, all that happens is an extra trip through the loop.
  64. I even wrote code to throw random $WAKEs at processes using this type of
  65. code, just to be sure it was robust.
  66.  
  67. -Mike
  68.