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

4.11
Last change on this file since a936aa49 was a936aa49, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 6, 2013 at 1:41:00 PM

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
RevLine 
[e655f7e]1/**
2 *  @file
[05df0a8]3 *
[e655f7e]4 *  @brief Start Thread Multitasking
5 *  @ingroup ScoreThread
6 */
7
8/*
[6a07436]9 *  COPYRIGHT (c) 1989-2006.
[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
[dd687d9]14 *  http://www.rtems.com/license/LICENSE.
[05df0a8]15 */
16
[a8eed23]17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
[05df0a8]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  /*
[a0ed4ed]37   *  The system is now multitasking and completely initialized.
[f5f4566]38   *  This system thread now "hides" in a single processor until
39   *  the system is shut down.
[05df0a8]40   */
41
42  _System_state_Set( SYSTEM_STATE_UP );
43
[4b1d261]44  _Thread_Dispatch_necessary = false;
[05df0a8]45
[a936aa49]46  #if defined(RTEMS_SMP)
47    _Thread_Executing->is_executing = false;
48    _Thread_Heir->is_executing = true;
49  #endif
50
[05df0a8]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
[86c847c1]75#if defined(_CPU_Start_multitasking)
76  _CPU_Start_multitasking( &_Thread_BSP_context, &_Thread_Heir->Registers );
77#else
[05df0a8]78  _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers );
[86c847c1]79#endif
[05df0a8]80}
Note: See TracBrowser for help on using the repository browser.