update lab1-8 codes and docs. now version is 0.2

This commit is contained in:
chyyuu
2012-08-26 18:04:26 +08:00
parent 15f7ebf37b
commit d537948e30
134 changed files with 1268 additions and 1005 deletions

View File

@@ -103,6 +103,12 @@ alloc_proc(void) {
* uint32_t flags; // Process flag
* char name[PROC_NAME_LEN + 1]; // Process name
*/
//LAB5 YOUR CODE : (update LAB4 steps)
/*
* below fields(add in LAB5) in proc_struct need to be initialized
* uint32_t wait_state; // waiting state
* struct proc_struct *cptr, *yptr, *optr; // relations between processes
*/
}
return proc;
}
@@ -389,6 +395,15 @@ do_fork(uint32_t clone_flags, uintptr_t stack, struct trapframe *tf) {
// 5. insert proc_struct into hash_list && proc_list
// 6. call wakup_proc to make the new child process RUNNABLE
// 7. set ret vaule using child proc's pid
//LAB5 YOUR CODE : (update LAB4 steps)
/* Some Functions
* set_links: set the relation links of process. ALSO SEE: remove_links: lean the relation links of process
* -------------------
* update step 1: set child proc's parent to current process, make sure current process's wait_state is 0
* update step 5: insert proc_struct into hash_list && proc_list, set the relation links of process
*/
fork_out:
return ret;
@@ -771,7 +786,7 @@ user_main(void *arg) {
static int
init_main(void *arg) {
size_t nr_free_pages_store = nr_free_pages();
size_t slab_allocated_store = kallocated();
size_t kernel_allocated_store = kallocated();
int pid = kernel_thread(user_main, NULL, 0);
if (pid <= 0) {
@@ -788,7 +803,7 @@ init_main(void *arg) {
assert(list_next(&proc_list) == &(initproc->list_link));
assert(list_prev(&proc_list) == &(initproc->list_link));
assert(nr_free_pages_store == nr_free_pages());
assert(slab_allocated_store == kallocated());
assert(kernel_allocated_store == kallocated());
cprintf("init check memory pass.\n");
return 0;
}