summaryrefslogtreecommitdiff
path: root/kern/thread.c
AgeCommit message (Collapse)Author
2013-03-09kern/thread: add round tracking for time-sharing threadsRichard Braun
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.
2013-03-08kern/thread: minor name changeRichard Braun
2013-03-06kern/thread: fix rescheduling on time-sharing run queue changesRichard Braun
Dynamic events on time-sharing run queues shouldn't trigger a useless scheduling attempt when the current thread is a real-time one.
2013-03-06kern/thread: include <kern/printk.h>Richard Braun
2013-03-06kern/thread: call idling threads "idlers"Richard Braun
2013-03-05kern/thread: rework time-sharing schedulingRichard Braun
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.
2013-03-05kern/thread: remove thread_sched_ts_add_scale_groupRichard Braun
The existing thread_sched_ts_add_scale function is now always used for work scaling.
2013-03-03kern/thread: implement thread_sleep and thread_wakeupRichard Braun
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.
2013-03-02kern/thread: never fail when adding a thread to a run queueRichard Braun
Handling this kind of error makes threading hazardous. It's just way better to simply consider a thread can always be added to a run queue. The reason it could fail is that the time-sharing scheduling algorithm doesn't support a global weight greater than 2^32. A direct implication is that, because of this limitation, the maximum number of threads should be limited too.
2013-03-02kern/thread: minor preemption refactoringRichard Braun
2013-03-02kern/thread: fix group work scalingRichard Braun
The scaled work isn't relative to the thread weight being added or removed, it's actually the new group work.
2013-02-28kern/thread: protect run queues with a spin lockRichard Braun
Protecting run queues from concurrent access in addition to interrupts will be required for inter-processor operations such as thread migration.
2013-02-28kern/thread: detect scheduling unfairnessRichard Braun
2013-02-28kern/thread: rename thread_current to thread_selfRichard Braun
This is best explained by mentioning that the kernel attempts to provide a threading API similar to POSIX threads.
2013-01-11kern/thread: improve processor-local schedulingRichard Braun
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.
2012-12-30kern/thread: fix stack alignmentRichard Braun
2012-12-29kern/thread: handle address space on context switchRichard Braun
2012-12-29kern/thread: fix thread initializationRichard Braun
Threads must be initialized in a way that matches the expected state of a non running thread. In other words, preemption (in addition to interrupts) must be disabled. Also, set the migration counter.
2012-12-28kern/thread: make thread_current migration-safeRichard Braun
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.
2012-12-28kern/thread: handle preemption in thread_scheduleRichard Braun
2012-12-28kern/thread: minor comment changes about migrationRichard Braun
2012-12-27kern/thread: migration control functionsRichard Braun
There is currently no thread migration, but some modules already need migration control calls so that they're still valid once migration is implemented.
2012-12-24kern/thread: fix thread_idles declarationRichard Braun
Idle threads are obviously not init-only data.
2012-12-18kern/thread: remove bogus assertionRichard Braun
2012-12-14kern/thread: tidy scheduler entry functionsRichard Braun
2012-12-12kern/thread: support multiprocessor schedulingRichard Braun
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.
2012-12-11kern/thread: statically allocate idle thread structuresRichard Braun
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.
2012-12-10kern/spinlock: make spinlocks disable preemptionRichard Braun
2012-12-09kern/thread: add preemption control functionsRichard Braun
2012-12-07kern/thread: include kern/assert.hRichard Braun
2012-11-19kern/thread: preliminary scheduling implementationRichard Braun
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.
2012-11-09Implement preliminary thread contextRichard Braun
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.