- sys_schedule can change only selected values, -1 means that the current value should be kept unchanged. For instance we mostly want to change the scheduling quantum and priority but we want to keep the process at the current cpu - RS can hand off its processes to scheduler - service can read the destination cpu from system.conf - RS can pass the information farther
29 lines
838 B
C
29 lines
838 B
C
#include "kernel/system.h"
|
|
#include <minix/endpoint.h>
|
|
#include "kernel/clock.h"
|
|
|
|
/*===========================================================================*
|
|
* do_schedule *
|
|
*===========================================================================*/
|
|
PUBLIC int do_schedule(struct proc * caller, message * m_ptr)
|
|
{
|
|
struct proc *p;
|
|
int proc_nr;
|
|
int priority, quantum, cpu;
|
|
|
|
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
|
|
return EINVAL;
|
|
|
|
p = proc_addr(_ENDPOINT_P(m_ptr->SCHEDULING_ENDPOINT));
|
|
|
|
/* Only this process' scheduler can schedule it */
|
|
if (caller != p->p_scheduler)
|
|
return(EPERM);
|
|
|
|
/* Try to schedule the process. */
|
|
priority = (int) m_ptr->SCHEDULING_PRIORITY;
|
|
quantum = (int) m_ptr->SCHEDULING_QUANTUM;
|
|
cpu = (int) m_ptr->SCHEDULING_CPU;
|
|
|
|
return sched_proc(p, priority, quantum, cpu);
|
|
}
|