Age | Commit message (Collapse) | Author |
|
This change introduces per run queue balancer threads which regularly scan
remote run queues to balance threads among processors, using a variant of
the distributed weighted round-robin (DWRR) algorithm that directly uses
GR3 instead of WRR as the local scheduling algorithm. In addition, the
thread_wakeup function has been extended to dispatch threads on remote
processors too.
Note that real-time threads are not concerned by this modification.
|
|
Now that there is per-thread work accounting, work scaling can occur less
frequently. Tracking rounds allows directly reusing the work of a thread
on insertion or removal.
|
|
This change adds a new time-shared run queue for expired threads. There is now
per-thread work accounting, potential preemption when waking up threads, and
no linear reset of the run queue when starting a new round. It also prepares
the introduction of thread migration.
|
|
For now, thread_wakeup can only wake up a thread on the same processor
as the caller. This is needed to properly implement thread migration.
|
|
|
|
This is best explained by mentioning that the kernel attempts to provide a
threading API similar to POSIX threads.
|
|
This change introduces scheduling classes, including support for real-time
and time-sharing threads. The real-time class matches the requirements of
the POSIX SCHED_FIFO and SCHED_RR policies. The time-sharing class makes
use of a scheduling algorithm based on group ratio round-robin (GR3) to
provide proportional fairness.
|
|
|
|
This change removes the current thread member from the run queues, and moves
the responsibility of maintaining it to the architecture specific tcb module.
For the x86 architecture, the TCB functions use a per-CPU pointer that can
be read and set in a single instruction, making it interrupt-safe and thus
migration-safe.
|
|
|
|
There is currently no thread migration, but some modules already need
migration control calls so that they're still valid once migration is
implemented.
|
|
|
|
|
|
In practice, this merely means an idle thread now exists for each CPU,
and threads can be preempted and rescheduled on each of them. There is
currently no migration between processors.
|
|
Preemption control is implemented using a thread-local counter. The
global dummy thread structure must be replaced with per-CPU ones, which
will be used later for the idle threads.
|
|
Preemption control functions must obviously not be reordered by the
compiler.
|
|
|
|
|
|
This change adds periodic timer interrupt reporting to the thread
module, basic thread selection, and context switching. It currently
only applies to the main processor. The x86/tcb module has been
drastically simplified as a side effect.
|
|
Three new modules are added :
- kern/task: Tasks are thread groups and resource containers for their
threads.
- kern/thread: The well known scheduling unit.
- x86/tcb: The architecture specific thread control block.
The kernel currently loads a single thread context on the main processor.
|