comparison kernel/process.c3 @ 283:c9781c73e7e2

Added first kernel files
author Windel Bouwman
date Fri, 15 Nov 2013 12:26:50 +0100
parents
children 534b94b40aa8
comparison
equal deleted inserted replaced
282:c137f1fe3e65 283:c9781c73e7e2
1 module process;
2 import memory;
3 import kernel;
4
5 // process type definition:
6 typedef struct {
7 int id;
8 } process_t;
9
10 // init is the root of all processes:
11 var process_t* init = 0;
12 var int next_pid = 0;
13
14 public func void Init()
15 {
16 next_pid = 0;
17 init = Create();
18 }
19
20 /*
21 Create a new process.
22 */
23 public func process_t* Create()
24 {
25 process_t* p = memory.Alloc(sizeof(process_t));
26 p->id = next_pid;
27 next_pid++;
28 return p;
29 }
30
31
32 public func void Kill(process_t* p)
33 {
34 // clean memory
35 }
36
37