Stack safe parallel recursion with paraffin

  • Authors:
  • Bradley J. Moore

  • Affiliations:
  • General Dynamics Canada, Calgary, AB, Canada

  • Venue:
  • SIGAda '11 Proceedings of the 2011 ACM annual international conference on Special interest group on the ada programming language
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recursion is a programming technique in which a solution can be expressed by a subroutine invoking itself either directly or indirectly. Many problems can be expressed simply using a recursive approach, however one of the drawbacks of using recursion is that it requires a stack, and often one does not know how much stack space is needed to obtain a recursive result. Stack overflow often results in spectacular failure with strange, often unrepeatable behaviour. Paraffin is a suite of generic units that can add parallelism to iterative and recursive problems. Some of the generics involve a load balancing technique described as "work-seeking". It was found that the recursive work seeking algorithm could be extended to also provide stack safety whereby the generics monitor the amount of remaining stack space and avoid stack overflow using a technique similar to load balancing. The stack safety feature also makes it attractive to consider Paraffin for use with code destined for execution on a single core. This paper describes how the recursive work-seeking algorithm was extended to provide the stack-safety feature, and then goes on to report some performance results using the generics.