Re: sched_yield()

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: Mattias Kregert <matti(at)algonet(dot)se>
Cc: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>, hackers(at)postgreSQL(dot)org
Subject: Re: sched_yield()
Date: 1998-03-22 01:33:16
Message-ID: Pine.BSF.3.96.980321212742.324G-100000@thelab.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 22 Mar 1998, Mattias Kregert wrote:

> The Hermit Hacker wrote:
> >
> > What's the possibility of doing this similar to how we do some of
> > the other functions (dl_open comes immediately to mind)...make a
> > pg_sched_yield function and use that, which is built based on the various
> > platforms?
> >
> > Right now, I don't believe we have *anything* in place, so have
> > pg_sched_yield() return 0 (or an equivalent) for every platform except for
> > Linux...
>
> But sched_yield() is not Linux-specific:
> -- The sched_yield() function relinquishes the processor for the
> -- running process.
> -- IEEE Std 1003.1b-1993, 13.3.5. (POSIX real-time standard 1003.lb)
>
> Except from Linux, I can find references to sched_yield() in LynxOS,
> DECthreads thread library, AIX 4.1 and up (libc), Solaris (thread.h
> (c)1994 Sun
> Microsystems), Unix98, GNU, C EXECUTIVE(r) and PSX(tm) real time kernels
> ...
> This is just a quick search.
>
> Perhaps we should enable sched_yield() for every OS except for... well,
> what's the
> name of that OS which does not have sched_yield()... FreeBSD ;)
>
> After all, sched_yield() is five years old. Any reasonable OS should
> have it.

You missed my point...so far as I've heard, there are two ways of
doing what is being proposed...either using sched_yield() on those systems
that support it, or select() on those that don't. If you are going to
build a patch for this, it should look something like:

#ifdef HAVE_SCHED_YIELD
<insert sched_yield() code here>
#else
<insert select() code here>
#endif

Totally 'configure' configurable, and non-system dependent :)

Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy(at)hub(dot)org secondary: scrappy(at){freebsd|postgresql}.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mattias Kregert 1998-03-22 01:50:12 Re: sched_yield()
Previous Message The Hermit Hacker 1998-03-22 01:26:18 Re: [HACKERS] patch for memory overrun on Linux(i386)