The scheduler currently uses round robin to schedule. I have access to the user time and system time of each process.
USER TIME OF HEAD
rdy_head[USER_Q]->user_time
SYSTEM TIME OF HEAD
rdy_head[USER_Q]->user_time
I need to favor IO bound processes, but cpu bound processes cannot be completely starved.
Any ideas?
/*===========================================================================*
* 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();
}