/* * sched-hints.c - example of using scheduler hints * * Robert Love * * 03 June 2002 */ #include #include /* * setup the system calls for sched_hint on i386 */ #if defined(__i386__) #define __NR_sched_hint 243 _syscall1(int, sched_hint, unsigned long, hint) #endif /* * Scheduling Hints (from include/linux/sched.h) */ #define HINT_TIME 1 /* increase remaining timeslice */ #define HINT_INTERACTIVE 2 /* interactive task: prio bonus */ #define HINT_BATCH 4 /* batch task: prio penalty */ int main(int argc, char * argv[]) { /* * FIXME: OK this is really lame. What we should do here is * something to test or at least demonstrate the benefits of * the hints. Right now this is virtually worthless as any- * thing except a simple example. How do we prove it works? */ if (sched_hint(HINT_TIME)) perror("sched_hint"); if (sched_hint(HINT_INTERACTIVE)) perror("sched_hint"); if (sched_hint(HINT_BATCH)) perror("sched_hint"); return 0; }