minix/lib
Tomas Hruby b09bcf6779 Scheduling server (by Bjorn Swift)
In this second phase, scheduling is moved from PM to its own
scheduler (see r6557 for phase one). In the next phase we hope to a)
include useful information in the "out of quantum" message and b)
create some simple scheduling policy that makes use of that
information.

When the system starts up, PM will iterate over its process table and
ask SCHED to take over scheduling unprivileged processes. This is
done by sending a SCHEDULING_START message to SCHED. This message
includes the processes endpoint, the parent's endpoint and its nice
level. The scheduler adds this process to its schedproc table, issues
a schedctl, and returns its own endpoint to PM - as the endpoint of
the effective scheduler. When a process terminates, a SCHEDULING_STOP
message is sent to the scheduler.

The reason for this effective endpoint is for future compatibility.
Some day, we may have a scheduler that, instead of scheduling the
process itself, forwards the SCHEDULING_START message on to another
scheduler.

PM has information on who schedules whom. As such, scheduling
messages from user-land are sent through PM. An example is when
processes change their priority, using nice(). In that case, a
getsetpriority message is sent to PM, which then sends a
SCHEDULING_SET_NICE to the process's effective scheduler.

When a process is forked through PM, it inherits its parent's
scheduler, but is spawned with an empty quantum. As before, a request
to fork a process flows through VM before returning to PM, which then
wakes up the child process. This flow has been modified slightly so
that PM notifies the scheduler of the new process, before waking up
the child process. If the scheduler fails to take over scheduling,
the child process is torn down and the fork fails with an erroneous
value.

Process priority is entirely decided upon using nice levels. PM
stores a copy of each process's nice level and when a child is
forked, its parent's nice level is sent in the SCHEDULING_START
message. How this level is mapped to a priority queue is up to the
scheduler. It should be noted that the nice level is used to
determine the max_priority and the parent could have been in a lower
priority when it was spawned. To prevent a CPU intensive process from
hawking the CPU by continuously forking children that get scheduled
in the max_priority, the scheduler should determine in which queue
the parent is currently scheduled, and schedule the child in that
same queue.

Other fixes: The USER_Q in kernel/proc.h was incorrectly defined as
NR_SCHED_QUEUES/2. That results in a "off by one" error when
converting priority->nice->priority for nice=0. This also had the
side effect that if someone were to set the MAX_USER_Q to something
else than 0, then USER_Q would be off.
2010-05-18 13:39:04 +00:00
..
ack Improve makefile logic for building programs/libs 2010-02-24 11:58:05 +00:00
csu Include directory reorg and makefile updates. 2010-03-08 11:04:59 +00:00
libbz2 Convert boot/ and commands/ over to bsdmake 2010-05-12 16:28:54 +00:00
libc This patch switches the MINIX3 ethernet driver stack from a port-based 2010-05-17 22:22:53 +00:00
libcurses Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
libdriver Use of all NIL_* defines converted to NULL 2010-05-10 13:26:00 +00:00
libedit Remove some duplicate declarations in headers. 2010-04-13 15:22:38 +00:00
libend Convert library asm files to GAS syntax 2010-03-03 14:27:30 +00:00
libl Convert boot/ and commands/ over to bsdmake 2010-05-12 16:28:54 +00:00
libm Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
libnetdriver This patch switches the MINIX3 ethernet driver stack from a port-based 2010-05-17 22:22:53 +00:00
libsys Scheduling server (by Bjorn Swift) 2010-05-18 13:39:04 +00:00
libtimers Removed unused variables, added const where possible. 2010-04-07 11:25:51 +00:00
libutil Removed unused variables, added const where possible. 2010-04-07 11:25:51 +00:00
ack_build.sh Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
gnu_build.sh Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
Makefile Convert boot/ and commands/ over to bsdmake 2010-05-12 16:28:54 +00:00
README Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00

ack_build.sh - for ACK library building
gnu_build.sh - for GNU library building

ack_build.sh obj     - create objdirs for gnu libraries
ack_build.sh depend  - find dependencies of ack libraries
ack_build.sh all     - compile ack libraries
ack_build.sh install - compile and install ack libraries
ack_build.sh clean   - clean for ack libraries

gnu_build.sh obj     - create objdirs for gnu libraries
gnu_build.sh depend  - find dependencies of gnu libraries
gnu_build.sh all     - compile gnu libraries
gnu_build.sh install - compile and install gnu libraries
gnu_build.sh clean   - clean for gnu libraries