dedicated kthread interface and enablement of lrud auto-recycler
[lunaix-os.git] / lunaix-os / includes / lunaix / sched.h
1 #ifndef __LUNAIX_SCHEDULER_H
2 #define __LUNAIX_SCHEDULER_H
3
4 #include <lunaix/compiler.h>
5 #include <lunaix/process.h>
6
7 #define SCHED_TIME_SLICE 300
8 #define MAX_THREAD_PP 1024
9
10 #define PROC_TABLE_SIZE 8192
11 #define MAX_PROCESS (PROC_TABLE_SIZE / sizeof(ptr_t))
12
13 struct scheduler
14 {
15     struct proc_info** procs;
16     struct llist_header* threads;
17     struct llist_header* proc_list;
18     struct llist_header sleepers;
19
20     int procs_index;
21     int ptable_len;
22     int ttable_len;
23 };
24
25 void
26 sched_init();
27
28 void noret
29 schedule();
30
31 void noret
32 run(struct thread* thread);
33
34 void
35 cleanup_detached_threads();
36
37 static inline struct scheduler*
38 scheduler()
39 {
40     extern struct scheduler sched_ctx;
41     return &sched_ctx;
42 }
43
44 #endif /* __LUNAIX_SCHEDULER_H */