home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!swrinde!news.dell.com!uudell!bigtex!texsun!ttsi!mse
- From: mse@ttsi.lonestar.org (Mark Evans)
- Newsgroups: comp.unix.programmer
- Subject: Re: Yielding a Timeslice
- Message-ID: <1992Aug20.132824.7238@ttsi.lonestar.org>
- Date: 20 Aug 92 13:28:24 GMT
- References: <1992Aug19.184837.24219@news.weeg.uiowa.edu>
- Organization: st
- Lines: 26
-
- In article <1992Aug19.184837.24219@news.weeg.uiowa.edu> schwaigr@news.weeg.uiowa.edu (Jim Schwaiger) writes:
- >Is there a standard (or commonly accepted) way for a program to yield
- >its timeslice? I have a program which checks on a condition in shared
- >memory and would like to sleep (for less than 1 second) if that condition
- >is not met, rather than waiting in the "hot" loop.
- >
- >Jim Schwaiger
-
- I asked the same question recently. There is no universal facility
- across unices. There is a Posix-defined facility named yield()
- that some systems support. If you are running on SVR4, you might
- also look at priocntl(2). It advertises, for real-time class processes,
- the ability to "go to the back of the scheduling queue at the same
- priority by resetting its rt_pri value to its current real-time
- priority value." An associate played with this briefly and observed
- some very screwy behavior---a long 30ms average delay before returning.
- We have no idea what's going on.
-
- Also look at select() (BSD) or poll() (SVR[34]) which you can use
- to implement a higher granular sleep based upon the system tick
- frequency, which is usually 60 or 100 HZ.
- --
- Mark S. Evans Tandem Telecommunications Systems Inc.
- Phone: 214-516-6201 1255 W 15th St.
- Fax: 214-516-6805 Plano, TX 75075
- Mail: mse@ttsi.lonestar.org
-