Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

There are many models for accessing memory: PRAM, Actor Model, Petri Nets, Tuple Spaces, Scoop, Process calculi, etc.

Since we are using the PRAM (= Parallel Random Access Machine) model, this will be further discussed:

Image Removed

  • Processes can only communicate with each other by accessing shared Memory
  • MAU connects the Processes with Shared Memory

Moreover, it needs to be defined if reading/ writing should be Exclusive or Concurrent. Therefore, at least four ways of implementation are possible.

  • Exclusive Read Exclusive Write (EREW) → only one Process can read/ write at the same time
  • Exclusive Read Concurrent Write (ERCW) → only one Process read at the same time, but many Processes can write at the same time
  • Concurrent Read Exclusive Write (CREW) → only one Process write at the same time, but many Processes can read at the same time
  • Concurrent Read Concurrent Write (CRCW) → many Processes can read/ write at the same time

The netx90 uses shared Memory. Both ARM Cortex-M4 Processors can read/ write to Memory simultaneous. Therefore, the netx90 has a CRCW implementation.Heap, Stack and static/ dynamic memory allocation.

Heap/ Stack

The program’s machine instructions (e.g., executable code) are stored in the text area. Global and static data are stored in initialized/ uninitialized data. The “malloc” operator allocates memory on the heap and can be released with the “free” operator. Therefore, memory allocated on the heap is always where space is left on the heap. Memory holes are the consequence. The stack contains all the automatic, non-static variables and is implemented as “least in first out” structure. The operator “push” allocates memory on the stack, “pop” releases the last allocated element from the stack.Image Removed

Image Added

Stack-overflow

If the stack is full and a push operation is executed, the stack is considered to be in an overflow state and may override data on the heap.

Remarks on using FreeRTOS

Each task has its own dedicated stack. How and where you place that stack, is up to you! FreeRTOS offers various implementation options, you could take an independent implementation, or you can implement your own.

Official FreeRTOS Heap Implementations

FreeRTOS provides multiple heap memory allocation implementations. They do not require a standard library, which you can use out of the box.



In many NetX 90 example projects, we use the standard library newlib c.  None of which is using the heap implementation provided by newlib c.


static vs dynmic memory allocation

...