QP/C++ Real-Time Event Framework 8.1.5
Loading...
Searching...
No Matches
Resource Viewpoint

Context ViewpointFreedom From Interference Viewpoint

Architectural Viewpoint


ARCH_QP_RES_VP

Architectural viewpoint: Resource management in QP/C++ Framework.

Purpose
The Resource Viewpoint covers resource management, resource ownership, and resource utilization.

Architectural Views
This architectural viewpoint frames the following views:


Architectural Views: Memory Management

The following traceable architectural views explain the memory management policies, event management, and other resources:

Model Kind
The composite structure diagram in Figure SAS-MEM shows a snapshot of memory after the startup of the QP/C++ Application. This dynamic view illustrates the policies of managing various resources and memory in the QP/C++ Framework component.

Figure SAS-MEM: Memory allocation in QP/C++ Framework component.

ARCH_QP_MEM_00

Architectural view: General QP/C++ Framework component memory allocation policy.

QP/C++ Framework component's memory allocation policy is to minimize the use and size of the internal objects and to apply exclusively static allocation for these objects. The policy intentionally leaves it up to the QP/C++ Application to allocate any other objects, allowing the QP/C++ Application to freely use any allocation scheme, including allocating the object statically (preferred) or even from the standard heap (not recommended). This also allows the QP/C++ Application to choose the memory type for allocating various objects. For example, the QP/C++ Application might choose to allocate event-pools in special memory regions (e.g., shared memory, special DMA memory, etc.).

Backward Traceability

  • REQ_QP_NF_13: QP/C++ Framework component shall NOT internally pre-allocate memory for application-specific objects such as event-queue buffers; event-pool buffers; tracing-buffers etc.

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_EM_10: QP/C++ Application must initialize the event pools correctly and adequately.
  • ASR_QA_EM_11: QP/C++ Application must initialize the publish-subscribe correctly and adequately.
  • ASR_QA_EM_20: QP/C++ Application shall allocate immutable events as 'static' and 'const'
  • DES_QP_START: Design view: QP/C++ Framework startup sequence.



ARCH_QP_MEM_01

Architectural view: Active Object memory allocation policy and responsibilities.

QP/C++ Framework component pre-allocates (statically) only an array of pointers to Active Objects managed by the framework (array act[] in Figure SAS-MEM [1]). The size of the array, called also "Active Object registry," is configured at compile-time, but cannot exceed 64 Active Objects.

The QP/C++ Application is responsible for the allocation of the Active Object instances (see ActB_inst and ActA_inst in Figure SAS-MEM [1A,1B]). Note that the sizes of Active Objects depend on the attributes added during subclassing and customizing the QActive or QMActive base classes.

Backward Traceability

  • REQ_QP_AO_01: QP/C++ Framework component shall be able to manage a compile-time configurable number of Active Objects not exceeding 64 instances.

Forward Traceability (truncated to 1 level(s))

  • AOU_QA_AO_10: QP/C++ Application-level concrete Active Objects should be instantiated statically.
  • DES_QP_START: Design view: QP/C++ Framework startup sequence.



ARCH_QP_MEM_02

Architectural view: Event queue allocation policy and responsibilities.

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_AO_22: QP/C++ Application shall provide an adequate event queue buffer for each Active Object instance.
  • ARCH_QP_SCT_02: Architectural view: QP/C++ Framework component shall apply error detection codes based on Duplicate Inverse Storage and Duplicate Storage. The QP/C++ Framework component leaves it up to the QP/C++ Application to allocate the event-queue buffers for Active Objects (Figure SAS-MEM [2A,2B]). Note that the event-queue control structure (eQueue attribute) is part of the QActive base class. However, the size of the queue buffer depends on the needs of the specific Active Object and therefore is allocated by the application.



ARCH_QP_MEM_03

Architectural view: Active Object stack allocation policy and responsibilities.

If the underlying real-time kernel requires a separate stack space for each Active Object thread (Figure SAS-MEM [3A,3B]), these stacks must be allocated by the QP/C++ Application. Note that the thread control block (thread attribute) is part of the QActive base class and is known at compile-time. However, the size of the thread stack depends on the needs of the specific Active Object and therefore is allocated by the application. (NOTE: The thread stack allocation policy depends on the real-time kernel chosen for the QP/C++ Framework component. Some kernels don't need per-thread stacks at all. Some kernels need the stacks, but pre-allocate them internally. In those cases, the QP/C++ Application might not need to allocate the per-thread stacks.

Backward Traceability

  • REQ_QP_AO_01: QP/C++ Framework component shall be able to manage a compile-time configurable number of Active Objects not exceeding 64 instances.

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_AO_23: QP/C++ Application shall provide an adequate stack space for each Active Object instance.



ARCH_QP_MEM_04

Architectural view: Event pool allocation policy and responsibilities.

QP/C++ Framework component pre-allocates (statically) only an array of event-pools of different block-sizes (array EvtPool[] in Figure SAS-MEM [4]). The size of the array is configured at compile-time, but cannot exceed 15 event pools.

The QP/C++ Application is responsible for the allocation of the event pool memory buffers event pools (Figure SAS-MEM [4A,4B,4C]) of different block-sizes. The size of the event-pool buffers depends on the application's needs and therefore is allocated by the application.

Backward Traceability

  • REQ_QP_EMM_10: QP/C++ Framework component shall support mutable events.
  • REQ_QP_EMM_11: QP/C++ Framework component shall support up to 15 event pools for mutable events.

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_EM_10: QP/C++ Application must initialize the event pools correctly and adequately.
  • ARCH_QP_SCT_02: Architectural view: QP/C++ Framework component shall apply error detection codes based on Duplicate Inverse Storage and Duplicate Storage.
  • DES_QP_MELC: Design view: Mutable event ownership rules.



ARCH_QP_MEM_05

Architectural view: Subscription lists allocation policy and responsibilities.

QP/C++ Framework component statically allocates only a pointer to "subscriber list" for publish-subscribe (pointer subscrList[] in Figure SAS-MEM [5])

  • A pointer to a software tracing buffer (pointer QS_txBuf[] in Figure SAS-MEM [6])
  • other, similar objects known at compile-time

The QP/C++ Application is responsible for the allocation of the publish-subscribe lists (Figure SAS-MEM [5A]). If the publish-subscribe feature is used, QP/C++ Application needs to provide the subscribe-list buffer, whose size depends on the number of events that can be published.

Backward Traceability

  • REQ_QP_EDM_50: QP/C++ Framework component shall provide publish-subscribe event delivery mechanism
  • REQ_QP_EDM_51: The publish-subscribe event delivery mechanism shall be configurable and optional

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_EM_11: QP/C++ Application must initialize the publish-subscribe correctly and adequately.
  • ARCH_QP_SCT_02: Architectural view: QP/C++ Framework component shall apply error detection codes based on Duplicate Inverse Storage and Duplicate Storage.



ARCH_QP_MEM_06

Architectural view: Software tracing buffers allocation policy and responsibilities.

The QP/C++ Framework component statically allocates the internal ring buffer control blocks for the tracing transmit buffer and receive buffer.

The QP/C++ Application is responsible for the allocation of the tracing-buffers (Figure SAS-MEM [6A]). The QP/C++ Application needs to provide the tracing buffer, whose size depends on the volume of software tracing data produced.

Backward Traceability

  • REQ_QP_QS_00: QP/C++ Framework component shall support Software Tracing.
  • REQ_QP_QS_11: QS target-resident component shall allow flexible buffering schemes and decoupling trace generation from transmission to the host.

Forward Traceability (truncated to 1 level(s))


Architectural Views: Event Management


ARCH_QP_EVT_00

Architectural view: Event management policy in QP/C++ Framework.

Model Kind
The composite structure diagram in Figure SAS-EMM illustrates how the QP/C++ Framework component manages the events. The diagram shows a snapshot in time, including an Active Object's event-queue buffer as well as the various events in memory.

Figure SAS-EMM: Event memory management in QP/C++ Framework component.

Description
To uniformly treat all types of events, the Active Object event-queue stores only pointers to event instances. These pointers can point to immutable events located in ROM and mutable events located in event-pools, as well as Time Events located typically inside Active Objects. QP/C++ Framework component manages the memory for event-queues, queue-buffers, and event-instances as illustrated in a scenario shown in Figure SAS-EMM and described below:

Figure SAS-EMM [1A]: Active Object instance allocated by QP/C++ Application has an internal event-queue (the control structure);

Figure SAS-EMM [2A]: The external queue-buffer (allocated by QP/C++ Application) holds pointers to events. The used queue entries are highlighted.

Figure SAS-EMM [3A]: One of the event-queue entries points to an immutable event instance (allocated in ROM).

Figure SAS-EMM [4A]: The event-pool buffer holds dynamically allocated mutable events. The used pool entries are highlighted. Two of the event-queue entries point to events in the "small" pool (event-pool with a "small" block-size).

Figure SAS-EMM [4B]: Another event-pool buffer holds dynamically allocated mutable events. The used pool entries are highlighted. One of the event-queue entries points to an event in the "medium" pool (event-pool with a "medium" block-size).

Figure SAS-EMM [5A]: One of the event-queue entries points to an Time Event instance (allocated inside the Active Object instance).

Backward Traceability

  • REQ_QP_EMM_00: QP/C++ Framework component shall support immutable events.
  • REQ_QP_EMM_10: QP/C++ Framework component shall support mutable events.
  • REQ_QP_TM_00: QP/C++ Framework component shall support Time Events.

Forward Traceability (truncated to 1 level(s))

  • ASR_QA_EM_00: All event parameters shall be included directly in the event class and shall not be referenced by pointers or references.
  • ASR_QA_EM_10: QP/C++ Application must initialize the event pools correctly and adequately.
  • ASR_QA_EM_20: QP/C++ Application shall allocate immutable events as 'static' and 'const'
  • ARCH_QP_SCT_02: Architectural view: QP/C++ Framework component shall apply error detection codes based on Duplicate Inverse Storage and Duplicate Storage.
  • DES_QP_START: Design view: QP/C++ Framework startup sequence.
  • DES_QP_POST: Design view: QP/C++ event posting sequence.
  • DES_QP_PUB: Design view: QP/C++ event publishing sequence.
  • DES_QP_MELC: Design view: Mutable event ownership rules.


Context ViewpointFreedom From Interference Viewpoint