Need help in figuring out how a scheduler is assigned to a task

Gedare Bloom gedare at rtems.org
Sat Jun 6 15:23:20 UTC 2020


On Sat, Jun 6, 2020 at 7:22 AM Richi Dubey <richidubey at gmail.com> wrote:
>
> Hii everyone,
>
> I was going through the code testsuites/sptests/spsimplesched01/init.c
> and there is only one mention of simple scheduler :
>
> #define CONFIGURE_SCHEDULER_SIMPLE
>
> and on checking the meaning of this preprocessor directive from
> scheduler.h , The relevant code is:
>
> #ifdef CONFIGURE_SCHEDULER_SIMPLE
>   #include <rtems/score/schedulersimple.h>
>
>   #define SCHEDULER_SIMPLE_CONTEXT_NAME( name ) \
>     SCHEDULER_CONTEXT_NAME( simple_ ## name )
>
>   #define RTEMS_SCHEDULER_SIMPLE( name ) \
>     static Scheduler_simple_Context \
>       SCHEDULER_SIMPLE_CONTEXT_NAME( name )
>
>   #define RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name ) \
>     { \
>       &SCHEDULER_SIMPLE_CONTEXT_NAME( name ).Base, \
>       SCHEDULER_SIMPLE_ENTRY_POINTS, \
>       SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
>       ( obj_name ) \
>       SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
>     }
>
>   /* Provided for backward compatibility */
>
>   #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \
>     RTEMS_SCHEDULER_SIMPLE( name )
>
>   #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \
>     RTEMS_SCHEDULER_TABLE_SIMPLE( name, obj_name )
> #endif
>
> And that's it! How does the task get assigned to this scheduler when we write
>
>   status = rtems_task_create(
>     Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
>     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
>   );
>
> in init.c? How can we not use the _Scheduler_simple_Initialize anywhere?
>

What you are trying to do is unsupported in uniprocessor mode. It is
not allowed to share the same core by more than scheduler. Cores are
mutually exclusive resources owned by schedulers. A user separately
binds tasks to schedulers by using cpu affinity.

Maybe this needs to be mentioned in
https://docs.rtems.org/branches/master/c-user/scheduling_concepts.html#
somewhere. You should be able to get to understand it by reading the
configuration documentation in the Classic API Manual Chapter 24.18
and 24.19, starting at
https://docs.rtems.org/branches/master/c-user/config/scheduler-general.html

>
>
> Another small doubt that I had was about the linking of different .c
> files corresponding to simplescheduler.
> For Ex:
> One of the files is src/rtems/cpukit/score/src/schedulersimpleyield.c
> and other is
> src/rtems/cpukit/score/src/schedulersimpleblock.c
>
> and both of them are defining the functions listed in
> include/rtems/score/schedulersimpleimpl.h but I could not find any
> code anywhere linking these two files with this. Can someone please
> help me find the code that links all the files related to
> schedulersimple.c together?
>

You mean like compiler linking?  Maybe this helps:
https://docs.rtems.org/branches/master/user/exe/executables.html#rtems-executable

The build system makes them both part of the same intermediate object
code file. Have a look at cpukit/Makefile.am currently as we still use
the autotools to make this happen.

If you mean something else, please clarify.

Gedare

> Thanks,
> Richi.
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list