minix/servers/pm/proto.h
Tomas Hruby b4cf88a04f Userspace scheduling
- cotributed by Bjorn Swift

- In this first phase, scheduling is moved from the kernel to the PM
  server. The next steps are to a) moving scheduling to its own server
  and b) include useful information in the "out of quantum" message,
  so that the scheduler can make use of this information.

- The kernel process table now keeps record of who is responsible for
  scheduling each process (p_scheduler). When this pointer is NULL,
  the process will be scheduled by the kernel. If such a process runs
  out of quantum, the kernel will simply renew its quantum an requeue
  it.

- When PM loads, it will take over scheduling of all running
  processes, except system processes, using sys_schedctl().
  Essentially, this only results in taking over init. As children
  inherit a scheduler from their parent, user space programs forked by
  init will inherit PM (for now) as their scheduler.

 - Once a process has been assigned a scheduler, and runs out of
   quantum, its RTS_NO_QUANTUM flag will be set and the process
   dequeued. The kernel will send a message to the scheduler, on the
   process' behalf, informing the scheduler that it has run out of
   quantum. The scheduler can take what ever action it pleases, based
   on its policy, and then reschedule the process using the
   sys_schedule() system call.

- Balance queues does not work as before. While the old in-kernel
  function used to renew the quantum of processes in the highest
  priority run queue, the user-space implementation only acts on
  processes that have been bumped down to a lower priority queue.
  This approach reacts slower to changes than the old one, but saves
  us sending a sys_schedule message for each process every time we
  balance the queues. Currently, when processes are moved up a
  priority queue, their quantum is also renewed, but this can be
  fiddled with.

- do_nice has been removed from kernel. PM answers to get- and
  setpriority calls, updates it's own nice variable as well as the
  max_run_queue. This will be refactored once scheduling is moved to a
  separate server. We will probably have PM update it's local nice
  value and then send a message to whoever is scheduling the process.

- changes to fix an issue in do_fork() where processes could run out
  of quantum but bypassing the code path that handles it correctly.
  The future plan is to remove the policy from do_fork() and implement
  it in userspace too.
2010-03-29 11:07:20 +00:00

111 lines
3.6 KiB
C

/* Function prototypes. */
struct mproc;
struct stat;
struct mem_map;
struct memory;
#include <timers.h>
/* alarm.c */
_PROTOTYPE( int do_alarm, (void) );
_PROTOTYPE( int do_itimer, (void) );
_PROTOTYPE( void set_alarm, (struct mproc *rmp, clock_t ticks) );
_PROTOTYPE( void check_vtimer, (int proc_nr, int sig) );
/* break.c */
_PROTOTYPE( int do_brk, (void) );
/* dma.c */
_PROTOTYPE( int do_adddma, (void) );
_PROTOTYPE( int do_deldma, (void) );
_PROTOTYPE( int do_getdma, (void) );
/* exec.c */
_PROTOTYPE( int do_exec, (void) );
_PROTOTYPE( int do_exec_newmem, (void) );
_PROTOTYPE( int do_execrestart, (void) );
_PROTOTYPE( void exec_restart, (struct mproc *rmp, int result) );
/* forkexit.c */
_PROTOTYPE( int do_fork, (void) );
_PROTOTYPE( int do_srv_fork, (void) );
_PROTOTYPE( int do_exit, (void) );
_PROTOTYPE( void exit_proc, (struct mproc *rmp, int exit_status,
int dump_core) );
_PROTOTYPE( void exit_restart, (struct mproc *rmp, int dump_core) );
_PROTOTYPE( int do_waitpid, (void) );
_PROTOTYPE( int wait_test, (struct mproc *rmp, struct mproc *child) );
/* getset.c */
_PROTOTYPE( int do_get, (void) );
_PROTOTYPE( int do_set, (void) );
/* main.c */
_PROTOTYPE( int main, (void) );
_PROTOTYPE( void setreply, (int proc_nr, int result) );
/* mcontext.c */
_PROTOTYPE( int do_getmcontext, (void) );
_PROTOTYPE( int do_setmcontext, (void) );
/* misc.c */
_PROTOTYPE( int do_reboot, (void) );
_PROTOTYPE( int do_procstat, (void) );
_PROTOTYPE( int do_sysuname, (void) );
_PROTOTYPE( int do_getsysinfo, (void) );
_PROTOTYPE( int do_getsysinfo_up, (void) );
_PROTOTYPE( int do_getprocnr, (void) );
_PROTOTYPE( int do_getepinfo, (void) );
_PROTOTYPE( int do_svrctl, (void) );
_PROTOTYPE( int do_getsetpriority, (void) );
/* schedule.c */
_PROTOTYPE( void do_noquantum, (void) );
_PROTOTYPE( void overtake_scheduling, (void) );
_PROTOTYPE( void balance_queues, (struct timer *tp) );
/* profile.c */
_PROTOTYPE( int do_sprofile, (void) );
_PROTOTYPE( int do_cprofile, (void) );
/* signal.c */
_PROTOTYPE( int do_kill, (void) );
_PROTOTYPE( int do_srv_kill, (void) );
_PROTOTYPE( int process_ksig, (endpoint_t proc_nr_e, int signo) );
_PROTOTYPE( int do_pause, (void) );
_PROTOTYPE( int check_sig, (pid_t proc_id, int signo, int ksig) );
_PROTOTYPE( void sig_proc, (struct mproc *rmp, int signo, int trace,
int ksig) );
_PROTOTYPE( int do_sigaction, (void) );
_PROTOTYPE( int do_sigpending, (void) );
_PROTOTYPE( int do_sigprocmask, (void) );
_PROTOTYPE( int do_sigreturn, (void) );
_PROTOTYPE( int do_sigsuspend, (void) );
_PROTOTYPE( void check_pending, (struct mproc *rmp) );
_PROTOTYPE( void restart_sigs, (struct mproc *rmp) );
_PROTOTYPE( void vm_notify_sig_wrapper, (endpoint_t ep) );
/* time.c */
_PROTOTYPE( int do_stime, (void) );
_PROTOTYPE( int do_time, (void) );
_PROTOTYPE( int do_times, (void) );
/* timers.c */
_PROTOTYPE( void pm_set_timer, (timer_t *tp, int delta,
tmr_func_t watchdog, int arg) );
_PROTOTYPE( void pm_expire_timers, (clock_t now) );
_PROTOTYPE( void pm_cancel_timer, (timer_t *tp) );
/* trace.c */
_PROTOTYPE( int do_trace, (void) );
_PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
/* utility.c */
_PROTOTYPE( pid_t get_free_pid, (void) );
_PROTOTYPE( int no_sys, (void) );
_PROTOTYPE( char *find_param, (const char *key) );
_PROTOTYPE( struct mproc *find_proc, (pid_t lpid) );
_PROTOTYPE( int pm_isokendpt, (int ep, int *proc) );
_PROTOTYPE( void tell_fs, (struct mproc *rmp, message *m_ptr) );