process state & process queue

Linux进程状态详解
本文详细介绍了Linux系统中进程的各种状态,包括TASK_RUNNING、TASK_INTERRUPTIBLE等,并解释了这些状态的具体含义及进程如何在不同状态下进行调度。

linux process有以下几种状态:
1.TASK_RUNNING
2.TASK_INTERRUPTIBLE
3.TASK_UNINTERRUPTIBLE:这个跟上个状态的不同的地方在于处于这种状态的process是不可以被signal唤醒的
4.TASK_STOPPED
5.TASK_TRACED(当进程被debbuger停止时)
6.EXIT_ZOMBIE:当进程的父进程未进行wait()或waitpid()系统调用时
7.EXIT_DEAD

处于EXIT_STOPPED,EXIT_ZOMBIE,EXIT_DEAD的进程不处于任何队列中,而是由其父进程进行处理。
处于TASK_RUNNING状态的进程被按照优先级放于不同的队列中
处于TASK_INTERRUPTIBLE,TASK_UNINTERRUPTIBLE状态的进程按其等待的事件的不同放于不同的等待队列中。
每个等待队列中,nonexclusive进程放在队列前头,exclusive的进程放在队列的后面,所以每个事件会唤醒所有的nonexclusive进程,但是只会唤醒一个
exclusive进程。
2009/01/16 五

Please enter the number of processes? Process number No.1: Enter process name: Enter the running time of the process: Process number No.2: Enter process name: Enter the running time of the process: The execute name:a ****The currently running process is:a name state ntime rtime |a |R |5 |1 ****The current ready queue status is: name state ntime rtime |b |w |2 |0 ****The current blocking queue status is: Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… Please enter the number of processes? Process number No.1: Enter process name: Enter the running time of the process: The execute name:a ****The currently running process is:a name state ntime rtime |a |R |5 |2 ****The current ready queue status is: name state ntime rtime |b |w |2 |0 name state ntime rtime |h |w |3 |0 ****The current blocking queue status is: Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:b name state ntime rtime |b |w |2 |0 ****The current ready queue status is: name state ntime rtime |h |w |3 |0 ****The current blocking queue status is: name state ntime rtime |a |B |5 |2 The execute name:b ****The currently running process is:b name state ntime rtime |b |R |2 |1 ****The current ready queue status is: name state ntime rtime |h |w |3 |0 ****The current blocking queue status is: name state ntime rtime |a |B |5 |2 Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:h name state ntime rtime |h |w |3 |0 ****The current ready queue status is: ****The current blocking queue status is: name state ntime rtime |a |B |5 |2 name state ntime rtime |b |B |2 |1 The execute name:h ****The currently running process is:h name state ntime rtime |h |R |3 |1 ****The current ready queue status is: ****The current blocking queue status is: name state ntime rtime |a |B |5 |2 name state ntime rtime |b |B |2 |1 Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:h name state ntime rtime |h |W |3 |1 ****The current ready queue status is: name state ntime rtime |a |B |5 |2 ****The current blocking queue status is: name state ntime rtime |b |B |2 |1 The execute name:h ****The currently running process is:h name state ntime rtime |h |R |3 |2 ****The current ready queue status is: name state ntime rtime |a |B |5 |2 ****The current blocking queue status is: name state ntime rtime |b |B |2 |1 Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:h name state ntime rtime |h |W |3 |2 ****The current ready queue status is: name state ntime rtime |a |B |5 |2 name state ntime rtime |b |B |2 |1 ****The current blocking queue status is: The execute name:h ****The currently running process is:h name state ntime rtime |h |R |3 |3 ****The current ready queue status is: name state ntime rtime |a |B |5 |2 name state ntime rtime |b |B |2 |1 ****The current blocking queue status is: the process[h] completed. Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… Please enter the number of processes? Process number No.1: Enter process name: Enter the running time of the process: The execute name:a ****The currently running process is:a name state ntime rtime |a |R |5 |3 ****The current ready queue status is: name state ntime rtime |b |B |2 |1 name state ntime rtime |t |w |1 |0 ****The current blocking queue status is: Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:b name state ntime rtime |b |B |2 |1 ****The current ready queue status is: name state ntime rtime |t |w |1 |0 ****The current blocking queue status is: name state ntime rtime |a |B |5 |3 The execute name:b ****The currently running process is:b name state ntime rtime |b |R |2 |2 ****The current ready queue status is: name state ntime rtime |t |w |1 |0 ****The current blocking queue status is: name state ntime rtime |a |B |5 |3 the process[b] completed. Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… ****The currently running process is:t name state ntime rtime |t |W |1 |0 ****The current ready queue status is: name state ntime rtime |a |B |5 |3 ****The current blocking queue status is: The execute name:t ****The currently running process is:t name state ntime rtime |t |R |1 |1 ****The current ready queue status is: name state ntime rtime |a |B |5 |3 ****The current blocking queue status is: the process[t] completed. Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… The execute name:a ****The currently running process is:a name state ntime rtime |a |R |5 |4 ****The current ready queue status is: ****The current blocking queue status is: Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… The execute name:a ****The currently running process is:a name state ntime rtime |a |R |5 |5 ****The current ready queue status is: ****The current blocking queue status is: the process[a] completed. Press the i key to add a new process…The s key blocks the process…the. w key to wake up the process Press any other key to continue running… The process has been completed 这是包含输入输出的所有过程,请对应进行改编代码
10-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值