[PATCH 2/5] score: Introduce scheduler nodes

Gedare Bloom gedare at rtems.org
Tue May 13 14:53:42 UTC 2014


On Tue, May 13, 2014 at 10:18 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> 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.
> ---
[...]
> +/**
> + * @brief SMP scheduler node states.
> + */
> +typedef enum {
> +  /**
> +   * @brief This scheduler node is blocked.
> +   *
> +   * A scheduler node is blocked if the corresponding thread is not ready.
> +   */
> +  SCHEDULER_SMP_BLOCKED,
> +
I think SCHEDULER_SMP_NODE_BLOCKED is better, and similar for the
SCHEDULED, READY, and IS_IN_THE_AIR states.

[...]
> diff --git a/cpukit/score/src/schedulersmpvalidstatechanges.c b/cpukit/score/src/schedulersmpvalidstatechanges.c
> new file mode 100644
> index 0000000..d5c43ef
> --- /dev/null
> +++ b/cpukit/score/src/schedulersmpvalidstatechanges.c
> @@ -0,0 +1,35 @@
> +/**
> + * @file
> + *
> + * @ingroup ScoreSchedulerSMP
> + *
> + * @brief SMP Scheduler Implementation
> + */
> +
> +/*
> + * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  <rtems at embedded-brains.de>
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#if HAVE_CONFIG_H
> +  #include "config.h"
> +#endif
> +
> +#include <rtems/score/schedulerpriorityimpl.h>
> +
> +const bool _Scheduler_SMP_Node_valid_state_changes[ 4 ][ 4 ] = {
> +  /*                 BLOCKED SCHEDULED READY  IN THE AIR */
> +  /* BLOCKED    */ { false,  true,     true,  false },
> +  /* SCHEDULED  */ { false,  false,    true,  true },
> +  /* READY      */ { true,   true,     false, false },
> +  /* IN THE AIR */ { true,   true,     true,  false }
> +};
Add a note here or in the header file where it is externed how to use
this valid_state_changes, or even just @see to the function that
validates. Not clear just from looking what the transition matrix
encodes.

-Gedare



More information about the devel mailing list