⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exit-wait.c

📁 用于汇编领域的,运用于OS的MAIN函数.基于硬件基础的源代码
💻 C
字号:
// exit and wait system call#include "hos.h"void release_body(struct task_struct *p){//free the body of p   unsigned long *dir=(unsigned long *)(mloc(p->mm.pgdir[0]));   free_pgframe(mloc(dir[USER_PAGE])); // free the loaded program frame   free_pgframe(p->mm.pgdir); // free the directory table   free_pgframe(dir);  // free the directory 0 frame   printk("frame freeed: %x %x %x\n", mloc(dir[USER_PAGE]), p->mm.pgdir, dir);}void do_exit(){   printk("in do_exit\n");   remove_from_run_q(current);   release_body(current);   // wake up parent   wake_up(current->parent);   current->need_reschedule=1; // parent will kill this process later}void do_wait(){ // for now, we assume parent always wait() bef child   struct task_struct *child;   printk("in do_wait\n");   remove_from_run_q(current);   current->need_reschedule=1; // to activate schedule()    schedule(); // schedule next process   // if we are here, our child is dead. clean him   child=find_child(current);   remove_from_process_q(child);   child->pid=-1; // kill it permanently}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -