Small doubt in importance of Scheduler_Context for uniprocessor schedulers

Richi Dubey richidubey at gmail.com
Sat Jun 13 17:40:51 UTC 2020


Hi,

I was going through the deterministic scheduler for uniprocessor and
noticed in the code:
------------------------------------------------------------------------------------------------
 "cpukit/include/rtems/score/schedulerpriority.h" :

typedef struct {
  /**
   * @brief Basic scheduler context.
   */
  Scheduler_Context Base;

  /**
   * @brief Bit map to indicate non-empty ready queues.
   */
  Priority_bit_map_Control Bit_map;

  /**
   * @brief One ready queue per priority level.
   */
  Chain_Control Ready[ 0 ];
} Scheduler_priority_Context;
-----------------------------------------------------------------------------------

Where Scheduler_Context is defined as:

-----------------------------------------------------------------------------

>From "cpukit/include/rtems/score/scheduler.h":

typedef struct Scheduler_Context {
  /**
   * @brief Lock to protect this scheduler instance.
   */
  ISR_LOCK_MEMBER( Lock )

#if defined(RTEMS_SMP)
  /**
   * @brief The set of processors owned by this scheduler instance.
   */
  Processor_mask Processors;
#endif
} Scheduler_Context;

-------------------------------------------------------------------------------------------------

and ISR_LOCK is defined as:

------------------------------------------------------------------------------------------------------

"cpukit/include/rtems/score/isrlock.h"

/**
 * @brief Defines an ISR lock member.
 *
 * Do not add a ';' after this macro.
 *
 * @param _designator The designator for the interrupt lock.
 */
#if defined( RTEMS_SMP )
  #define ISR_LOCK_MEMBER( _designator ) ISR_lock_Control _designator;
#else
  #define ISR_LOCK_MEMBER( _designator )
#endif
"cpukit/include/rtems/score/isrlock.h"
--------------------------------------------------------------------------------------------
Since we left the preprocessor directive as empty for the else case, it
means that for a non smp system, we don't use the ISR_LOCK as well as the
processor mask.

Then could someone please help me understand why we would include
Scheduler_Context Base in the Scheduler_priority_Context since this
scheduler is for a uniprocessor system and Scheduler_Context has nothing?

Thanks,
Richi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200613/35e1baa3/attachment.html>


More information about the devel mailing list