home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!ucbvax!lrw.com!leichter
- From: leichter@lrw.com (Jerry Leichter)
- Newsgroups: comp.os.vms
- Subject: re: Re: sys$hiber/sys$wake problems?
- Message-ID: <9211151450.AA29180@uu3.psi.com>
- Date: 15 Nov 92 13:27:26 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 55
-
-
- |> If one or more wakeup requests are issued for the process while
- |> it is not hibernating, the next hibernate call returns
- |> immediately; that is, the process does not hibernate. ...
- |>
- |>This is, in fact, the correct behavior for a semaphore. If it
- |>doesn't work this way, your process could block indefinately.
- |>
- Hi Rob,
-
- And all others that responded via e-mail. You are correct, however we
- aren't the ones calling sys$wake. After leaving sys$hiber the
- next-to-last time, the bit pcb$v_wakepen bit is clear. The next time
- we start to enter sys$hiber it is set and we don't call sys$wake
- anywhere in between. (This is what upsets us as we hope to set up
- things before calling sys$wake, and when we don't we exit from hiber
- in an unknown state). I suspect (thanks Matt) the PPL$ runtime library
- as this scheme has worked successfully for many years and PPL is the
- only new variable in the scheme. My next task is to try to trap calls
- to sys$wake from the main and sharable images. Any ideas on doing
- this? I may have a hard time convicing our system manager to let me
- patch the system service vectors. Read that as slim to none.
-
- "Free wakes" are part of the design of the SYS$WAKE/SYS$HIBER mechanism.
- Since there is only one "wake pending" bit per process, not one per access
- level, there are tons of ways for the bit to get set. If it was set at the
- rundown of the last image in the process, it is probably STILL set - rundown
- can't clear it, since it's not a user-mode (or any other mode) object. If
- you've done any SPAWN's or ATTACH's in the process, DCL itself may have done
- hibernates and wakes.
-
- Learn to live with it; that's just the way it is. (There are good REASONS for
- it being that way.) The ONLY way to use $HIBER/$WAKE reliably is in code that
- looks like the following:
-
- sleep:
- while (not condition)
- SYS$HIBER()
-
- wakeup:
- make condition true;
- SYS$WAKE(target)
-
- Period. End of discussion. If you don't like it, don't use VMS.
-
- Trapping calls to SYS$WAKE, patching system service vectors - all a load of
- nonsense. If you don't like the way VMS's system services work, design
- another operating system; don't start mucking with VMS a bit at a time.
-
- (Sorry to make such assertive statements, but writing reliable synchronized
- code is HARD. VMS has given you a mechanism that works. You're kidding
- yourself if you think it's trivial to do better.)
-
- -- Jerry
-
-