Changeset c5831a3f in rtems for doc


Ignore:
Timestamp:
04/09/14 13:07:54 (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
509040f0
Parents:
27270b0d
git-author:
Sebastian Huber <sebastian.huber@…> (04/09/14 13:07:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/15/14 08:41:44)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/conf.t

    r27270b0d rc5831a3f  
    35023502@subheading DESCRIPTION:
    35033503The Deterministic Priority Scheduler is the default scheduler in RTEMS
    3504 for single core applications and is designed for predictable performance
     3504for uni-processor applications and is designed for predictable performance
    35053505under the highest loads.  It can block or unblock a thread in a constant
    35063506amount of time.  This scheduler requires a variable amount of memory
     
    35733573@subheading DESCRIPTION:
    35743574The Earliest Deadline First Scheduler (EDF) is an alternative scheduler in
    3575 RTEMS for single core applications. The EDF schedules tasks with dynamic
     3575RTEMS for uni-processor applications. The EDF schedules tasks with dynamic
    35763576priorities equal to deadlines. The deadlines are declared using only
    35773577Rate Monotonic manager which handles periodic behavior.  Period is always
     
    36133613@subheading DESCRIPTION:
    36143614The Constant Bandwidth Server Scheduler (CBS) is an alternative scheduler
    3615 in RTEMS for single core applications. The CBS is a budget aware extension
     3615in RTEMS for uni-processor applications. The CBS is a budget aware extension
    36163616of EDF scheduler. The goal of this scheduler is to ensure temporal
    36173617isolation of tasks. The CBS is equipped with a set of additional rules
     
    36863686@subheading DESCRIPTION:
    36873687The Simple SMP Priority Scheduler is derived from the Simple Priority
    3688 Scheduler but is capable of scheduling threads across multiple cores.
     3688Scheduler but is capable of scheduling threads across multiple processors.
    36893689It is designed to provide the same task scheduling behaviour as the
    36903690Deterministic Priority Scheduler while distributing threads across
    3691 multiple cores.  Being based upon the Simple Priority Scheduler, it also
     3691multiple processors.  Being based upon the Simple Priority Scheduler, it also
    36923692maintains a single sorted list of all ready threads.  Thus blocking or
    36933693unblocking a thread is not a constant time operation with this scheduler.
    36943694
    3695 In addition, when allocating threads to cores, the algorithm is not
     3695In addition, when allocating threads to processors, the algorithm is not
    36963696constant time. This algorithm was not designed with efficiency as a
    36973697primary design goal.  Its primary design goal was to provide an SMP-aware
     
    37933793
    37943794@c
     3795@c === Configuring Clustered/Partitioned Schedulers ===
     3796@c
     3797@subsection Configuring Clustered/Partitioned Schedulers
     3798
     3799Clustered/partitioned scheduling helps to control the worst-case latencies in
     3800the system.  The goal is to reduce the amount of shared state in the system and
     3801thus prevention of lock contention.  Modern multi-processor systems tend to
     3802have several layers of data and instruction caches.  With clustered/partitioned
     3803scheduling it is possible to honour the cache topology of a system and thus
     3804avoid expensive cache synchronization traffic.
     3805
     3806We have clustered scheduling in case the set of processors of a system is
     3807partitioned into non-empty pairwise-disjoint subsets.  These subsets are called
     3808clusters.  Clusters with a cardinality of one are partitions.  Each cluster is
     3809owned by exactly one scheduler instance.  In order to use clustered/partitioned
     3810scheduling the application designer has to answer two questions.
     3811
     3812@enumerate
     3813@item How is the set of processors partitioned into clusters/partitions?
     3814@item Which scheduler is used for which cluster/partition?
     3815@end enumerate
     3816
     3817@subheading CONFIGURATION:
     3818
     3819The schedulers in an SMP system are statically configured on RTEMS.  Firstly
     3820the application must select which scheduling algorithms are available with the
     3821following defines
     3822
     3823@itemize @bullet
     3824@item @code{CONFIGURE_SCHEDULER_PRIORITY_SMP},
     3825@item @code{CONFIGURE_SCHEDULER_SIMPLE_SMP}, and
     3826@item @code{CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP}.
     3827@end itemize
     3828
     3829This is necessary to calculate the per-thread overhead introduced by the
     3830schedulers.  After these definitions the configuration file must @code{#include
     3831<rtems/scheduler.h>} to have access to scheduler specific configuration macros.
     3832Each scheduler needs a context to store state information at run-time.  To
     3833provide a context for each scheduler is the next step.  Use the following
     3834macros to create scheduler contexts
     3835
     3836@itemize @bullet
     3837@item @code{RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(name, prio_count)},
     3838@item @code{RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(name)}, and
     3839@item @code{RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP(name, prio_count)}.
     3840@end itemize
     3841
     3842The @code{name} parameter is used as part of a designator for a global
     3843variable, so the usual C/C++ designator rules apply.  Additional parameters are
     3844scheduler specific.  The schedulers are registered in the system via the
     3845scheduler table.  To create the scheduler table define
     3846@code{CONFIGURE_SCHEDULER_CONTROLS} to a list of the following scheduler
     3847control initializers
     3848
     3849@itemize @bullet
     3850@item @code{RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(name, obj_name)},
     3851@item @code{RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(name, obj_name)}, and
     3852@item @code{RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP(name, obj_name)}.
     3853@end itemize
     3854
     3855The @code{name} parameter must correspond to the parameter defining the
     3856scheduler context.  The @code{obj_name} determines the scheduler object name
     3857and can be used in @code{rtems_scheduler_ident()} to get the scheduler object
     3858identifier.
     3859
     3860The last step is to define which processor uses which scheduler.
     3861For this purpose a scheduler assignment table must be defined.  The entry count
     3862of this table must be equal to the configured maximum processors
     3863(@code{CONFIGURE_SMP_MAXIMUM_PROCESSORS}).  A processor assignment to a
     3864scheduler can be optional or mandatory.  The boot processor must have a
     3865scheduler assigned.  In case the system needs more mandatory processors than
     3866available then a fatal run-time error will occur.  To specify the scheduler
     3867assignments define @code{CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS} to a list of
     3868@code{RTEMS_SCHEDULER_ASSIGN(index, attr)} and
     3869@code{RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER} macros.  The @code{index} parameter
     3870must be a valid index into the scheduler table.  The @code{attr} parameter
     3871defines the scheduler assignment attributes.  By default a scheduler assignment
     3872to a processor is optional.  For the scheduler assignment attribute use one of
     3873the mutually exclusive variants
     3874
     3875@itemize @bullet
     3876@item @code{RTEMS_SCHEDULER_ASSIGN_DEFAULT},
     3877@item @code{RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY}, and
     3878@item @code{RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL}.
     3879@end itemize
     3880
     3881@subheading ERRORS:
     3882
     3883In case one of the scheduler indices in
     3884@code{CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS} is invalid a link-time error will
     3885occur with an undefined reference to @code{RTEMS_SCHEDULER_INVALID_INDEX}.
     3886
     3887Some fatal errors may occur in case of scheduler configuration inconsistencies or a lack
     3888of processors on the system.  The fatal source is
     3889@code{RTEMS_FATAL_SOURCE_SMP}.  None of the errors is internal.
     3890
     3891@itemize @bullet
     3892@item @code{SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER} - the boot
     3893processor must have a scheduler assigned.
     3894@item @code{SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT} - there exists a
     3895mandatory processor beyond the range of physically or virtually available
     3896processors.  The processor demand must be reduced for this system.
     3897@item @code{SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED} - the start of a
     3898mandatory processor failed during system initialization.  The system may not
     3899have this processor at all or it could be a problem with a boot loader for
     3900example.
     3901the @code{CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS} definition.
     3902@item @code{SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS} - it is prohibited to have
     3903a scheduler managing the empty processor set.
     3904@item @code{SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR} - it is not
     3905allowed to start multitasking on a processor with no scheduler assigned.
     3906@end itemize
     3907
     3908@subheading EXAMPLE:
     3909
     3910The following example shows a scheduler configuration for a hypothetical
     3911product using two chip variants.  One variant has four processors which is used
     3912for the normal product line and another provides eight processors for the
     3913high-performance product line.  The first processor performs hard-real time
     3914control of actuators and sensors.  The second processor is not used by RTEMS at
     3915all and runs a Linux instance to provide a graphical user interface.  The
     3916additional processors are used for a worker thread pool to perform data
     3917processing operations.
     3918
     3919The processors managed by RTEMS use two Deterministic Priority scheduler
     3920instances capable of dealing with 256 priority levels.  The scheduler with
     3921index zero has the name @code{"IO  "}.  The scheduler with index one has the
     3922name @code{"WORK"}.  The scheduler assignments of the first, third and fourth
     3923processor are mandatory, so the system must have at least four processors,
     3924otherwise a fatal run-time error will occur during system startup.  The
     3925processor assignments for the fifth up to the eighth processor are optional so
     3926that the same application can be used for the normal and high-performance
     3927product lines.  The second processor has no scheduler assigned and runs Linux.
     3928A hypervisor will ensure that the two systems cannot interfere in an
     3929undesirable way.
     3930
     3931@example
     3932@group
     3933#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 8
     3934
     3935#define CONFIGURE_MAXIMUM_PRIORITY 255
     3936
     3937/* Make the scheduler algorithm available */
     3938
     3939#define CONFIGURE_SCHEDULER_PRIORITY_SMP
     3940
     3941#include <rtems/scheduler.h>
     3942
     3943/* Create contexts for the two scheduler instances */
     3944
     3945RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(io, CONFIGURE_MAXIMUM_PRIORITY + 1);
     3946
     3947RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(work, CONFIGURE_MAXIMUM_PRIORITY + 1);
     3948
     3949/* Define the scheduler table */
     3950
     3951#define CONFIGURE_SCHEDULER_CONTROLS \
     3952  RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( \
     3953    io, \
     3954    rtems_build_name('I', 'O', ' ', ' ') \
     3955  ), \
     3956  RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( \
     3957    work, \
     3958    rtems_build_name('W', 'O', 'R', 'K') \
     3959  )
     3960
     3961/* Define the processor to scheduler assignments */
     3962
     3963#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \
     3964  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
     3965  RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \
     3966  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
     3967  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
     3968  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
     3969  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
     3970  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
     3971  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
     3972@end group
     3973@end example
     3974
     3975@c
    37953976@c === SMP Specific Configuration Parameters ===
    37963977@c
     
    38053986@c === CONFIGURE_SMP_APPLICATION ===
    38063987@c
    3807 @subsection Specify Application Uses Multiple Cores (is SMP)
     3988@subsection Enable SMP Support for Applications
    38083989
    38093990@findex CONFIGURE_SMP_APPLICATION
     
    38204001
    38214002@item DEFAULT VALUE:
     4003This is not defined by default.
     4004
     4005@end table
     4006
     4007@subheading DESCRIPTION:
     4008@code{CONFIGURE_SMP_APPLICATION} must be defined to enable SMP support for the
     4009application.
     4010
     4011@subheading NOTES:
     4012This define may go away in the future in case all RTEMS components are SMP ready.
     4013
     4014@c
     4015@c === CONFIGURE_SMP_MAXIMUM_PROCESSORS ===
     4016@c
     4017@subsection Specify Maximum Processors in SMP System
     4018
     4019@findex CONFIGURE_SMP_MAXIMUM_PROCESSORS
     4020
     4021@table @b
     4022@item CONSTANT:
     4023@code{CONFIGURE_SMP_MAXIMUM_PROCESSORS}
     4024
     4025@item DATA TYPE:
     4026Unsigned integer (@code{uint32_t}).
     4027
     4028@item RANGE:
     4029Defined or undefined.
     4030
     4031@item DEFAULT VALUE:
    38224032The default value is 1, (if CONFIGURE_SMP_APPLICATION is defined).
    38234033
     
    38254035
    38264036@subheading DESCRIPTION:
    3827 @code{CONFIGURE_SMP_APPLICATION} must be defined if the application is
    3828 to make use of multiple CPU cores in an SMP target system.
    3829 
    3830 @subheading NOTES:
    3831 None.
    3832 
    3833 @c
    3834 @c === CONFIGURE_SMP_MAXIMUM_PROCESSORS ===
    3835 @c
    3836 @subsection Specify Maximum Processors in SMP System
    3837 
    3838 @findex CONFIGURE_SMP_MAXIMUM_PROCESSORS
    3839 
    3840 @table @b
    3841 @item CONSTANT:
    3842 @code{CONFIGURE_SMP_MAXIMUM_PROCESSORS}
    3843 
    3844 @item DATA TYPE:
    3845 Unsigned integer (@code{uint32_t}).
    3846 
    3847 @item RANGE:
    3848 Defined or undefined.
    3849 
    3850 @item DEFAULT VALUE:
    3851 The default value is 1, (if CONFIGURE_SMP_APPLICATION is defined).
    3852 
    3853 @end table
    3854 
    3855 @subheading DESCRIPTION:
    38564037@code{CONFIGURE_SMP_MAXIMUM_PROCESSORS} must be set to the number of
    3857 CPU cores in the SMP configuration.
    3858 
    3859 @subheading NOTES:
    3860 If there are more cores available than configured, the rest will be
     4038processors in the SMP configuration.
     4039
     4040@subheading NOTES:
     4041If there are more processors available than configured, the rest will be
    38614042ignored.
    38624043
Note: See TracChangeset for help on using the changeset viewer.