Real time System ExecutivesBy Youssef Edward
June 25, 2019
A real time executive is analogues to operating systems in computers. Its purpose is to manage resources and process in the real time embedded system. This includes starting and stopping a new process, memory allocation, processor resource allocation, etc. However, in real time embedded systems, real time executive is simpler than operating systems for general purpose computers.
Real time Process Allocation
Mainly process allocation in real time systems is the processor dynamics to start or stop new process according to the stimulus (external events from surrounding environments). Upon each event, the process or senses the change according to changing a variable in one or more of registers (RAM or SFR) and then calls the appropriate routines that describe the process.
Note that the word “process” in real time embedded systems is simpler than in general purpose computers. In real time systems it just means a set of routines that calls each other. in general purpose computer, it may means a visual interface that is displayed to the user and can accept commands or any other program that runs on the background either by the user or by the kernel.
The process that is operated by the executive in real time system is the main loop that poll for events. This cannot be stopped by the user in any way. Otherwise, the system malfunctions. Any external events will result in new processes to start until the event is handled then it terminates. Once terminated, it is the role of the executive to manage the resources of memory and do the proper clean. This is necessary to save memory upon time.
Memory allocation is an important function of the real time executive. Upon time new processes are started and new processes are terminated. Processes that start need memory space to store variables and old processes contain variables that are no longer needed.
The concept of dynamic memory allocatin in C language demonstates the technique of memeory allocation. There are four main functions as follow:
- void *calloc(int num, int size); This function allocates an array of number of elements equal to num each of whose size in bytes will be size.
- void free(void *address); This function release a block of memory block specified by address.
- void *malloc(int num); This function allocates an array of bytes whose length equal to num and leave them initialized.
- void *realloc(void *address, int newsize); This function re-allocates memory extending it up to newsize.
Understanding those functions programmatically allows you to understand how the executive do the memory allocation.
Components of the Executive:
- Real time clock: this provides information to schedule processes with respect to time.
- Interrupt handler: this manages aperiodic request for services or processes.
- Scheduler: this examines the process that can be executed and choose the one with top priority.
- Resource Manager: given a process that is ready for execution, the resource manager allocate memory and processor resources.
- Dispatcher : this component is responsible for starting the execution of a process.