Mercurial > lcfOS
diff kernel/process.c3 @ 283:c9781c73e7e2
Added first kernel files
author | Windel Bouwman |
---|---|
date | Fri, 15 Nov 2013 12:26:50 +0100 |
parents | |
children | 534b94b40aa8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/process.c3 Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,37 @@ +module process; +import memory; +import kernel; + +// process type definition: +typedef struct { + int id; +} process_t; + +// init is the root of all processes: +var process_t* init = 0; +var int next_pid = 0; + +public func void Init() +{ + next_pid = 0; + init = Create(); +} + +/* + Create a new process. +*/ +public func process_t* Create() +{ + process_t* p = memory.Alloc(sizeof(process_t)); + p->id = next_pid; + next_pid++; + return p; +} + + +public func void Kill(process_t* p) +{ + // clean memory +} + +