dedicated kthread interface and enablement of lrud auto-recycler
[lunaix-os.git] / lunaix-os / includes / lunaix / sched.h
index b20a33a709699012553ade72dcda317065ca467c..94afa72173cd800d035ff85a2e5cf615d8ad2121 100644 (file)
@@ -1,15 +1,44 @@
 #ifndef __LUNAIX_SCHEDULER_H
 #define __LUNAIX_SCHEDULER_H
 
+#include <lunaix/compiler.h>
+#include <lunaix/process.h>
+
 #define SCHED_TIME_SLICE 300
+#define MAX_THREAD_PP 1024
+
+#define PROC_TABLE_SIZE 8192
+#define MAX_PROCESS (PROC_TABLE_SIZE / sizeof(ptr_t))
+
+struct scheduler
+{
+    struct proc_info** procs;
+    struct llist_header* threads;
+    struct llist_header* proc_list;
+    struct llist_header sleepers;
 
-struct scheduler {
-    struct proc_info* _procs;
     int procs_index;
-    unsigned int ptable_len;
+    int ptable_len;
+    int ttable_len;
 };
 
-void sched_init();
-void schedule();
+void
+sched_init();
+
+void noret
+schedule();
+
+void noret
+run(struct thread* thread);
+
+void
+cleanup_detached_threads();
+
+static inline struct scheduler*
+scheduler()
+{
+    extern struct scheduler sched_ctx;
+    return &sched_ctx;
+}
 
 #endif /* __LUNAIX_SCHEDULER_H */