Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: sdm7g@dale.acc.Virginia.EDU (Steve D. Majewski)
Subject: VMS(4.5)-CRTL sleep() sometimes doesn't sleep
Date: 20 Jun 90 18:56:57 GMT	[thread overview]
Message-ID: <1990Jun20.185657.27108@murdoch.acc.Virginia.EDU> (raw)


   PROBLEM:
   VMS(4.5)-CRTL routine sleep() sometimes doesn't sleep !

   I have made some modifications in a major real-time data
   acquisition program we have running on a MicroVax II / VMS4.5
   written in VMS C. There are 2 "child" processes ( one spawned
   via vfork()/execl() and the other lib$spawn()-ed : it is in 
   fortran and execl() doesn't seem to pass args properly to non-C )
   and 2 DECnet processes, and several connect-to-interrupt drivers. 
   One of the changes was to make what was formerly a DECnet task
   into one of the local child processes. 

   In the main loop of the main process, it sleeps for n secs while
   data is accumulating remotely. During this sleep(), the other
   processes get their work done. 

   I tested most of the pieces seperately, but when I put them all
   together, sleep didn't sleep and I got a bunch of write errors
   from writing to a pipe/mailbox. ( I assume this is because without
   the sleep, the child never has timeslice enough to consume any of
   the data, and I've run out of I/O buffers to the mailbox. ) 

   I tried replacing the sleep() call with LIB$WAIT() ( with the 
   appropriate floating point pointer arg. ) and the same thing 
   happens. 

   On the theory that something in the code is steping on something -
   sleep works fine in other code - I stuck in several calls to 
   sleep before the main processing loop : ALL of them work fine, and
   then sleep() fails when I need it to work. 

   sleep() returns the correct value - not a neg. error return. 

   Also once sleep() fails, LIB$WAIT also fails. 

   Running "show process /cont" in another window, I never see it 
  change state to "HIB" for the sleep calls, but I do see "HIB" 
  when the LIB$WAIT is called - But not long enough, i.e. less than
  1 sec. instead of the 45 secs in the LIB$WAIT call. Of course, I 
  could just be missing the change with "show proc" .

  What could be the cause of this behavior ? 
  I know that sleep() calls SYS$SCHDWK and then SYS$HIBER.
  The only other cause of a wake up from SYS$HIBER  I can find
  documented is a SYS$WAKE call from another process. This I am
  not INTENTIONALLY doing - I can't guarantee that it is not the
  side effect of some other RTL function. 
  What about I/O completion or interrupts ? 

  Any CLues out there ? 

-------------------------------------------------------------
  - Steve Majewski
  University of Virginia Physiology Dept.   (804) 982-0831
  sdm7g@virginia.edu

 


             reply	other threads:[~1990-06-20 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-06-20 18:56 Steve D. Majewski [this message]
1990-06-21 21:39 ` VMS(4.5)-CRTL sleep() sometimes doesn't sleep Steve D. Majewski
1990-06-22  9:36   ` tp
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox