summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/schedulersimplesmp.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-06 15:41:00 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-14 16:26:08 +0200
commita936aa49b5171915aee6c7cecc0b84a3912fd692 (patch)
treeec2c8adb89b3659a583e2c208c69dba3d4558073 /cpukit/score/include/rtems/score/schedulersimplesmp.h
parentscheduler: Simplify simple scheduler (diff)
downloadrtems-a936aa49b5171915aee6c7cecc0b84a3912fd692.tar.bz2
scheduler: New simple SMP scheduler implementation
The new Simple SMP Scheduler allocates a processor for the processor count highest priority ready threads. The thread priority and position in the ready chain are the only information to determine the scheduling decision. Threads with an allocated processor are in the scheduled chain. After initialization the scheduled chain has exactly processor count nodes. Each processor has exactly one allocated thread after initialization. All enqueue and extract operations may exchange threads with the scheduled chain. One thread will be added and another will be removed. The scheduled and ready chain is ordered according to the thread priority order. The chain insert operations are O(count of ready threads), thus this scheduler is unsuitable for most real-time applications. The thread preempt mode will be ignored.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulersimplesmp.h')
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h133
1 files changed, 62 insertions, 71 deletions
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index baac7b221d..1c7e125479 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -1,19 +1,16 @@
/**
- * @file rtems/score/schedulersimplesmp.h
+ * @file
*
- * @brief Manipulation of Threads on a Simple-Priority-Based Ready Queue
+ * @brief Simple SMP Scheduler API
*
- * This include file contains all the constants and structures associated
- * with the manipulation of threads on a simple-priority-based ready queue.
- * This implementation is SMP-aware and schedules across multiple cores.
- *
- * The implementation relies heavily on the Simple Scheduler and
- * only replaces a few routines from that scheduler.
+ * @ingroup ScoreSchedulerSMP
*/
/*
* Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
*
+ * Copyright (c) 2013 embedded brains GmbH.
+ *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
@@ -22,20 +19,6 @@
#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H
#define _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H
-/**
- * @defgroup ScoreSchedulerSMP Simple SMP Scheduler
- *
- * @ingroup ScoreScheduler
- *
- * The Simple SMP Scheduler attempts to faithfully implement the
- * behaviour of the Deterministic Priority Scheduler while spreading
- * the threads across multiple cores. It takes into account thread
- * priority, preemption, and how long a thread has been executing
- * on a core as factors. From an implementation perspective, it
- * relies heavily on the Simple Priority Scheduler.
- */
-/**@{*/
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -45,68 +28,76 @@ extern "C" {
#include <rtems/score/schedulerpriority.h>
/**
- * Entry points for Scheduler Simple SMP
+ * @defgroup ScoreSchedulerSMP Simple SMP Scheduler
+ *
+ * @ingroup ScoreScheduler
+ *
+ * The Simple SMP Scheduler allocates a processor for the processor count
+ * highest priority ready threads. The thread priority and position in the
+ * ready chain are the only information to determine the scheduling decision.
+ * Threads with an allocated processor are in the scheduled chain. After
+ * initialization the scheduled chain has exactly processor count nodes. Each
+ * processor has exactly one allocated thread after initialization. All
+ * enqueue and extract operations may exchange threads with the scheduled
+ * chain. One thread will be added and another will be removed. The scheduled
+ * and ready chain is ordered according to the thread priority order. The
+ * chain insert operations are O(count of ready threads), thus this scheduler
+ * is unsuitable for most real-time applications.
+ *
+ * The thread preempt mode will be ignored.
+ *
+ * @{
+ */
+
+typedef struct {
+ Chain_Control ready;
+ Chain_Control scheduled;
+} Scheduler_simple_smp_Control;
+
+/**
+ * @brief Entry points for the Simple SMP Scheduler.
*/
#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
{ \
- _Scheduler_simple_Initialize, /* initialize entry point */ \
- _Scheduler_simple_smp_Schedule, /* schedule entry point */ \
- _Scheduler_simple_Yield, /* yield entry point */ \
- _Scheduler_simple_smp_Block, /* block entry point */ \
- _Scheduler_simple_smp_Unblock, /* unblock entry point */ \
- _Scheduler_simple_Allocate, /* allocate entry point */ \
- _Scheduler_simple_Free, /* free entry point */ \
- _Scheduler_simple_Update, /* update entry point */ \
- _Scheduler_simple_Enqueue, /* enqueue entry point */ \
- _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_simple_Extract, /* extract entry point */ \
- _Scheduler_priority_Priority_compare, /* compares two priorities */ \
- _Scheduler_priority_Release_job, /* new period of task */ \
- _Scheduler_default_Tick /* tick entry point */ \
+ _Scheduler_simple_smp_Initialize, \
+ _Scheduler_simple_smp_Schedule, \
+ _Scheduler_simple_smp_Yield, \
+ _Scheduler_simple_smp_Extract, \
+ _Scheduler_simple_smp_Enqueue_priority_fifo, \
+ _Scheduler_simple_Allocate, \
+ _Scheduler_simple_Free, \
+ _Scheduler_simple_Update, \
+ _Scheduler_simple_smp_Enqueue_priority_fifo, \
+ _Scheduler_simple_smp_Enqueue_priority_lifo, \
+ _Scheduler_simple_smp_Extract, \
+ _Scheduler_priority_Priority_compare, \
+ _Scheduler_priority_Release_job, \
+ _Scheduler_default_Tick, \
+ _Scheduler_simple_smp_Start_idle \
}
-/**
- * @brief Allocates ready SMP threads to individual cores in an SMP system.
- *
- * This routine allocates ready threads to individual cores in an SMP
- * system. If the allocation results in a new heir which requires
- * a dispatch, then the dispatch needed flag for that core is set.
- */
+void _Scheduler_simple_smp_Initialize( void );
+
+void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread );
+
+void _Scheduler_simple_smp_Enqueue_priority_lifo( Thread_Control *thread );
+
+void _Scheduler_simple_smp_Extract( Thread_Control *thread );
+
+void _Scheduler_simple_smp_Yield( Thread_Control *thread );
+
void _Scheduler_simple_smp_Schedule( void );
-/**
- * @brief Remove SMP @a the_thread from the ready queue.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * that is, removes it from the ready queue. It performs
- * any necessary scheduling operations including the selection of
- * a new heir thread.
- *
- * @param[in] the_thread is the thread that is to be blocked
- */
-void _Scheduler_simple_smp_Block(
- Thread_Control *the_thread
+void _Scheduler_simple_smp_Start_idle(
+ Thread_Control *thread,
+ Per_CPU_Control *cpu
);
-/**
- * @brief Adds SMP @a the_thread to the ready queue and updates any
- * appropriate scheduling variables, for example the heir thread.
- *
- * This routine adds @a the_thread to the scheduling decision,
- * that is, adds it to the ready queue and updates any appropriate
- * scheduling variables, for example the heir thread.
- *
- * @param[in] the_thread is the thread that is to be unblocked
- */
-void _Scheduler_simple_smp_Unblock(
- Thread_Control *the_thread
-);
+/** @} */
#ifdef __cplusplus
}
#endif
-/**@}*/
-
#endif
/* end of include file */