1

调度器当前使用轮询来调度。我可以访问每个进程的用户时间和系统时间。

头部用户时间

rdy_head[USER_Q]->user_time

头部系统时间

rdy_head[USER_Q]->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();

}
4

0 回答 0