summaryrefslogtreecommitdiff
path: root/kern/thread.c
AgeCommit message (Collapse)Author
2016-12-09Force brackets around one-line conditional statementsRichard Braun
This change was done using astyle, with a few manual editing here and there.
2014-12-10kern/thread: update call to kmem_cache_initRichard Braun
2014-10-02kern/thread: fix thread-specific data handlingRichard Braun
2014-09-20kern/sref: new moduleRichard Braun
This module provides multiprocessor scalable reference counters, based on Refcache, as described in the RadixVM paper.
2014-09-16kern/task: make task_info report thread statesRichard Braun
2014-09-09kern/task: make task_info report scheduling propertiesRichard Braun
2014-09-05kern/thread: use percpu variablesRichard Braun
2014-06-19kern/thread: fix assertion in thread_joinRichard Braun
Detached threads are actually joined by the reaper thread, and the thread_join function would make sure it was only called on joinable threads. Fix this inconsistency.
2014-06-19kern/thread: add assertion in thread_joinRichard Braun
Make sure thread_join operates on joinable threads.
2014-06-18kern/thread: add thread_joinRichard Braun
This change affects more files than it apparently would at first glance. This is because circular dependencies can easily be created between the thread, mutex, condition and spinlock modules. As a result, some of the types of these modules are now defined in kern/types.h.
2014-06-18kern/thread: support thread_sleep without interlockRichard Braun
The thread_sleep function takes a spin lock as a parameter. This lock is used as an interlock allowing either the thread waking up or the thread being awaken to run. But when threads don't need a lock to provide that guarantee, the interlock is only overhead. This change makes thread_sleep assume disabling preemption is used as a synchronization mechanism when the interlock is NULL.
2014-06-17kern/work: per-processor work poolsRichard Braun
2014-06-10kern/thread: append _intr to event counter namesRichard Braun
2014-06-10kern/llsync: rework lockless synchronizationRichard Braun
Use a global checkpoint identifier as a generation counter and remove reset interrupts. For some reason I can't remember, using reset interrupts was thought to be more efficient, perhaps because accessing a global variable on each checkpoint looked expensive. But it's really not scalable, and a read-mostly global variable can get cached locally and not incur expensive access. In addition, add a decent amount of documentation about the semantics with regard to the rest of the system. Explicitely state that checkpoints are triggered by context switches and that it's not allowed to block inside read-side critical sections. Make periodic events attempt to trigger checkpoints too. Add a thread-local read-side critical section nesting counter so that it can be reliably determined whether the processor is running a read-side critical section or not.
2014-05-13kern/thread: slightly improve tick countingRichard Braun
Move the increment outside of the run queue critical section.
2014-05-13kern/thread: rename thread_tick to thread_tick_intrRichard Braun
2014-05-13kern/thread: count scheduling interruptsRichard Braun
2014-05-12kern/thread: track tick eventsRichard Braun
2014-05-08kern/thread: change the policy of balancer threadsRichard Braun
There doesn't seem to be a need for round-robin scheduling, use the simpler FIFO policy.
2014-05-06x86/tcb: make tcb_init initialize thread-local dataRichard Braun
For now, there is no thread-local data to actually initialize, but the interface is there to allow it. The main goal of this change is to avoid the need of complex startup synchronization by allocating thread-local data at thread creation time.
2014-05-04kern/thread: fix thread_destroyRichard Braun
2014-05-04kern/thread: minor change on TSD destructionRichard Braun
Adopt a POSIX-like behaviour.
2014-05-02kern/thread: initialized booter threads TSDRichard Braun
2014-04-30kern/thread: actually call TSD destructorsRichard Braun
2014-04-27kern/thread: implement thread-specific dataRichard Braun
2014-04-26kern/thread: add thread creation attributes accessorsRichard Braun
2014-04-26kern/thread: fix creation of balancer threadsRichard Braun
2014-01-14Rework bootstrappingRichard Braun
Start application processors once the kernel is completely initialized, right before starting the scheduler. This simplifies the procedure with regard to inter-processor pmap updates.
2014-01-03kern/thread: increase the number of real-time prioritiesRichard Braun
2014-01-03kern/thread: slightly improve run queue packingRichard Braun
2014-01-02Declare variables as read mostly where appropriateRichard Braun
2013-07-01x86/pmap: improve TLB invalidationRichard Braun
Add a processor bitmap per physical map to determine processors on which a pmap is loaded, so that only those processors receive update IPIs. In addition, implement lazy TLB invalidation by not loading page tables when switching to a kernel thread. To finish with, the thread module now calls pmap_load unconditionally without making assumptions about pmap optimizations.
2013-06-04x86/{cpu,tcb}: move scheduling interrupts handlingRichard Braun
Move scheduling interrupt functions from the tcb module to the cpu module. In addition, rename the related trap and functions to avoid mentioning "rescheduling", as it just makes descriptions more confusing. Instead, include the name of the module that makes use of this interrupt.
2013-06-03kern/thread: fix thread creationRichard Braun
2013-06-01kern/thread: update creation attributes handlingRichard Braun
Make passing attributes and passing a thread name mandatory.
2013-06-01kern/thread: slightly rework scheduler invocationRichard Braun
Rename THREAD_RESCHEDULE to THREAD_YIELD and thread_reschedule to thread_yield for better clarity, and add the thread_schedule inline function that checks for the THREAD_YIELD flag before calling thread_yield (yielding only checks if preemption is enabled).
2013-06-01kern/thread: minor naming changeRichard Braun
Refer to scheduling class data instead of context.
2013-05-25kern/thread: make more extensive use of cpumapsRichard Braun
2013-05-19kern/thread: implement processor affinityRichard Braun
Processor affinity can be set before a thread is created, but currently not changed afterwards.
2013-05-16kern/thread: fix wakeup with respect to pinningRichard Braun
2013-05-15kern/list: rename list_insert to list_insert_headRichard Braun
This change increases clarity.
2013-05-15x86/cpu: pass flags by address to cpu_intr_saveRichard Braun
Not a necessary change, but done for consistency.
2013-05-15kern/thread: return unsigned run queue identifiersRichard Braun
The correct type for run queue or processor identifiers is unsigned int. The signed variant was used because of the bitmap interface, but there will never be enough processors to trigger a problem with it, while using signed integers can quickly mess things up.
2013-05-15kern/thread: add comment about balancer threadsRichard Braun
Balancer threads use their own version of thread_sleep because they have to keep the run queue locked after pulling threads, otherwise remote balancers might pull threads from a run queue right before a scheduling decision is made, possibly putting the run queue in a state where only expired threads remain. Although this might be relaxed in the future, this is how it's currently done, and a clear note in the main balancer function definitely helps against breaking that part.
2013-05-15kern/thread: set the runq member for idler threadsRichard Braun
Not required nor used, but done for consistency.
2013-05-15kern/llsync: new moduleRichard Braun
This module provides lockless synchronization so that reads can safely occur during updates, without holding a lock. It is based on passive serialization as described in US patent 4809168, and achieves a goal similar to Linux RCU (Read-Copy Update).
2013-05-15kern/thread: rework idle loopRichard Braun
The upcoming lockless synchronization implementation requires the idle loop to report when it's about to enter/leave the idle state. Preemption must be disabled to accomplish that.
2013-05-13kern/thread: make thread_active_runqs privateRichard Braun
2013-05-13kern/thread: fix thread waking on remote run queueRichard Braun
2013-05-12kern/thread: update kernel thread naming rulesRichard Braun