Database Implementation on an Object-Oriented Processor Architecture
Total Page:16
File Type:pdf, Size:1020Kb
DATABASE IMPLEMENTATION ON AN OBJECT-ORIENTED PROCESSOR ARCHITECTURE A thesis submitted in partial fulfilment of the requirements of the University of Abertay Dundee for the degree of Doctor of Philosophy Louis David Natanson University of Abertay Dundee July 4, 1995 I certify that this thesis is the true and accurate version of the thesis approved by the examiners. Director of Studies Abstract The advent of an object-oriented processor, the REKURSIV, allowed the possibility of investigating the application of object-oriented techniques to all the levels of a software system’s architecture. This work is concerned with the implementation of a database system on the REKURSIV. A database system was implemented with an architecture structured as • An external level provided by DEAL, a database query language with functions. • A conceptual level consisting of an implementation of the relational algebra. • an internal level provided by the REKURSIV system. The mapping of the external to the conceptual levels is achieved through a recursive descent interpreter which was machine generated from a syntax specification. The software providing the conceptual level was systematically derived from a formal algebraic specification of the relational algebra. The internal level was experimentally investigated to quantify the na ture of the contribution made to computational power by the REKURSIV’s architectural innovations. The contributions made by this work are: • the methodology exposed for program derivation (in class based lan guages) from algebraic specifications; • the treatment of the notion of domain within formal specification; • the development of a top-down parser generator; • the establishment of a quantitative perfomance profile for the REKUR SIV. Acknowledgem ents At a personal level I would like to thank Ian Colligan and Colin Fraser of the University of Abertay Dundee for their encouragement throughout. I thank Allan Milne for his intellectual robustness and curiosity and for realising that my only mode of communication is argument. Thanks also to Andy Wakelin for his insights and challenges. Most of all, at all levels intellectual and personal, for showing me this whole enjoyable side of life and patiently putting up with me, I thank Bill Samson my supervisor. 1 C o n t e n t s 1 Introduction 7 1.1 Background.................................................................................... 7 1.2 Scope of the s t u d y ........................................................................ 9 1.3 Objectives....................................................................................... 12 1.4 Sum m ary........................................................................................... 12 2 Literature review 16 2.1 Hardware........................................................................................... 17 2.1.1 Programming Language support..................................... 17 2.1.2 Database m achines..................................... 23 2.2 Database Query Languages .......................................................... 24 2.2.1 Deductive Database Systems................................................. 26 2.2.2 Functional, Deductive and Object-oriented Databases . 29 2.3 Program derivation............................................................................32 2 CONTENTS 3 2.4 Summary........................................................................................... 33 3 The REKURSIY 36 4 The language DEAL 44 4.1 Introduction........................................................................................44 4.2 Syntax.................................................................................................47 4.3 Using the DEAL interpreter............................................................52 4.4 Conclusion...........................................................................................55 5 Implementing the language 56 5.1 Introduction........................................................................................56 5.2 The topmost le v e ls........................................................................... 59 5.3 Function definitions............................................................................66 5.4 Expressions.................................................................................... 72 5.4.1 Expressions involving binary operators.......................... 75 5.4.2 Selection and Projection.................................................. 77 5.4.3 Link elements........................................................................ 83 5.4.4 Function Application............................................................90 5.5 The execution p h a s e ........................................................................ 91 5.5.1 Binary Operators.................................................................. 92 5.5.2 The Unary operators............................................................ 94 CONTENTS 4 5.5.3 Variables and C onstants......................................................94 5.5.4 Function Application............................................................ 95 5.5.5 Statements ............................................................................96 5.6 A complete ex a m p le........................... 97 5.7 Sum m ary......................................................................................... 100 6 Specification of the Relational Algebra 101 6.1 Introduction...................................................................................... 101 6.2 Formal techniques.............................................................................102 6.3 Deriving programs from algebraic specifications........................ 112 6.4 Specifying the Relational Algebra.................................................120 6.5 Specifying a relational operator....................................................123 6.6 Efficiency and refinement................................................................ 127 6.7 2-3 trees............................................................................................ 131 6.8 Query optimisation..........................................................................142 6.9 Conclusion......................................................................................... 146 7 Performance evaluation 148 7.1 Harland’s claims .............................................................................148 7.2 A preliminary experim ent............................................................. 150 7.3 Medium scale benchmarks 154 CONTENTS 5 7.4 Large scale benchmarks....................................................................170 7.4.1 H ashing................................................................................. 170 7.4.2 AVL Trees..............................................................................174 8 Conclusions 177 8.1 Qualitative results ...........................................................................177 8.2 The use of the REKURSIV for database w ork ............................. 179 8.3 The verdict on the REKURSIV.....................................................182 8.4 The failure...........................................................................................184 8.5 The future...........................................................................................185 A Code for the preliminary experiment 205 B An SML specification 213 C Implementing Interpreters 224 C.l Introduction.......................................................................................224 C.2 An exam ple.......................................................................................225 C.3 Translation.......................................................................................231 C.3.1 Grammars.............................................................................231 C.3.2 Lexical Analysis....................................................................232 C.3.3 The syntax analyser ............................................................236 \ CONTENTS_____________________________________________________ 6 C.3.4 Adding semantic and interpretive actions..........................242 C.4 An interpreter generator................................................................... 244 C.5 Sum m ary............................................................................................253 D An SML specification based on 2—3 trees 255 C h a p t e r 1 Introduction 1.1 B ackgr ound In November 1988, Dundee Institute of Technology won a grant under the Department of Trade and Industry’s Awareness Initiative in Object-oriented programming. The grant included the award of a REKURSIV processor [52] board (manufactured by Linn Smart Computing, Glasgow) to be hosted on a Sun workstation. The aim of the initiative was to develop applications software to run on REKURSIV systems. Workers at the Institute had for several years been actively cooperating with workers at other institutions in the development of a relational lan guage DEAL (DEductive ALgebra) [26]. This work had included both query 7 CHAPTER 1. INTRODUCTION 8 language implementation and application : HQL ( an Historical Query Lan guage) [90] and Graphical Databases [112]. Given this experience the natural goal of the group was to work on DEAL in the context of the REKURSIV. The language DEAL makes use of an extended relational algebra. The extensions aim to provide facilities useful to knowledge