source: rtems/cpukit/score/src/threadcreateidle.c @ c5831a3f

4.115
Last change on this file since c5831a3f was c5831a3f, checked in by Sebastian Huber <sebastian.huber@…>, on 04/09/14 at 13:07:54

score: Add clustered/partitioned scheduling

Clustered/partitioned scheduling helps to control the worst-case
latencies in the system. The goal is to reduce the amount of shared
state in the system and thus prevention of lock contention. Modern
multi-processor systems tend to have several layers of data and
instruction caches. With clustered/partitioned scheduling it is
possible to honour the cache topology of a system and thus avoid
expensive cache synchronization traffic.

We have clustered scheduling in case the set of processors of a system
is partitioned into non-empty pairwise-disjoint subsets. These subsets
are called clusters. Clusters with a cardinality of one are partitions.
Each cluster is owned by exactly one scheduler instance.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[e655f7e]1/**
2 *  @file
[05df0a8]3 *
[e655f7e]4 *  @brief Create Idle Thread
5 *  @ingroup ScoreThread
6 */
7
8/*
[06dcaf0]9 *  COPYRIGHT (c) 1989-2011.
[05df0a8]10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
[dcf3687]13 *  found in the file LICENSE in this distribution or at
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[05df0a8]15 */
16
[a8eed23]17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
[5618c37a]21#include <rtems/score/threadimpl.h>
[c5831a3f]22#include <rtems/score/schedulerimpl.h>
[218286bc]23#include <rtems/score/stackimpl.h>
[976162a6]24#include <rtems/config.h>
[05df0a8]25
[477259c]26static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu )
[05df0a8]27{
[477259c]28  Objects_Name    name;
29  Thread_Control *idle;
[6c71b25]30
[477259c]31  name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
[05df0a8]32
33  /*
34   *  The entire workspace is zeroed during its initialization.  Thus, all
35   *  fields not explicitly assigned were explicitly zeroed by
36   *  _Workspace_Initialization.
37   */
[06dcaf0]38  idle = _Thread_Internal_allocate();
[05279b84]39
[05df0a8]40  _Thread_Initialize(
41    &_Thread_Internal_information,
[06dcaf0]42    idle,
[c5831a3f]43    _Scheduler_Get_by_CPU( per_cpu ),
[05df0a8]44    NULL,        /* allocate the stack */
[8a331a5e]45    _Stack_Ensure_minimum( rtems_configuration_get_idle_task_stack_size() ),
[05df0a8]46    CPU_IDLE_TASK_IS_FP,
47    PRIORITY_MAXIMUM,
[aae7f1a1]48    true,        /* preemptable */
[05df0a8]49    THREAD_CPU_BUDGET_ALGORITHM_NONE,
50    NULL,        /* no budget algorithm callout */
51    0,           /* all interrupts enabled */
[6c71b25]52    name
[05df0a8]53  );
[05279b84]54
[05df0a8]55  /*
56   *  WARNING!!! This is necessary to "kick" start the system and
57   *             MUST be done before _Thread_Start is invoked.
58   */
[e3be6915]59  per_cpu->heir      =
60  per_cpu->executing = idle;
[05279b84]61
[05df0a8]62  _Thread_Start(
[06dcaf0]63    idle,
[05df0a8]64    THREAD_START_NUMERIC,
[3954767]65    rtems_configuration_get_idle_task(),
[05df0a8]66    NULL,
[1ccb64e1]67    0,
68    per_cpu
[05df0a8]69  );
[06dcaf0]70}
71
72void _Thread_Create_idle( void )
73{
[477259c]74  uint32_t processor_count = _SMP_Get_processor_count();
75  uint32_t processor;
76
77  for ( processor = 0 ; processor < processor_count ; ++processor ) {
[fe52e7c0]78    Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( processor );
[05279b84]79
[c5831a3f]80    if ( _Per_CPU_Is_processor_started( per_cpu ) ) {
81      _Thread_Create_idle_for_cpu( per_cpu );
82    }
[477259c]83  }
[05df0a8]84}
Note: See TracBrowser for help on using the repository browser.