Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
wiki1115: Memory_Partitioning_Technology (Version 9)

Adaptive Partitioning - Memory #

Aka APM

What is it?#

It's a flexible, per memory class partitioning mechanism that allows for the independent specification of both memory resource guarantees (reservations) and restrictions for each process in a running system.

Memory Partitioning is part of an overall resource partitioning strategy. See Adaptive Partitioning.

Table of Contents#

  1. QNX Designer's Documentation
  1. Hacking
    • Where to find the source code - coming soon
    • How to build APM - coming soon
  2. Links to user documention:

FAQ#

Please note that additional detail on most, if not all of the following FAQ's can be answered by reading Memory Partitioning - Design and Architecture Overview.

What do you mean by a memory class?#

In the context of memory partitioning, a memory class refers specifically to an independently partition-able segment of non-overlapping memory. The segments are established at startup and refer to the syspage asinfo entries (visible with pidin syspage=asinfo). The system architect is free to ascribe any attributes or purpose to the memory segments (with the exception of the sysram which is the class used for general allocations) as memory partitioning does not impose any such attributes. Once defined in startup, and subsequently added to the partitioning name space, each of these segments is referred to as a class (or type if you prefer) for the purpose of partitioning and allocation/deallocation. The sysram memory class is special, in that it always exists and is used for internal (kernel) allocations as well as unspecified (un-typed) allocations.

Example:

Let's suppose a custom board had some SRAM implemented within an custom FPGA (which likely also had additional functionality which made use of the SRAM). This segment of memory would reside at a particular physical address and would be considered a different class of memory, not only because it truly has different storage attributes (faster, and perhaps smaller than the DRAM used for general storage) but also because it serves a different purpose within the system. Also suppose that there are several independent processes which all wished to allocate portions of the memory class but that some of these processes were more important than others. Memory partitioning could be used to partition this memory class into several partitions, perhaps of different size and type and allow the processes requiring this memory class to be independently associated with specific partitions. The more important processes could be guaranteed to have access to the configured amounts of this memory class independent of any other memory classes it required or the demands of other processes. All of the processes could be "coded" the same way to simply allocate memory of the specified class without any of the interprocess coordination that would otherwise be required to ensure the priority of allocation to more important processes.

How do I allocate memory of a different class?#

We (currently) rely on the POSIX typed memory interfaces for this.

How can I use this?#

See the Example above under What do you mean by a memory class?

What is the difference between the minimum size attribute and the maximum size attribute?#

The minimum size attribute establishes a reservation or guarantee for allocations made by processes associated with the partition. The maximum size attribute establishes a restriction on allocations made by processes associated with the partition.

What is the sysram memory class?#

The sysram (system ram) memory class is a permanent memory class which is used for all un-specified (un-typed) memory allocations. When your process does malloc(), you are implicitly requesting an allocation of the the system ram memory class. See also What do you mean by a memory class?

What is the system partition and what is it used for?#

The system partition is a permanent partition of the sysram memory class. Unless otherwise specified, all process will be associated with the system partition. That is, without specifically associating with a different sysram memory class, all processes will be associated with the system partition for their sysram memory class (ie. malloc and friends) allocations. Note that although the partition is only visible when the memory partitioning module is installed, conceptually it always exists. In fact without memory partitioning, you effectively have the equivalent of a single class, single partition system with a minimum size of 0 and a maximum size of infinity.

What is the minimum size attribute used for?#

When a partition is created/modified, a non-zero minimum size attribute indicates that the specified amount of memory for the class should be set aside (reserved) for future allocations by processes associated with the partition. See also What is reserved memory?

What is the maximum size attribute used for?#

When a partition is created/modified, the maximum size attribute will specify a limit on the amount of memory that can be allocated by all processes associated with the partition. Don't worry, you can specify infinity for this attribute ... but you'll still only get as much memory as is physically available ... but 'ya know what's cool ... if you dynamically expand your physical memory, you'll be able to just use it. See also What is discretionary memory?

What is reserved memory?#

Reserved memory is memory of a specific class that has been set aside (in the allocator for that class) during partition creation/modification. It represents a guarantee. In other words, a processes associated with a partition with a non-zero minimum size attribute are guaranteed successful allocation of memory of that class. See also Memory Partitioning - Design and Architecture Overview

What is discretionary memory?#

Discretionary memory is memory that you may or may not have access to, depending on your system wide partition configuration and the behaviour of other processes in the system. From a partitioning perspective, its is the numerical difference between the maximum size attribute and the minimum size attribute. See Memory Partitioning - Design and Architecture Overview for a pretty good description of the types of partitions that can be configured and how they might be used.

What about internal allocations like page tables and timers? How do you handle that smart guys?#

Ok, this is a tough one, but we do have an answer. In fact all of the internal (kernel) allocations in the system are subject to the same partitioning rules as for user space allocations. Since most of the internal allocations are being performed on behalf of some process, we simply figure out what partition that the requesting process is associated with, apply the partitioning rules, and either fail or pass the request. In fact procnto (a process) is subject to the system partition rules as any other process for its sysram allocations (which are governed by the system partition).

One more thing. Currently, all internal (kernel object) allocations use the sysram memory class by default so the sysram partition for each process will govern the allocation of the kernel objects it needs (like page tables) ... but in the future, we might even allow you to specify that yourself ; )

It sounds easy but its actually a bit tricky to implement.

And that's how we help stop you from fork()'ing yourself!

When will this be released?#

We're working on it. The likely time frame will be Jan 2008 and it will be released as part of the overall adaptive partitioning package.

Can memory partitioning and scheduling partitioning be used together?

Yes!

Can memory partitioning and scheduling partitioning be used separately?

Yes!