Semester : SEMESTER 6
Subject : Embedded System
Year : 2018
Term : MARCH
Scheme : 2015 Full Time
Course Code : EC 308
Page:47
= 8.5 MEMORY MANAGEMENT
8.5.1 Memory Allocation
When a process is created, the memory manager allocates the memory addresses (blocks) to it by mapping the
process address space (Section 7.1). Threads of a process share the memory space of the process (Section 7.2).
8.5.2 Memory Management after Initial Allocation
The memory manager of the OS has to be secure, robust and weil protected. There must be control such that
there are 70 memory leaks and stack overflows. Memory leaks mean attempts to write in the memory block
not allocated to a process or data structure. Stack overflow means that the stack exceeds the allocated memory
block(s) when there is no provision for additional stack space. Table 8.5 gives memory-management strategy.
Example 8.6
An OS provides for dynamic memory allocation and de-allocation functions. Dynamic memory allocation
is used for creating memory address space for a buffer or a messages queue or some other purpose during
execution of a task. Dynamic memory de-allocation is used for freeing the memory taken up for the buffer
during execution of the task.
Consider fragmented physical memory allocations. Fragmented means that memory addresses in two
variable-size blocks of a process are not continuous. When a block of memory address is allocated, the
time is spent in first locating the next free memory addre:
ss before allocating that to the process. A standard
memory allocation scheme scans a linked list of indeterminate length to find a suitable free memory
y block.
When one allotted block of memory is de-allocated, the time is spent in first locating the next allocated
memory block before de-allocating that to the process. The time for allocation and de-allocation of the
memory and blocks are variable (not deterministic) when the block sizes are variable and when the memory
is fragmented. In RTOS, this leads to unpredictable task-performance (run-time).