source: rtems/cpukit/score/src/threadstartmultitasking.c @ a936aa49

4.115
Last change on this file since a936aa49 was a936aa49, checked in by Sebastian Huber <sebastian.huber@…>, on 06/06/13 at 13:41:00

scheduler: New simple SMP scheduler implementation

The new Simple SMP Scheduler allocates a processor for the processor
count highest priority ready threads. The thread priority and position
in the ready chain are the only information to determine the scheduling
decision. Threads with an allocated processor are in the scheduled
chain. After initialization the scheduled chain has exactly processor
count nodes. Each processor has exactly one allocated thread after
initialization. All enqueue and extract operations may exchange threads
with the scheduled chain. One thread will be added and another will be
removed. The scheduled and ready chain is ordered according to the
thread priority order. The chain insert operations are O(count of ready
threads), thus this scheduler is unsuitable for most real-time
applications.

The thread preempt mode will be ignored.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Start Thread Multitasking
5 *  @ingroup ScoreThread
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/apiext.h>
23#include <rtems/score/context.h>
24#include <rtems/score/interr.h>
25#include <rtems/score/isr.h>
26#include <rtems/score/object.h>
27#include <rtems/score/priority.h>
28#include <rtems/score/states.h>
29#include <rtems/score/sysstate.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/threadq.h>
32#include <rtems/score/wkspace.h>
33
34void _Thread_Start_multitasking( void )
35{
36  /*
37   *  The system is now multitasking and completely initialized.
38   *  This system thread now "hides" in a single processor until
39   *  the system is shut down.
40   */
41
42  _System_state_Set( SYSTEM_STATE_UP );
43
44  _Thread_Dispatch_necessary = false;
45
46  #if defined(RTEMS_SMP)
47    _Thread_Executing->is_executing = false;
48    _Thread_Heir->is_executing = true;
49  #endif
50
51  _Thread_Executing = _Thread_Heir;
52
53   /*
54    * Get the init task(s) running.
55    *
56    * Note: Thread_Dispatch() is normally used to dispatch threads.  As
57    *       part of its work, Thread_Dispatch() restores floating point
58    *       state for the heir task.
59    *
60    *       This code avoids Thread_Dispatch(), and so we have to restore
61    *       (actually initialize) the floating point state "by hand".
62    *
63    *       Ignore the CPU_USE_DEFERRED_FP_SWITCH because we must always
64    *       switch in the first thread if it is FP.
65    */
66#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
67   /*
68    *  don't need to worry about saving BSP's floating point state
69    */
70
71   if ( _Thread_Heir->fp_context != NULL )
72     _Context_Restore_fp( &_Thread_Heir->fp_context );
73#endif
74
75#if defined(_CPU_Start_multitasking)
76  _CPU_Start_multitasking( &_Thread_BSP_context, &_Thread_Heir->Registers );
77#else
78  _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers );
79#endif
80}
Note: See TracBrowser for help on using the repository browser.