调度程序当前使用循环来安排。 我可以访问每个进程的用户时间和系统时间。
用户时间
rdy_head [USER_Q] - GT; user_time
系统时间头
rdy_head [USER_Q] - GT; user_time
我需要支持IO绑定进程,但cpu绑定进程不能完全饿死。
有什么想法吗?
/*===========================================================================*
* sched *
*===========================================================================*/
PRIVATE void sched()
{
/* The current process has run too long. If another low priority (user)
* process is runnable, put the current process on the end of the user queue,
* possibly promoting another user to head of the queue.
*/
if (rdy_head[USER_Q] == NIL_PROC) return;
/* One or more user processes queued. */
rdy_tail[USER_Q]->p_nextready = rdy_head[USER_Q];
rdy_tail[USER_Q] = rdy_head[USER_Q];
rdy_head[USER_Q] = rdy_head[USER_Q]->p_nextready;
rdy_tail[USER_Q]->p_nextready = NIL_PROC;
pick_proc();
}