1、linux下的sched头文件/* * include/linux/schedh * */#ifndef _LINUX_SCHED_H#define _LINUX_SCHED_H#include /* for HZ */extern unsigned long event;#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #
2、include #include struct exec_domain;/* * cloning flags: */#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */#define CLONE_VM 0x00000100 /* set if VM shared between processes */#define CLONE_FS 0x00000200 /* set if fs info shared between processes */#define CLONE_FILES 0x00000400 /* set
3、if open files shared between processes */#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */#define CLONE_PID 0x00001000 /* set if pid shared */#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */#define CLONE_VFORK 0x0000
4、4000 /* set if the parent wants the child to wake it up on mm_release */#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */#define CLONE_THREAD 0x00010000 /* Same thread group? */#define CLONE_NEWNS 0x00020000 /* New namespace group? */#define CLONE_SIGNAL (CLO
5、NE_SIGHAND | CLONE_THREAD)/* * These are the constant used to fake the fixed-point load-average * counting. Some notes: * - 11 bit fractions expand to 22 bits by the multiplies: this gives * a load-average precision of 10 bits integer + 11 bits fractional * - if you want to count load-averages more
6、often, you need more * precision, or rounding will get you. With 2-second counting freq, * the EXP_n values would be 1981, 2034 and 2043 if still using only * 11 bit fractions. */extern unsigned long avenrun; /* Load averages */#define FSHIFT 11 /* nr of bits of precision */#define FIXED_1 (1= FSHIF
7、T;#define CT_TO_SECS(x) (x) / HZ)#define CT_TO_USECS(x) (x) % HZ) * 1000000/HZ)extern int nr_threads;extern int last_pid;extern unsigned long nr_running(void);extern unsigned long nr_uninterruptible(void);#include #include #include #include #include #include /进程状态#define TASK_RUNNING 0#define TASK_I
8、NTERRUPTIBLE 1#define TASK_UNINTERRUPTIBLE 2#define TASK_ZOMBIE 4#define TASK_STOPPED 8#define _set_task_state(tsk, state_value) do (tsk)-state = (state_value); while (0)#ifdef CONFIG_SMP#define set_task_state(tsk, state_value) set_mb(tsk)-state, (state_value)#else#define set_task_state(tsk, state_v
9、alue) _set_task_state(tsk), (state_value)#endif#define _set_current_state(state_value) do current-state = (state_value); while (0)#ifdef CONFIG_SMP#define set_current_state(state_value) set_mb(current-state, (state_value)#else#define set_current_state(state_value) _set_current_state(state_value)#end
10、if/* * Scheduling policies */#define SCHED_OTHER 0#define SCHED_FIFO 1#define SCHED_RR 2struct sched_param int sched_priority;struct completion;#ifdef _KERNEL_#include /* * This serializes schedule() and also protects * the run-queue from deletions/modifications (but * _adding_ to the beginning of t
11、he run-queue has * a separate lock). */extern rwlock_t tasklist_lock;extern spinlock_t mmlist_lock;typedef struct task_struct task_t; /将task_t定义为task_sturct的结构类型extern void sched_init(void);extern void init_idle(task_t *idle, int cpu);extern void show_state(void);extern void show_stack(unsigned long
12、 * esp);extern void cpu_init (void);extern void trap_init(void);extern void update_process_times(int user);extern void update_one_process(task_t *p, unsigned long user, unsigned long system, int cpu);extern void scheduler_tick(int user_tick, int system);extern void migration_init(void);extern unsign
13、ed long cache_decay_ticks;extern int set_user(uid_t new_ruid, int dumpclear);#define MAX_SCHEDULE_TIMEOUT LONG_MAXextern signed long FASTCALL(schedule_timeout(signed long timeout);asmlinkage void schedule(void);extern int schedule_task(struct tq_struct *task);extern void flush_scheduled_tasks(void);extern i
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1