HPlogo HP C/HP-UX Programmer's Guide: HP 9000 Computers > Chapter 8 Threads and Parallel Processing

Memory Classes

» 

Technical documentation

Complete book in PDF

 » Table of Contents

In order to use memory classes in C programs, you must include the header file /usr/include/spp_prog_model.h. Memory classes are described in the Parallel Programming Guide for HP-UX Systems.

In C, the general form for assigning memory is:

#include <spp_prog_model.h>

. . .

[storage_class_specfier] memory_class_name type_specifier namelist

where:

storage_class_specifier

specifies a non-automatic storage class

memory_class_name

is thread_private or node_private

type_specifier

is a data type (for example, int or float)

namelist

is a comma-seperated list of variables and/or arrays of type type_specifier

Data objects that are assigned a memory class must have a static storage duration. If the object is declared within a function, it must have the storage class extern or static. Data objects declared at file scope and assigned a memory class need not specify a storage class.

A hypernode is a set of processors and physical memory organized as a symmetric multiprocessor (SMP) running a single image of the operating system microkernel.

node_private

This storage class specifier causes the variables and arrays specified in namelist to be replicated in the physical memory of each hypernode on which the process is executing. While each data object has a single image in virtual memory, it maps to a different physical location on each hypernode. The threads of a process within a hypernode all share access to the copy on their hypernode and cannot access the copies on other hypernodes.

thread_private

This storage class specifier causes the variables and arrays to be treated as thread_private. These data objects map to unique node_private addresses for each thread of a process. Refer to the Parallel Programming Guide for HP-UX Systems for more information.

© Hewlett-Packard Development Company, L.P.