Fork me on GitHub

root/include/fiwix/sched.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/sched.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_SCHED_H
   9 #define _FIWIX_SCHED_H
  10 
  11 #include <fiwix/process.h>
  12 
  13 #define PRIO_PROCESS    0
  14 #define PRIO_PGRP       1
  15 #define PRIO_USER       2
  16 
  17 #define PROC_RUNNING    1
  18 #define PROC_SLEEPING   2
  19 #define PROC_ZOMBIE     3
  20 #define PROC_STOPPED    4
  21 #define PROC_IDLE       5
  22 
  23 #define PROC_INTERRUPTIBLE      1
  24 #define PROC_UNINTERRUPTIBLE    2
  25 
  26 #define DEF_PRIORITY    (20 * HZ / 100) /* 200ms of time slice */
  27 
  28 extern int need_resched;
  29 
  30 #define SI_LOAD_SHIFT   16
  31 
  32 /*
  33  * This was brougth from Linux 2.0.30 (sched.h).
  34  * Copyright Linus Torvalds et al.
  35  */
  36 extern unsigned int avenrun[3];         /* Load averages */
  37 #define FSHIFT          11              /* nr of bits of precision */
  38 #define FIXED_1         (1<<FSHIFT)     /* 1.0 as fixed-point */
  39 #define LOAD_FREQ       (5*HZ)          /* 5 sec intervals */
  40 #define EXP_1           1884            /* 1/exp(5sec/1min) as fixed-point */
  41 #define EXP_5           2014            /* 1/exp(5sec/5min) */
  42 #define EXP_15          2037            /* 1/exp(5sec/15min) */
  43 
  44 #define CALC_LOAD(load,exp,n) \
  45         load *= exp; \
  46         load += n*(FIXED_1-exp); \
  47         load >>= FSHIFT;
  48 /* ------------------------------------------------------------------------ */
  49 
  50 
  51 void do_sched(void);
  52 void set_tss(struct proc *);
  53 void sched_init(void);
  54 
  55 #endif /* _FIWIX_SCHED_H */

/* [previous][next][first][last][top][bottom][index][help] */