Document Title: Specification of Operating System Interface
Document Title: Specification of Operating System Interface
AUTOSAR AP R20-11
Specification of Operating
Document Title System Interface
Document Owner AUTOSAR
Document Responsibility AUTOSAR
Document Identification No 719
AUTOSAR
2017-03-31 17-03 Release • Initial release
Management
Disclaimer
This work (specification and/or software implementation) and the material contained in
it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the
companies that have contributed to it shall not be liable for any use of the work.
The material contained in this work is protected by copyright and other types of intel-
lectual property rights. The commercial exploitation of the material contained in this
work requires a license to such intellectual property rights.
This work may be utilized or reproduced without any modification, in any form or by
any means, for informational purposes only. For any other purpose, no part of the work
may be utilized or reproduced, in any form or by any means, without permission in
writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Table of Contents
1 Introduction and Functional Overview 6
3 Related Documentation 8
3.1 Input Documents & Related Standards and Norms . . . . . . . . . . . 8
3.2 Further applicable specification . . . . . . . . . . . . . . . . . . . . . . 8
4 Constraints and assumptions 9
4.1 Known Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5 Dependencies to Functional Clusters 10
5.1 Protocol layer dependencies . . . . . . . . . . . . . . . . . . . . . . . . 10
6 Requirements Tracability 11
6.1 Non-applicable requirements . . . . . . . . . . . . . . . . . . . . . . . 12
7 Functional specification 13
7.1 Functional Cluster Lifecycle . . . . . . . . . . . . . . . . . . . . . . . . 13
7.1.1 Operating System Overview . . . . . . . . . . . . . . . . . . 13
7.1.2 Process Handling . . . . . . . . . . . . . . . . . . . . . . . . 13
7.1.3 Scheduling Policies . . . . . . . . . . . . . . . . . . . . . . . 15
7.1.4 Time Triggered Execution . . . . . . . . . . . . . . . . . . . . 15
7.1.5 Device Support . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1.6 Resource control . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.2 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.3 Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8 API Specification 19
8.1 C++ language binding Operating System . . . . . . . . . . . . . . . 19
8.1.1 Application Interface C (POSIX PSE51) . . . . . . . . . . . . 19
8.1.2 Application Interface C++11 . . . . . . . . . . . . . . . . . . 20
8.2 API Common Data Types . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.3 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
9 Service Interfaces 21
9.1 Type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.2 Provided Service Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 21
9.3 Required Service Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 21
9.4 Application Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A Appendix 22
A.1 Mentioned Manifest Elements . . . . . . . . . . . . . . . . . . . . . . . 22
A.2 Interfaces to other Functional Clusters (informative) . . . . . . . . . . . 22
3 Related Documentation
6 Requirements Tracability
The following table references the features specified in [3] and links to the fulfillments
of these.
Feature Description Satisfied by
[RS_AP_00111] The AUTOSAR Adaptive Platform shall support [SWS_OSI_01001]
source code portability for AUTOSAR Adaptive [SWS_OSI_01002]
applications.
[RS_AP_00113] No description [SWS_OSI_NA]
[RS_AP_00114] C++ interface shall be compatible with C++14. [SWS_OSI_01002]
[RS_AP_00115] Namespaces. [SWS_OSI_NA]
[RS_AP_00116] Header file name. [SWS_OSI_NA]
[RS_AP_00119] Return values / application errors. [SWS_OSI_NA]
[RS_AP_00120] Method and Function names. [SWS_OSI_NA]
[RS_AP_00121] Parameter names. [SWS_OSI_NA]
[RS_AP_00122] Type names. [SWS_OSI_NA]
[RS_AP_00124] Variable names. [SWS_OSI_NA]
[RS_AP_00125] Enumerator and constant names. [SWS_OSI_NA]
[RS_AP_00127] Usage of ara::core types. [SWS_OSI_NA]
[RS_AP_00128] Error reporting. [SWS_OSI_NA]
[RS_AP_00129] Public types defined by functional clusters shall be [SWS_OSI_NA]
designed to allow implementation without dynamic
memory allocation.
[RS_AP_00130] AUTOSAR Adaptive Platform shall represent a rich [SWS_OSI_NA]
and modern programming environment.
[RS_AP_00132] noexcept behavior of API functions [SWS_OSI_NA]
[RS_AP_00133] noexcept behavior of move and swap operations [SWS_OSI_NA]
[RS_AP_00134] noexcept behavior of class destructors [SWS_OSI_NA]
[RS_AP_00135] Avoidance of shared ownership. [SWS_OSI_NA]
[RS_AP_00136] Usage of string types. [SWS_OSI_NA]
[RS_AP_00137] Connecting run-time interface with model. [SWS_OSI_NA]
[RS_AP_00138] Return type of asynchronous function calls. [SWS_OSI_NA]
[RS_AP_00139] Return type of synchronous function calls. [SWS_OSI_NA]
[RS_OSI_00100] The Operating System Interface provided to [SWS_OSI_01001]
processes shall provide a PSE51-compliant API. [SWS_OSI_01002]
[SWS_OSI_01003]
[SWS_OSI_01006]
[RS_OSI_00103] The Operating System Interface shall support C++. [SWS_OSI_01002]
[SWS_OSI_01015]
[RS_OSI_00104] The Operating System Interface shall support the [SWS_OSI_01001]
reaction on process-external stimuli from devices.
[RS_OSI_00105] The Operating System Interface shall support the [SWS_OSI_01040]
start of Execution Management.
[RS_OSI_00201] The Operating System shall provide mechanisms [SWS_OSI_02000]
for system memory budgeting. [SWS_OSI_02001]
[RS_OSI_00202] The Operating System shall provide mechanisms [SWS_OSI_02000]
for CPU time budgeting. [SWS_OSI_02002]
[RS_OSI_00203] The Operating System should provide [SWS_OSI_01006]
mechanisms for binding processes to CPU cores. [SWS_OSI_01012]
7 Functional specification
The real-time Operating System in an embedded automotive ECU offers the foun-
dation for dynamic behavior of the software applications. It manages the scheduling of
processes and events, the data exchange and synchronization between different pro-
cesses and provides features for monitoring and error handling. This chapter describes
requirements addressed to the Operating System. Applications, in particular
Adaptive Applications may not have the system rights to fully use or configure
these aspects directly.
The Operating System Scheduler is designed to keep all system resources busy allow-
ing multiple software control flows to share the CPU cores in an effective manner. The
main goals of the scheduling mechanisms may be one or more from the following:
• Maximizing throughput in terms of amount of work done per time unit.
• Maximizing responsiveness by minimizing the time between job activation and
actual begin of data processing.
• Maximizing fairness in terms of ensuring appropriate CPU time according with
priority and workload of each job.
• Assuring a timelined and ordered activation of jobs according to some policy-
dependent job execution eligibility (e.g. priority, deadline, tardiness, etc).
In real life these goals are often in conflict, implementing the scheduling mechanisms
is therefore always a compromise.
[SWS_OSI_01003] Default Scheduling Policies dThe AUTOSAR Adaptive Plat-
form Operating System shall support the following scheduling policies defined
in the IEEE1003.1 POSIX standard: SCHED_OTHER, SCHED_FIFO, SCHED_RR.c
(RS_OSI_00100)
In order to overcome the above mentioned conflicts and to achieve portability between
different platforms, the AUTOSAR Adaptive Platform Operating System pro-
vides the following scheduling policies categorized in two groups:
• Fair Scheduling Policies
– SCHED_OTHER
• Real-time Scheduling Policies
– SCHED_FIFO
– SCHED_RR
Since the above mentioned default scheduling policies may not guarantee proper ex-
ecution for all real-time scenarios, the Adaptive Application vendor may provide
additional scheduling policies to fulfill any execution requirement. For example, addi-
tional non-POSIX scheduling policies like SCHED_DEADLINE (Earliest Deadline First
algorithm) could be introduced to satisfy hard real-time requirements.
POSIX PSE51 provides a means to do time-based periodic processing, using the timer
API (e.g. timer_settime()) along with POSIX signals. However, signals are some-
times discouraged for safety-critical applications, because they disrupt the execution
flow.
Because memory accounting may differ between Operating Systems, some ele-
ments can be considered inside or outside the memory usage limit of the process
group, in an implementation-specific manner:
• Shared memory between processes of different groups
• Memory-mapped files
• Implicitly loaded shared objects between processes of different groups
[SWS_OSI_02002] CPU ResourceGroups dThe Operating System shall support
a mechanism to define groups of processes that may use a maximum configured
amount of CPU time over a defined period of time.c(RS_OSI_00202)
Because scheduling is done in very different ways depending on the Operating
System, the specific algorithm for scheduling as well as limiting the CPU usage is
not described here.
Example valid group scheduling schemes include (but not limited to):
• Fixed-periodic enablement of processes over a fixed range of time, in a manner
similar to what the ARINC 653 standard defines.
• Processes use time from a quota of time allocated to the group. If no time re-
mains, no thread from the processes in the expired group can be scheduled.
Each period, the quota is replenished to allow more time to be used and corre-
sponding threads to be scheduled again.
• Processes accumulate time usage. Each period or each context switch, time
usage accumulated over a certain count of past periods is calculated. Processes
of each group that used time over a threshold are disabled, and processes of
each group that used time under a threshold are enabled.
Most notably, on some Operating Systems, idle time, which by definition is not re-
quested to be used by any process group, may be distributed to any process, including
those belonging to a group that is considered to be using time over the defined limit.
This is a worthy optimization, but is currently not considered in the specification as a
requirement.
7.2 Startup
The startup steps of an Operating System have to be executed in an
implementation-specific way. These steps include starting any Operating System-
related middleware, including device-drivers and services handling low-level middle-
ware, as well as starting Execution Management.
As an important remark, it is expected that Execution Management will be started
early on during the system boot, ideally as the first process, in order to allow booting
all the required Processes. However, depending on the Operating System, other
system services and supporting middleware may be started before or in parallel. An
example may be a filesystem service, if the Operating System has one that is not
part of its kernel.
7.3 Shutdown
Similarly, shutdown steps for an Operating System are implementation-specific.
They may include flushing some middleware buffers, shutting down some peripherals,
and optionally turn off the entire system, depending on the system configuration.
8 API Specification
The AUTOSAR Adaptive Platform does not specify a new Operating System for
highly performant microcontrollers. Rather, it defines an execution context and pro-
gramming interface for use by Adaptive Applications.
9 Service Interfaces
Operating System does not define any AdaptivePlatform Service Interface.
A Appendix
none
none
none