mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 14:08:21 +00:00
kernel threads
kernel threads and preemptive multitasking
This commit is contained in:
@@ -5,18 +5,29 @@
|
||||
#include <arch/regs.h>
|
||||
#include <kernel/vfs.h>
|
||||
|
||||
#define THREAD_PRIORITY_INTERRUPT 0
|
||||
#define THREAD_PRIORITY_KERNEL 1
|
||||
#define THREAD_PRIORITY_USER 2
|
||||
|
||||
#define THREAD_STATE_WAITING 0
|
||||
#define THREAD_STATE_RUNNING 1
|
||||
#define THREAD_STATE_BLOCKED 2
|
||||
|
||||
typedef unsigned long state_t;
|
||||
|
||||
struct _proc_t;
|
||||
|
||||
typedef struct _thread_t{
|
||||
struct _thread_t* next;
|
||||
struct _thread_t* prev;
|
||||
struct _proc_t* proc;
|
||||
arch_regs* regs;
|
||||
size_t state;
|
||||
state_t state;
|
||||
void* kernelstack;
|
||||
void* kernelstackbase;
|
||||
size_t stacksize;
|
||||
pid_t tid;
|
||||
int priority;
|
||||
} thread_t;
|
||||
|
||||
typedef struct _proc_t{
|
||||
@@ -26,8 +37,19 @@ typedef struct _proc_t{
|
||||
pid_t pid;
|
||||
gid_t gid;
|
||||
uid_t uid;
|
||||
thread_t** threads;
|
||||
size_t threadcount;
|
||||
dirnode_t* root;
|
||||
dirnode_t* cwd;
|
||||
} proc_t;
|
||||
|
||||
|
||||
typedef struct{
|
||||
thread_t* start;
|
||||
thread_t* end;
|
||||
int lock;
|
||||
} sched_queue;
|
||||
|
||||
void sched_init();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user