Previous: Global Pointers Up: Global Pointers Next: Dereferencing Global Pointers

Introduction

We have introduced distributed computations as those using several address spaces, and defined a processor object to be an address space. We postpone a detailed explanation of how these processor objects are defined and created until Chapter . In this chapter we discuss how global pointers are used to communicate data between processor objects, assuming the processor objects have been created.

In CC++ there are two types of pointers: global pointers and local pointers. Global pointers can reference addresses in any processor object in the computation. Local pointers can only reference addresses in the processor object in which they are created. Global pointers identify data that is expensive to access, while local pointers identify data that is inexpensive to access.

Global pointers are used much like local pointers. When a global pointer is dereferenced, the value it references is returned. If the global pointer references an object, member functions can be invoked through the pointer. In both these cases, since the object resides on another processor object, an implicit communication is performed to fetch the value or call the function.

Global pointers are declared by using the keyword global to modify a pointer declaration. Here are some examples of declarations of global pointers:


int *global gpint;    // global pointer to an integer
int * *global gppint; // global pointer to a local pointer to an integer
C *global gpC;        // global pointer to an object of type C

Global pointers can reference basic types and user-defined structures, but in the current implementation they may not reference functions. Thus we may not declare


int (*global gpf)(); // ERROR -- global pointer to function returning int

paolo@cs.caltech.edu