source: rtems/cpukit/score/src/threadcreateidle.c @ 509040f0

4.115
Last change on this file since 509040f0 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
Line 
1/**
2 *  @file
3 *
4 *  @brief Create Idle Thread
5 *  @ingroup ScoreThread
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadimpl.h>
22#include <rtems/score/schedulerimpl.h>
23#include <rtems/score/stackimpl.h>
24#include <rtems/config.h>
25
26static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu )
27{
28  Objects_Name    name;
29  Thread_Control *idle;
30
31  name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
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   */
38  idle = _Thread_Internal_allocate();
39
40  _Thread_Initialize(
41    &_Thread_Internal_information,
42    idle,
43    _Scheduler_Get_by_CPU( per_cpu ),
44    NULL,        /* allocate the stack */
45    _Stack_Ensure_minimum( rtems_configuration_get_idle_task_stack_size() ),
46    CPU_IDLE_TASK_IS_FP,
47    PRIORITY_MAXIMUM,
48    true,        /* preemptable */
49    THREAD_CPU_BUDGET_ALGORITHM_NONE,
50    NULL,        /* no budget algorithm callout */
51    0,           /* all interrupts enabled */
52    name
53  );
54
55  /*
56   *  WARNING!!! This is necessary to "kick" start the system and
57   *             MUST be done before _Thread_Start is invoked.
58   */
59  per_cpu->heir      =
60  per_cpu->executing = idle;
61
62  _Thread_Start(
63    idle,
64    THREAD_START_NUMERIC,
65    rtems_configuration_get_idle_task(),
66    NULL,
67    0,
68    per_cpu
69  );
70}
71
72void _Thread_Create_idle( void )
73{
74  uint32_t processor_count = _SMP_Get_processor_count();
75  uint32_t processor;
76
77  for ( processor = 0 ; processor < processor_count ; ++processor ) {
78    Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( processor );
79
80    if ( _Per_CPU_Is_processor_started( per_cpu ) ) {
81      _Thread_Create_idle_for_cpu( per_cpu );
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.