5. Dynamic Shared Memory Allocation

  1. Tarek El-Ghazawi1,
  2. William Carlson2,
  3. Thomas Sterling3 and
  4. Katherine Yelick4

Published Online: 27 JAN 2005

DOI: 10.1002/0471478369.ch5

UPC: Distributed Shared Memory Programming

UPC: Distributed Shared Memory Programming

How to Cite

El-Ghazawi, T., Carlson, W., Sterling, T. and Yelick, K. (2005) Dynamic Shared Memory Allocation, in UPC: Distributed Shared Memory Programming, John Wiley & Sons, Inc., Hoboken, NJ, USA. doi: 10.1002/0471478369.ch5

Author Information

  1. 1

    The George Washington University, USA

  2. 2

    IDA Center for Computing Sciences, USA

  3. 3

    California Institute of Technology, USA

  4. 4

    University of California at Berkeley, USA

Publication History

  1. Published Online: 27 JAN 2005
  2. Published Print: 13 MAY 2005

Book Series:

  1. Wiley Series on Parallel and Distributed Computing

Book Series Editors:

  1. Albert Y. Zomaya

ISBN Information

Print ISBN: 9780471220480

Online ISBN: 9780471478362



  • global shared memory space;
  • local shared spaces;
  • threads


In this chapter we discussed the three different ways to allocate shared storage space under UPC. The function upc_all_alloc() is a collective function that is called by all threads and allocates one shared space and returns one pointer to the allocated space to the threads. The function upc_global_alloc() is a non collective version of the upc_all_alloc(). Each calling thread gets a separate shared space and is returned a different shared pointer to that space. Finally, upc_alloc() is a non collective function. When called, each calling thread gets a pointer to a shared space with affinity to the calling thread, and a different pointer is returned to each calling thread. To free the previously allocated space, one can use upc_free().