Mercurial > lcfOS
view kernel/src/process.c3 @ 369:5333318ee33d
Python 3.2 compatible issues
author | Windel Bouwman |
---|---|
date | Fri, 21 Mar 2014 11:54:50 +0100 |
parents | b4ac28efcdf4 |
children | 2ec730e45ea1 |
line wrap: on
line source
module process; import memory; import kernel; // process type definition: type struct { int id; int status; } process_t; // Or, use this list structure: // List<process_t> procs; // init is the root of all processes: var process_t* init_pid; var int next_pid; function void init() { next_pid = 0; init_pid = Create(); } /* Create a new process. */ function process_t* Create() { var process_t* p; //= memory.Alloc(sizeof(process_t)); p->id = next_pid; next_pid = next_pid + 1; return p; } function void Kill(process_t* p) { // clean memory } function process_t* byId(int id) { // Perform lookup return 0; }