Partitioned/clustered scheduling

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Nov 22 09:23:22 UTC 2013


Hello,

here are some more functions for scheduler and task management.  In the 
scheduler configuration the user should give a name for the scheduler.  The 
question is should we use a string or a rtems_name?

==== RTEMS API Changes ====

Functions for scheduler management.

  /**
   * @brief Identifies a scheduler by its name.
   *
   * The scheduler name is determined by the scheduler configuration.
   *
   * @param[in] name The scheduler name.
   * @param[out] scheduler_id The scheduler identifier associated with the name.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_NAME Invalid scheduler name.
   */
  rtems_status_code rtems_scheduler_ident_by_name(
    const char *name,
    rtems_id *scheduler_id
  );

  /**
   * @brief Identifies a scheduler by its index.
   *
   * The scheduler index is determined by the scheduler configuration.  The
   * scheduler index set starts with zero and has a consecutive range.  The
   * schedulers are ordered according to the lowest processor index of the
   * set of processors owned by the scheduler.
   *
   * @param[in] index The scheduler index.
   * @param[out] scheduler_id The scheduler identifier associated with the
   * index.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_NAME Invalid scheduler index.
   */
  rtems_status_code rtems_scheduler_ident_by_index(
    uint32_t index,
    rtems_id *scheduler_id
  );

  /**
   * @brief Gets the set of processors owned by the scheduler.
   *
   * @param[in] scheduler_id Identifier of the scheduler.
   * @param[in] processor_set_size Size of the specified processor set buffer in
   * bytes.  This value must be positive.
   * @param[out] processor_set The processor set owned by the scheduler.  This
   * pointer must not be @c NULL.  A set bit in the processor set means that
   * this processor is owned by the scheduler and a cleared bit means the
   * opposite.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_ID Invalid scheduler identifier.
   * @retval RTEMS_INVALID_CPU_SET The processor set buffer is too small for the
   * set of processors owned by the scheduler.
   */
  rtems_status_code rtems_scheduler_get_processors(
    rtems_id task_id,
    size_t processor_set_size,
    cpu_set_t *processor_set
  );

Each thread needs a processor affinity set in the RTEMS SMP configuration.  The
rtems_task_create() function will use the processor affinity set of the
executing thread to initialize the processor affinity set of the created
task.  This enables backward compatibility for existing software.

Two new functions should be added to alter and retrieve the processor affinity
sets of tasks.

  /**
   * @brief Sets the processor affinity set of a task.
   *
   * @param[in] task_id Identifier of the task.  Use @ref RTEMS_SELF to select
   * the executing task.
   * @param[in] affinity_set_size Size of the specified affinity set buffer in
   * bytes.  This value must be positive.
   * @param[in] affinity_set The new processor affinity set for the task.  This
   * pointer must not be @c NULL.  A set bit in the affinity set means that the
   * task can execute on this processor and a cleared bit means the opposite.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_ID Invalid task identifier.
   * @retval RTEMS_INVALID_CPU_SET Invalid processor affinity set.
   */
  rtems_status_code rtems_task_set_affinity(
    rtems_id task_id,
    size_t affinity_set_size,
    const cpu_set_t *affinity_set
  );

  /**
   * @brief Gets the processor affinity set of a task.
   *
   * @param[in] task_id Identifier of the task.  Use @ref RTEMS_SELF to select
   * the executing task.
   * @param[in] affinity_set_size Size of the specified affinity set buffer in
   * bytes.  This value must be positive.
   * @param[out] affinity_set The current processor affinity set of the task.
   * This pointer must not be @c NULL.  A set bit in the affinity set means that
   * the task can execute on this processor and a cleared bit means the
   * opposite.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_ID Invalid task identifier.
   * @retval RTEMS_INVALID_CPU_SET The affinity set buffer is too small for the
   * current processor affinity set of the task.
   */
  rtems_status_code rtems_task_get_affinity(
    rtems_id task_id,
    size_t affinity_set_size,
    cpu_set_t *affinity_set
  );

Two new functions should be added to alter and retrieve the scheduler of tasks.

  /**
   * @brief Sets the scheduler of a task.
   *
   * @param[in] task_id Identifier of the task.  Use @ref RTEMS_SELF to select
   * the executing task.
   * @param[in] scheduler_id Identifier of the scheduler.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_ID Invalid task identifier.
   * @retval RTEMS_INVALID_SECOND_ID Invalid scheduler identifier.
   *
   * @see rtems_scheduler_ident_by_name() and rtems_scheduler_ident_by_index().
   */
  rtems_status_code rtems_task_set_scheduler(
    rtems_id task_id,
    rtems_id scheduler_id
  );

  /**
   * @brief Gets the scheduler of a task.
   *
   * @param[in] task_id Identifier of the task.  Use @ref RTEMS_SELF to select
   * the executing task.
   * @param[out] scheduler_id Identifier of the scheduler.
   *
   * @retval RTEMS_SUCCESSFUL Successful operation.
   * @retval RTEMS_INVALID_ID Invalid task identifier.
   */
  rtems_status_code rtems_task_get_scheduler(
    rtems_id task_id,
    rtems_id *scheduler_id
  );

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list