STRIDE 3.0.01xx

From STRIDE Wiki
Jump to navigation Jump to search

This page documents the changes in Version 2.1.0301 of STRIDE (code name StoneSteps).

Please review this information before upgrading from an earlier version.

What's New

Based on customer requirements, in this release we have made significant changes to STRIDE Runtime and PAL.

Support for Multi-Process Target

New routines and support have been added to Runtime and PAL to support multi-process target. Changes include implementation of shared memory, protecting using named Mutex objects, synchronization of multiple processors ands multiple threads, and usage of current process and thread IDs.

Runtime Logging (Optional)

Runtime and PAL use a logging routine that can optionally be implemented in PAL.

Change Details

Shared Memory

To support multi-process target, shared memory support for dynamic and static pool memory has been implemented in Runtime. Runtime makes PAL calls to acquire shared memory and manages the memory according to runtime configurations set by user.

Protection using Mutex

Runtime now uses named mutex objects to protect shared resources between multiple processors and multiple threads. Runtime makes PAL calls to obtain and control mutex objects.

PAL

New Routines

  • Shared Memory Management

Recommended approach is to use Memory-Mapped Files to implement shared memory.

palOpenSharedMem - Open/Create shared memory segment 
palCloseSharedMem - Close shared memory segment
  • Named Mutexes
palMutexInit - Initialize a mutex object
palMutexDestroy - Destroy a mutex object
palMutexLock - Lock a mutex object
palMutexUnlock - Unlock a mutex object
  • Task Synchronization
palGetThreadId - Get current thread Id
palGetProcessId - Get current process Id
palSleep - Suspend the execution of the current thread
  • Logging

This is optional.

palLog - Logging utility

Removed / Old Routines

palProtect
palUnprotect

Runtime

  • STRIDE Host Release 2.1.0301 is compatible with the Runtime versions 3.0.
  • To support multi-process target, significant changes have been made to runtime.
  • A new public routine, srUninit(), has been added to sr.h & srapi.c.
  • To use in PAL for shared dynamic pool memory, new routines, _srMem_Allocate() & _srMem_Free(), have been added as part of new runtime files srmem.h & srmem.c.
  • The following Runtime files have been modified:
sr.h
srapi.c
srconn.c
srconn.h
srib.c
srib.h
sribtr.c
sribtr.h
srmsgptr.c
srmsgptr.h
srmsgque.c
srmsgque.h
srmsgrt.c
srmsgrt.h
srmsgsub.c
srmsgsub.h
srstid.c
srstid.h
srsuid.c
srsuid.h
srtime.c
srtime.h
  • The following Runtime files have been added:
srmem.c
srmem.h

Migration to 2.1.0301

Recommended steps for migration from a previous version:

PAL

You may reference Linux implementation of PAL, which has been updated to support shared memory.

  • Implement new shared memory routines, palOpenSharedMem() & palCloseSharedMem(), using memory-mapped files.
  • Runtime now manages shared dynamic pool memory. Update palMemAlloc() to simply call _srMem_Allocate() and palMemFree() to simply call _srMem_Free() for the shared memory case. For the non-shared case, you can leave the current implementation as it is.
  • Implement new mutex routines, palMutexInit(), palMutexDestroy(), palMutexLock() & palMutexUnlock, to handle any named mutex objects. It is recommended to implement a separate code for shared memory case if it is necessary.
  • Remove old routines palProtect() and palUnprotect().
  • Implement new routines palGetThreadId() and palGetProcessId().
  • Implement new routine palSleep().
  • Update synchronization routines, palCreateNID(), palDeleteNID(), palWait() & palNotify(), to support sharing of the synchronization objects among multiple processors.
  • Optionally, implement new routine palLog() as a logging utility for PAL and Runtime.

Runtime

  • Edit srcfg.h file to configure the shared memory management. By default, shared memory is disabled. If you decide to enable shared memory, you also need to configure the sizes and max number of memory blocks. New runtime module srmem uses these configurations to allocate and manage shared dynamic pool memory.

Host-based TargetApps using s2shostapptrt

  • A new routine, HostAppSetMaster(), has been added to s2shostapptrt library. This routine needs to be called from the process that starts the runtime thread, srThread, before calling HostAppRun(). Usually within a multi-process target, the "master" process or the daemon calls this routine.