Re: sys/sched.h: Reasonable value of SCHED_BATCH ?

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCWOrM7rPRu4iRN+o5aOZexKTLGjGSvrOgup320r5jggRQ@mail.gmail.com>
SCHED_SPOTADIC has been in POSIX a long time but does seem to be rarely
implemented. Per change history from the POSIX standard on sched.h:

"the SCHED_SPORADIC scheduling policy is added for alignment with
IEEE Std 1003.1d-1999"

RTEMS and QNX support it but I don't recall any other OSes with
SCHED_SPORADIC.

SCHED_IDLE, SCHED_BATCH,  SCHED_DEADLINE, etc. are bespoke and not in
POSIX. Hopefully they will not be visible except where supported. It looks
like you are doing that.

Others should speak up but I think for Linux, Cygwin, *BSD, etc where
binary compatibility is required, you will need to stick with the values
used now.

--joel

On Mon, Dec 9, 2024 at 8:12 AM Christian Franke <
[email protected]> wrote:

> This is related to this thread on cygwin-patches ML:
> https://sourceware.org/pipermail/cygwin-patches/2024q4/013105.html
>
> Which would be a reasonable integer value for a newly defined SCHED_BATCH ?
>
> Current newlib/libc/include/sys/sched.h:
>
> #if defined(__CYGWIN__) // see c1bfa897
> #define SCHED_OTHER    3
> #else
> #define SCHED_OTHER    0
> #endif
>
> #define SCHED_FIFO     1
> #define SCHED_RR       2
>
> #if defined(_POSIX_SPORADIC_SERVER)// __rtems__ only ?
> #define SCHED_SPORADIC 4
> #endif
>
> #if __GNU_VISIBLE
> #define SCHED_IDLE     5 // Recent addition (61c2f075)
> #endif
>
>
> Linux:
> #define SCHED_OTHER    0
> #define SCHED_FIFO     1
> #define SCHED_RR       2
> #define SCHED_BATCH    3
> /* SCHED_ISO: reserved but not implemented yet */
> #define SCHED_IDLE     5
> #define SCHED_DEADLINE 6
> #define SCHED_EXT      7
>
> FreeBSD:
> #define SCHED_FIFO     1
> #define SCHED_OTHER    2
> #define SCHED_RR       3
>
>
> First alternative: Align non-Cygwin value with Linux
>
> #if __GNU_VISIBLE
> #if defined(__CYGWIN__)
> #define SCHED_BATCH    0
> #else
> #define SCHED_BATCH    3
> #endif
> #endif
>
> Second alternative: Use next free value
>
> #if __GNU_VISIBLE
> ...
> #define SCHED_BATCH    6
> #endif
>
> Any preferences?
>



>
> --
> Regards,
> Christian
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.