Mercurial > lcfOS
comparison kernel/src/process.c3 @ 359:b4ac28efcdf4
Reorganize files
author | Windel Bouwman |
---|---|
date | Fri, 14 Mar 2014 15:41:55 +0100 |
parents | kernel/process.c3@b145f8e6050b |
children | 2ec730e45ea1 |
comparison
equal
deleted
inserted
replaced
358:5ef1cb1bb54f | 359:b4ac28efcdf4 |
---|---|
1 module process; | |
2 | |
3 import memory; | |
4 import kernel; | |
5 | |
6 // process type definition: | |
7 type struct { | |
8 int id; | |
9 int status; | |
10 } process_t; | |
11 | |
12 // Or, use this list structure: | |
13 // List<process_t> procs; | |
14 | |
15 // init is the root of all processes: | |
16 var process_t* init_pid; | |
17 var int next_pid; | |
18 | |
19 function void init() | |
20 { | |
21 next_pid = 0; | |
22 init_pid = Create(); | |
23 } | |
24 | |
25 /* | |
26 Create a new process. | |
27 */ | |
28 function process_t* Create() | |
29 { | |
30 var process_t* p; | |
31 //= memory.Alloc(sizeof(process_t)); | |
32 p->id = next_pid; | |
33 next_pid = next_pid + 1; | |
34 return p; | |
35 } | |
36 | |
37 | |
38 function void Kill(process_t* p) | |
39 { | |
40 // clean memory | |
41 } | |
42 | |
43 function process_t* byId(int id) | |
44 { | |
45 // Perform lookup | |
46 return 0; | |
47 } | |
48 |