Ignore:
Timestamp:
Jun 6, 2013, 1:41:00 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
8b222be
Parents:
8f42092
git-author:
Sebastian Huber <sebastian.huber@…> (06/06/13 13:41:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/14/13 14:26:08)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    r8f42092 ra936aa49  
    11/**
    2  *  @file  rtems/score/schedulersimplesmp.h
     2 * @file
    33 *
    4  *  @brief Manipulation of Threads on a Simple-Priority-Based Ready Queue
     4 * @brief Simple SMP Scheduler API
    55 *
    6  *  This include file contains all the constants and structures associated
    7  *  with the manipulation of threads on a simple-priority-based ready queue.
    8  *  This implementation is SMP-aware and schedules across multiple cores.
    9  *
    10  *  The implementation relies heavily on the Simple Scheduler and
    11  *  only replaces a few routines from that scheduler.
     6 * @ingroup ScoreSchedulerSMP
    127 */
    138
    149/*
    1510 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
     11 *
     12 *  Copyright (c) 2013 embedded brains GmbH.
    1613 *
    1714 *  The license and distribution terms for this file may be
     
    2219#ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H
    2320#define _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H
    24 
    25 /**
    26  *  @defgroup ScoreSchedulerSMP Simple SMP Scheduler
    27  *
    28  *  @ingroup ScoreScheduler
    29  *
    30  *  The Simple SMP Scheduler attempts to faithfully implement the
    31  *  behaviour of the Deterministic Priority Scheduler while spreading
    32  *  the threads across multiple cores.  It takes into account thread
    33  *  priority, preemption, and how long a thread has been executing
    34  *  on a core as factors.  From an implementation perspective, it
    35  *  relies heavily on the Simple Priority Scheduler.
    36  */
    37 /**@{*/
    3821
    3922#ifdef __cplusplus
     
    4629
    4730/**
    48  *  Entry points for Scheduler Simple SMP
     31 * @defgroup ScoreSchedulerSMP Simple SMP Scheduler
     32 *
     33 * @ingroup ScoreScheduler
     34 *
     35 * The Simple SMP Scheduler allocates a processor for the processor count
     36 * highest priority ready threads.  The thread priority and position in the
     37 * ready chain are the only information to determine the scheduling decision.
     38 * Threads with an allocated processor are in the scheduled chain.  After
     39 * initialization the scheduled chain has exactly processor count nodes.  Each
     40 * processor has exactly one allocated thread after initialization.  All
     41 * enqueue and extract operations may exchange threads with the scheduled
     42 * chain.  One thread will be added and another will be removed.  The scheduled
     43 * and ready chain is ordered according to the thread priority order.  The
     44 * chain insert operations are O(count of ready threads), thus this scheduler
     45 * is unsuitable for most real-time applications.
     46 *
     47 * The thread preempt mode will be ignored.
     48 *
     49 * @{
     50 */
     51
     52typedef struct {
     53  Chain_Control ready;
     54  Chain_Control scheduled;
     55} Scheduler_simple_smp_Control;
     56
     57/**
     58 * @brief Entry points for the Simple SMP Scheduler.
    4959 */
    5060#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
    5161  { \
    52     _Scheduler_simple_Initialize,         /* initialize entry point */ \
    53     _Scheduler_simple_smp_Schedule,       /* schedule entry point */ \
    54     _Scheduler_simple_Yield,              /* yield entry point */ \
    55     _Scheduler_simple_smp_Block,          /* block entry point */ \
    56     _Scheduler_simple_smp_Unblock,        /* unblock entry point */ \
    57     _Scheduler_simple_Allocate,           /* allocate entry point */ \
    58     _Scheduler_simple_Free,               /* free entry point */ \
    59     _Scheduler_simple_Update,             /* update entry point */ \
    60     _Scheduler_simple_Enqueue,            /* enqueue entry point */ \
    61     _Scheduler_simple_Enqueue_first,      /* enqueue_first entry point */ \
    62     _Scheduler_simple_Extract,            /* extract entry point */ \
    63     _Scheduler_priority_Priority_compare, /* compares two priorities */ \
    64     _Scheduler_priority_Release_job,      /* new period of task */ \
    65     _Scheduler_default_Tick               /* tick entry point */ \
     62    _Scheduler_simple_smp_Initialize, \
     63    _Scheduler_simple_smp_Schedule, \
     64    _Scheduler_simple_smp_Yield, \
     65    _Scheduler_simple_smp_Extract, \
     66    _Scheduler_simple_smp_Enqueue_priority_fifo, \
     67    _Scheduler_simple_Allocate, \
     68    _Scheduler_simple_Free, \
     69    _Scheduler_simple_Update, \
     70    _Scheduler_simple_smp_Enqueue_priority_fifo, \
     71    _Scheduler_simple_smp_Enqueue_priority_lifo, \
     72    _Scheduler_simple_smp_Extract, \
     73    _Scheduler_priority_Priority_compare, \
     74    _Scheduler_priority_Release_job, \
     75    _Scheduler_default_Tick, \
     76    _Scheduler_simple_smp_Start_idle \
    6677  }
    6778
    68 /**
    69  *  @brief Allocates ready SMP threads to individual cores in an SMP system.
    70  *
    71  *  This routine allocates ready threads to individual cores in an SMP
    72  *  system.  If the allocation results in a new heir which requires
    73  *  a dispatch, then the dispatch needed flag for that core is set.
    74  */
     79void _Scheduler_simple_smp_Initialize( void );
     80
     81void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread );
     82
     83void _Scheduler_simple_smp_Enqueue_priority_lifo( Thread_Control *thread );
     84
     85void _Scheduler_simple_smp_Extract( Thread_Control *thread );
     86
     87void _Scheduler_simple_smp_Yield( Thread_Control *thread );
     88
    7589void _Scheduler_simple_smp_Schedule( void );
    7690
    77 /**
    78  *  @brief Remove SMP @a the_thread from the ready queue.
    79  *
    80  *  This routine removes @a the_thread from the scheduling decision,
    81  *  that is, removes it from the ready queue.  It performs
    82  *  any necessary scheduling operations including the selection of
    83  *  a new heir thread.
    84  *
    85  *  @param[in] the_thread is the thread that is to be blocked
    86  */
    87 void _Scheduler_simple_smp_Block(
    88   Thread_Control *the_thread
     91void _Scheduler_simple_smp_Start_idle(
     92  Thread_Control *thread,
     93  Per_CPU_Control *cpu
    8994);
    9095
    91 /**
    92  *  @brief Adds SMP @a the_thread to the ready queue and updates any
    93  *  appropriate scheduling variables, for example the heir thread.
    94  *
    95  *  This routine adds @a the_thread to the scheduling decision,
    96  *  that is, adds it to the ready queue and updates any appropriate
    97  *  scheduling variables, for example the heir thread.
    98  *
    99  *  @param[in] the_thread is the thread that is to be unblocked
    100  */
    101 void _Scheduler_simple_smp_Unblock(
    102   Thread_Control *the_thread
    103 );
     96/** @} */
    10497
    10598#ifdef __cplusplus
     
    107100#endif
    108101
    109 /**@}*/
    110 
    111102#endif
    112103/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.