summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadinitialize.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* score: Add thread scheduler lockSebastian Huber2016-11-021-0/+1
| | | | Update #2556.
* score: Simplify ISR lock nameSebastian Huber2016-09-271-4/+1
|
* score: Manage scheduler nodes via thread queuesSebastian Huber2016-09-211-0/+5
| | | | Update #2556.
* score: Add scheduler node table for each threadSebastian Huber2016-09-211-11/+60
| | | | Update #2556.
* score: Rework thread priority managementSebastian Huber2016-09-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
* score: Remove superfluous SMP debug supportSebastian Huber2016-09-071-2/+0
| | | | This information turned out to be useless in the last couple of months.
* score: Add debug support to red-black treesSebastian Huber2016-08-081-0/+1
| | | | This helps to detect double insert and extract errors.
* score: Fix and simplify thread wait locksSebastian Huber2016-08-031-1/+1
| | | | | | | | | | There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
* score: Turn thread lock into thread wait lockSebastian Huber2016-07-271-6/+4
| | | | | | | | | The _Thread_Lock_acquire() function had a potentially infinite run-time due to the lack of fairness at atomic operations level. Update #2412. Update #2556. Update #2765.
* score: Change scheduler node init and destroySebastian Huber2016-07-011-3/+6
| | | | | | Provide the scheduler node to initialize or destroy to the corresponding operations. This makes it possible to have more than one scheduler node per thread.
* score: Fix thread lock on SMP configurationsSebastian Huber2016-06-301-1/+5
|
* score: Add thread priority to scheduler nodesSebastian Huber2016-06-221-3/+1
| | | | | | | | | | | | | | | | | | The thread priority is manifest in two independent areas. One area is the user visible thread priority along with a potential thread queue. The other is the scheduler. Currently, a thread priority update via _Thread_Change_priority() first updates the user visble thread priority and the thread queue, then the scheduler is notified if necessary. The priority is passed to the scheduler via a local variable. A generation counter ensures that the scheduler discards out-of-date priorities. This use of a local variable ties the update in these two areas close together. For later enhancements and the OMIP locking protocol implementation we need more flexibility. Add a thread priority information block to Scheduler_Node and synchronize priority value updates via a sequence lock on SMP configurations. Update #2556.
* score: Simplify _Thread_Life_action_handler()Sebastian Huber2016-05-201-2/+0
| | | | | | | | Use _Thread_Change_life_locked() to avoid duplicated code. Avoid Giant lock in _Thread_Life_action_handler(). Update #2555. Update #2626.
* score: Introduce thread state lockSebastian Huber2016-05-121-0/+2
| | | | Update #2556.
* score: Delete __RTEMS_STRICT_ORDER_MUTEX__Sebastian Huber2016-05-021-5/+0
| | | | | | Remove support for strict order mutexes. Close #2124.
* score: Fix multiprocessing thread proxiesSebastian Huber2016-03-291-3/+1
| | | | | | | We must provide thread queue heads for the thread wait information for each thread proxy (thread queue heads were introduced by d7665823b208daefb6855591d808e1f3075cedcb). The thread proxy must be allocated before the enqueue operation.
* posix: Use per-thread lookup tree for POSIX KeysSebastian Huber2016-03-181-4/+3
| | | | | | Yields higher performance on SMP systems. Close #2625.
* score: Replace watchdog handler implementationSebastian Huber2016-03-041-0/+4
| | | | | | | | | Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
* score: Initialize thread control to zeroSebastian Huber2015-12-151-44/+9
| | | | This reduces the code size of the thread initialization.
* score: Untangle thread actionsSebastian Huber2015-12-111-4/+1
| | | | | | | Remove the thread action handler parameter from _Thread_Action_initialize() and instead set it later in _Thread_Add_post_switch_action(). This avoids a dependency on the thread action handler via the thread initialization.
* score: Implement SMP-specific priority queueSebastian Huber2015-09-041-2/+2
|
* score: Use a plain ticket lock for thread locksSebastian Huber2015-07-301-1/+2
| | | | | | This enables external libraries to use thread locks since they are independent of the actual RTEMS build configuration, e.g. profiling enabled or disabled.
* score: Add potpourri lock statisticsSebastian Huber2015-07-301-0/+1
| | | | | | | These SMP lock statistics are used for all lock objects that lack a storage space for the statistics. Examples are lock objects used in external libraries which are independent of the actual RTEMS build configuration.
* score: Introduce Thread_queue_HeadsSebastian Huber2015-07-231-2/+22
| | | | | | | | | | | | | Move the storage for the thread queue heads to the threads. Each thread provides a set of thread queue heads allocated from a dedicated memory pool. In case a thread blocks on a queue, then it lends its heads to the queue. In case the thread unblocks, then it takes a free set of threads from the queue. Since a thread can block on at most one queue this works. This mechanism is used in FreeBSD. The motivation for this change is to reduce the memory demands of the synchronization objects. On a 32-bit uni-processor configuration the Thread_queue_Control size is now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced the size as well).
* Remove use ticks for statistics configure option.Joel Sherrill2015-06-151-5/+1
| | | | | | | | | | This was obsolete and broken based upon recent time keeping changes. Thie build option was previously enabled by adding USE_TICKS_FOR_STATISTICS=1 to the configure command line. This propagated into the code as preprocessor conditionals using the __RTEMS_USE_TICKS_FOR_STATISTICS__ conditional.
* score: Add _Watchdog_Preinitialize()Sebastian Huber2015-06-131-1/+1
| | | | | | Add an assert to ensure that the watchdog is the proper state for a _Watchdog_Initialize(). This helps to detect invalid initializations which may lead to a corrupt watchdog chain.
* score: Add Thread_Control::is_fpSebastian Huber2015-06-091-0/+1
| | | | | | | | Store the floating-point unit property in the thread control block regardless of the CPU_HARDWARE_FP and CPU_SOFTWARE_FP settings. Make sure the floating-point unit is only enabled for the corresponding multilibs. This helps targets which have a volatile only floating point context like SPARC for example.
* score: Rework _Thread_Change_priority()Sebastian Huber2015-05-191-1/+2
| | | | | | | | | | | | | Move the writes to Thread_Control::current_priority and Thread_Control::real_priority into _Thread_Change_priority() under the protection of the thread lock. Add a filter function to _Thread_Change_priority() to enable specialized variants. Avoid race conditions during a thread priority restore with the new Thread_Control::priority_restore_hint for an important average case optimizations used by priority inheritance mutexes. Update #2273.
* score: Add Thread_queue_OperationsSebastian Huber2015-05-191-11/+2
| | | | | | | | Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
* score: Add thread lockSebastian Huber2015-03-241-0/+3
| | | | Update #2273.
* score: Add thread priority change handlerSebastian Huber2015-03-241-1/+11
| | | | | | | | | | Since the thread current priority change and thread queue requeue is performed in one critical section it is possible to simplify the thread queue requeue procedure. Add a thread queue agnostic thread priority change handler so that we are able to use alternative thread queue implementations. Update #2273.
* score: Fix _Thread_Change_priority()Sebastian Huber2015-03-201-0/+1
| | | | | | | | | | Atomically update the current priority of a thread and the wait queue. Serialize the scheduler update in a separate critical section with a generation number. New test sptests/spintrcritical23. Close #2310.
* score: Add thread wait flagsSebastian Huber2015-03-051-0/+2
| | | | Update #2273.
* score: Add capture data to tcb.Jennifer Averett2014-10-271-0/+3
|
* score: Implement scheduler helping protocolSebastian Huber2014-07-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The following scheduler operations return a thread in need for help - unblock, - change priority, and - yield. A thread in need for help is a thread that encounters a scheduler state change from scheduled to ready or a thread that cannot be scheduled in an unblock operation. Such a thread can ask threads which depend on resources owned by this thread for help. Add a new ask for help scheduler operation. This operation is used by _Scheduler_Ask_for_help() to help threads in need for help returned by the operations mentioned above. This operation is also used by _Scheduler_Thread_change_resource_root() in case the root of a resource sub-tree changes. A use case is the ownership change of a resource. In case it is not possible to schedule a thread in need for help, then the corresponding scheduler node will be placed into the set of ready scheduler nodes of the scheduler instance. Once a state change from ready to scheduled happens for this scheduler node it may be used to schedule the thread in need for help.
* score: Collect scheduler related fields in TCBSebastian Huber2014-06-231-3/+2
| | | | | Add Thread_Scheduler_control to collect scheduler related fields of the TCB.
* score: Replace _Scheduler_Allocate/Free()Sebastian Huber2014-06-041-7/+5
| | | | | | | | Replace _Scheduler_Allocate() with _Scheduler_Node_initialize(). Remove the return status and thus the node initialization must be always successful. Rename _Scheduler_Free() to _Scheduler_Node_destroy().
* score: Add resource node to thread control blockSebastian Huber2014-06-031-0/+2
|
* score: Introduce scheduler nodesSebastian Huber2014-05-141-2/+0
| | | | | | | | | | | | Rename scheduler per-thread information into scheduler nodes using Scheduler_Node as the base type. Use inheritance for specialized schedulers. Move the scheduler specific states from the thread control block into the scheduler node structure. Validate the SMP scheduler node state transitions in case RTEMS_DEBUG is defined.
* score: Fix CPU context usage on SMPSebastian Huber2014-05-081-0/+1
| | | | | | | | | | We must not alter the is executing indicator in _CPU_Context_Initialize() since this would cause an invalid state during a self restart. The is executing indicator must be valid at creation time since otherwise _Thread_Kill_zombies() uses an undefined value for not started threads. This could result in a system life lock.
* score: Implement forced thread migrationSebastian Huber2014-05-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of task migration in RTEMS has some implications with respect to the interrupt latency. It is crucial to preserve the system invariant that a task can execute on at most one processor in the system at a time. This is accomplished with a boolean indicator in the task context. The processor architecture specific low-level task context switch code will mark that a task context is no longer executing and waits that the heir context stopped execution before it restores the heir context and resumes execution of the heir task. So there is one point in time in which a processor is without a task. This is essential to avoid cyclic dependencies in case multiple tasks migrate at once. Otherwise some supervising entity is necessary to prevent life-locks. Such a global supervisor would lead to scalability problems so this approach is not used. Currently the thread dispatch is performed with interrupts disabled. So in case the heir task is currently executing on another processor then this prolongs the time of disabled interrupts since one processor has to wait for another processor to make progress. It is difficult to avoid this issue with the interrupt latency since interrupts normally store the context of the interrupted task on its stack. In case a task is marked as not executing we must not use its task stack to store such an interrupt context. We cannot use the heir stack before it stopped execution on another processor. So if we enable interrupts during this transition we have to provide an alternative task independent stack for this time frame. This issue needs further investigation.
* score: Fix TLS size usageSebastian Huber2014-05-051-6/+1
|
* score: Add clustered/partitioned schedulingSebastian Huber2014-04-151-2/+2
| | | | | | | | | | | | | | | Clustered/partitioned scheduling helps to control the worst-case latencies in the system. The goal is to reduce the amount of shared state in the system and thus prevention of lock contention. Modern multi-processor systems tend to have several layers of data and instruction caches. With clustered/partitioned scheduling it is possible to honour the cache topology of a system and thus avoid expensive cache synchronization traffic. We have clustered scheduling in case the set of processors of a system is partitioned into non-empty pairwise-disjoint subsets. These subsets are called clusters. Clusters with a cardinality of one are partitions. Each cluster is owned by exactly one scheduler instance.
* score: Simplify thread control initializationSebastian Huber2014-04-151-41/+24
| | | | | | | | | | | The thread control block contains fields that point to application configuration dependent memory areas, like the scheduler information, the API control blocks, the user extension context table, the RTEMS notepads and the Newlib re-entrancy support. Account for these areas in the configuration and avoid extra workspace allocations for these areas. This helps also to avoid heap fragementation and reduces the per thread memory due to a reduced heap allocation overhead.
* score: Delete _Thread_Ticks_per_timesliceSebastian Huber2014-04-071-1/+2
| | | | Use the Configuration instead.
* score: Delete _Thread_Maximum_extensionsSebastian Huber2014-04-071-7/+6
| | | | Use the Configuration instead.
* score: Add scheduler control to scheduler opsSebastian Huber2014-04-041-1/+1
| | | | | Scheduler operations must be free of a global scheduler context to enable partitioned/clustered scheduling.
* score: Remove affinity element from thread.Jennifer Averett2014-04-031-4/+0
|
* score: Thread life cycle re-implementationSebastian Huber2014-03-311-0/+2
| | | | | | | | | | | | | | | | | | | The thread deletion is now supported on SMP. This change fixes the following PRs: PR1814: SMP race condition between stack free and dispatch PR2035: psxcancel reveals NULL pointer access in _Thread_queue_Extract() The POSIX cleanup handler are now called in the right context (should be called in the context of the terminating thread). http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html Add a user extension the reflects a thread termination event. This is used to reclaim the Newlib reentrancy structure (may use file operations), the POSIX cleanup handlers and the POSIX key destructors.
* score: Use thread action for thread restartSebastian Huber2014-03-311-0/+5
| | | | | The thread restart is now supported on SMP. New test smptests/smpthreadlife01.