Static Memory Management for Logic Programming Languages - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Static Memory Management for Logic Programming Languages

Description:

Static Memory Management for Logic Programming Languages ... Terms distributed over regions. Release the whole region at once. Basic idea. 1. RBMM: Practice ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 15
Provided by: Quan60
Category:

less

Transcript and Presenter's Notes

Title: Static Memory Management for Logic Programming Languages


1
Static Memory Management for Logic Programming
Languages
  • Quan Phan
  • DTAI Analysis group
  • Katholieke Universiteit Leuven, Belgium
  • Doctoral Consortium, ICLP 2006

2
Outline
  • Motivation
  • Memory management in logic programming
  • Literature on static memory management
  • My research
  • Research goal
  • Current status
  • Expected achievements

3
Memory management in logic programming
  • Logic programming is declarative
  • Focus on WHAT, not HOW
  • No malloc/free
  • Automatic management of the heap
  • Instant reclaiming
  • Rely on backtracking
  • Not enough deterministicshallow backtracking
  • Runtime garbage collection
  • Effectively recover, gt 90 of the garbage
  • Problem runtime overhead, time-unpredictable

4
1. Region-based memory management (RBMM)
Basic idea
The heap
  • Heap regions

X
.
  • Terms distributed over regions

.

1
  • Release the whole region at once

2
Y
.
3

.
Z
.
.
5
1. RBMM Practice
  • The compiler
  • decides about regions
  • and region lifetime
  • adds creation/removal instructions

6
1. RBMM
  • An extensive research field in functional
    programming
  • Mostly SML
  • Region inference is type-based analysis
  • More recently C, Cyclone, Java
  • For logic programming
  • application to WAM-based Prolog by Henning
    Makholm Kostis Sagonas
  • Focus runtime support for nondeterminism.
  • Borrow region inference from SML

7
2. Compile-time garbage collection (CTGC)
  • Idea instead of releasing, reuse allocated
    memory cells for new terms
  • Practice
  • CTGC for Mercury language
  • Structure sharing analysis, liveness analysis ?
    reusable cells
  • Reuse locally inside procedure

8
2. CTGC
  • append(X, Y, Z) -
  • (
  • X ,
  • Z Y
  • X gt Xe Xs,
  • append(Xs,Y,Zs),
  • Z lt Xe Zs
  • ).

X
.
1
1
.
.
2
2
Z
.
.

Y
.
3

9
Advantages of static approach
  • Performance
  • Reasoning is done at compile-time
  • Competitive runtime no or less RTGC needed
  • Always better performance? Non conclusive, due to
    locality, runtime overhead of new instructions,
    region management, but at least more
    time-predictable
  • Competitive memory consumption
  • Reuse or reclaim all the garbage memory
  • Let programs run in linear space

10
Research goal
  • Study the possibility and practicality of a
    hybrid memory management system that combines
    RBMM and CTGC.
  • How to combine?
  • Memory management is both theoretic and
    experimental
  • build and test systems in practice
  • a good thing, for which programs?

11
Current status First step
  • RBMM Analysis for Mercury
  • same context with the only CTGC system
  • The algorithm three phases
  • Region points-to analysis build the memory model
  • Region liveness analysis decide region lifetime
  • Source-to-source transformation add creation and
    removal instructions

12
Current status First step
  • More information
  • Quan Phan and Gerda Janssens. Towards
    Region-based Memory Management for Mercury
    programs. Proceedings of the Colloquium on
    Implementation of Constraint Logic Programming
    Systems, CICLOPS 2006, Seattle, USA, Aug. 2006.
  • Presentation at CICLOPS, 15h, Monday 21/8, in
    ???.

13
Ongoing work
  • Modular region analysis
  • Module system is critical for software
    engineering
  • A challenge
  • Region analysis is global
  • Research is little on this problem, only one work
    exists
  • Idea make the analysis local, allow callers to
    control callees behaviour.
  • More precise region points-to analysis
  • Study the hybrid system
  • The operation of CTGC when memory is organized in
    terms of regions
  • The cooperation among RBMM, CTGC and RTGC.

14
Expectation
  • A programming system
  • better memory footprint,
  • runtime overhead on memory task is reduced
  • flexible static memory management strategy
  • which strategy performs best for what kind of
    programs.
  • which combination often works effectively
Write a Comment
User Comments (0)
About PowerShow.com