sys/sched.h: Reasonable value of SCHED_BATCH ?

Christian Franke Christian.Franke@t-online.de
Mon Dec 9 14:11:33 GMT 2024


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



More information about the Newlib mailing list