Is It Ever Useful to Be Confident That a Problem Is Hard?

Total Page:16

File Type:pdf, Size:1020Kb

Is It Ever Useful to Be Confident That a Problem Is Hard? CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Menu • Complexity Question Lecture 9: • Low-Level Programming Low-Level Exam 1 Out Wednesday, Due Monday, 11:01AM Programming Covers everything through Lecture 8 Expect questions on: order notation, algorithm analysis, lists, trees, recursive programming, dynamic programming, greedy algorithms Not on complexity classes (Lecture 8) http://www.cs.virginia.edu/cs216 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 2 Problem Classes if P ≠ NP: Sequence NP Alignment: O(n2) How many problems are in the Θ(n) class? P infinite Is it ever useful to be NP-Complete How many problems are in P but not O( n) in the Θ(n) class? confident that a problem is Note the infinite NP- How many problems Complete hard? are in NP but not class is a in P? ring – others infinite are circles Interval Scheduling: Subset Sum Θ(n log n) 3SAT UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 3 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 4 Knapsack Cipher Subset Sum is Hard [Merkle & Hellman, 1978] • Public Key: A = {a1, a2,…,an} • Given s and A it is NP-Complete to – Set of integers find a subset of A that sums to s • Plain Text: x1,…xn xi = 0 or 1 • Cipher Text: n = • Need to make decrypting each (for s ∑ xiai recipient with the “private key”) i=1 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 5 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 6 1 Superincreasing Set Knapsack Ciphers • Private Key = {p1, p2,…,pn} • Pick {a1, a2,…,an} is a superincreasing – A superincreasing sequence sequence – Values M and W: i−1 > n ai ∑ aj M > ∑bi j=1 i=1 GCD (M ,W ) =1 How hard is subset sum if A • Public Key = {a , a ,…, a } is superincreasing? 1 2 n ai ≡ (biW ) mod M UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 7 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 8 Flawed Security Argument Levels of Abstraction: Program Real World Problem • Subset Sum is NP-Complete High-Level Program • Breaking knapsack cipher involves Physical World solving a subset sum problem • Therefore, knapsack cipher is secure World Flaw: NP-Complete means there is no Virtual fast general solution . Some instances Machine Instructions may be solved quickly. (Note: Adi Shamir found a way of breaking Physical knapsack cipher [1982]) Processor From Lecture 3 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 9 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 10 Crossing-Levels Python Program C Program C compiler Programming Languages x86 Instructions Python Interpreter x86 Instructions UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 11 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 12 2 Fortran (1954), IBM (Backus) Algol (1958) LISP (1957) BASIC (1963) CPL (1963), U Cambridge Scheme (1975) Combined Programming Language Why so many Simula (1967) BCPL (1967), MIT Basic Combined Programming Language Programming Languages? ABC (~1980) B (1969), Bell Labs Smalltalk (1971), PARC C (1970), Bell Labs C++ (1983), Bell Labs Objective C Python (1990), Guido van Rossum Programming Languages Java (1995) Phylogeny (Simplified) UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 13 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 14 “Jamais Jamais Jamais” from Harmonice Musices “Jamais Jamais Jamais” from J S Bach, “Coffee Cantata”, Odhecaton A. Printed by Ottaviano Dei Petrucci in Harmonice Musices Odhecaton A. BWV 211 (1732) 1501 (first music with movable type) (1501) www.npj.com/homepage/teritowe/jsbhand.html UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 15 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 16 Modern Music Notation Roman Haubenstock- John Cage, Fontana Mix Ramati, Concerto a Tre http://www.medienkunstnetz.de/works/fontana-mix/audio/1/ UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 17 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 18 3 Thought and Action Abstractions • Languages change the way we think • Higher level abstractions – Scheme: think about procedures – Python, Java, BASIC, … – BASIC: think about GOTO – Easier to describe abstract algorithms – Algol, Pascal: think about assignments, control – But, cannot manipulate low-level machine blocks state – Java: think about types, squiggles, exceptions • How are things stored in memory? – Python? • Opportunities for optimization lost • Languages provide abstractions of machine • Lower level abstractions resources – C, C++, JVML, MSIL, Assembly, … – Hide dangerous/confusing details: memory – Harder to describe abstraction algorithms locations, instruction opcodes, number – Provides programmer with control over low- representations, calling conventions, etc. level machine state UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 19 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 20 Biggest Single Difference: Fortran (1954), IBM (Backus) Algol (1958) Memory Management LISP (1957) BASIC (1963) • High-level languages (Python, Java) CPL (1963), U Cambridge provide automatic memory Scheme (1975) Combined Programming Language Simula (1967) management BCPL (1967), MIT Basic Combined Programming Language – Programmer has no control over how memory is allocated and reclaimed ABC (~1980) B (1969), Bell Labs Smalltalk – Garbage collector reclaims storage (1971), PARC C (1970), Bell Labs • Low-level languages (C, Assembly) leave it up to the programmer to C++ (1983), Bell Labs Objective C manage memory Python (1990), Guido van Rossum Programming Languages Java (1995) Phylogeny (Simplified) UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 21 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 22 C Programming Language C Language • No support for: • Developed to build Unix OS – Array bounds checking • Main design considerations: – Null dereferences checking – Compiler size: needed to run on PDP-11 – Data abstraction, subtyping, inheritance with 24KB of memory (Algol60 was too big to fit) – Exceptions – Code size: needed to implement the whole – Automatic memory management OS and applications with little memory • Program crashes (or worse) when – Performance, Portability something bad happens • Little (if any consideration): • Lots of syntactically legal programs – Security, robustness, maintainability have undefined behavior UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 23 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 24 4 Fortran (1954) LET Example C Program Algol (1958) := void test (int x) { In Java: while (x = 1) { void test (int x) { printf (“I’m an imbecile!”); CPL (1963), U Cambridge := while (x = 1) { Combined Programming Language x = x + 1; printf (“I’m an imbecile!”); } x = x + 1; BCPL (1967), MIT } } := Basic Combined Programming Language } Weak type checking: > javac Test.java B (1969), Bell Labs = In C, there is no boolean type. Test.java:21: incompatible types Any value can be the test expression. found : int C (1970), Bell Labs = required: boolean x = 1 assigns 1 to x, and has the value 1. while (x = 1) { C++ (1983), Bell Labs = ^ I’m an imbecile! 1 error I’m an imbecile! Java (1995), Sun = I’m an imbecile! I’m an imbecile! UVa CS216 Spring 2006 - LectureI’m 9:an Low-Level imbecile! Programming 25 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 26 I’m an imbecile! = vs. := C Bounds Non-Checking int main (void) { > gcc -o bounds bounds.c int x = 9; Why does Python use = for assignment? > bounds char s[4]; abcdefghijkl • Algol (designed for elegance for presenting s is: abcdefghijkl (User input) gets(s); algorithms) used := x is: 9 printf ("s is: %s\n“, s); > bounds • CPL and BCPL based on Algol, used := printf ("x is: %d\n“, x); abcdefghijklm } • Thompson and Ritchie had a small computer to s is: abcdefghijklmn implement B, saved space by using = instead Note: your results x is: 1828716553 = 0x6d000009 may vary > bounds • C was successor to B (also on small computer) abcdefghijkln (depending on • C++’s main design goal was backwards s is: abcdefghijkln machine, compiler, x is: 1845493769 = 0x6e 000009 compatibility with C what else is > bounds • Python was designed to be easy for C and C++ aaa... [a few thousand characters] running, time of crashes shell programmers to learn day, etc.). This is what makes C fun! UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 27 UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 28 Charge • Wednesday: Exam 1 is out, due Monday • No regularly scheduled Small Hall and office hours while Exam 1 is out UVa CS216 Spring 2006 - Lecture 9: Low-Level Programming 29 5.
Recommended publications
  • Latest Results from the Procedure Calling Test, Ackermann's Function
    Latest results from the procedure calling test, Ackermann’s function B A WICHMANN National Physical Laboratory, Teddington, Middlesex Division of Information Technology and Computing March 1982 Abstract Ackermann’s function has been used to measure the procedure calling over- head in languages which support recursion. Two papers have been written on this which are reproduced1 in this report. Results from further measurements are in- cluded in this report together with comments on the data obtained and codings of the test in Ada and Basic. 1 INTRODUCTION In spite of the two publications on the use of Ackermann’s Function [1, 2] as a mea- sure of the procedure-calling efficiency of programming languages, there is still some interest in the topic. It is an easy test to perform and the large number of results ob- tained means that an implementation can be compared with many other systems. The purpose of this report is to provide a listing of all the results obtained to date and to show their relationship. Few modern languages do not provide recursion and hence the test is appropriate for measuring the overheads of procedure calls in most cases. Ackermann’s function is a small recursive function listed on page 2 of [1] in Al- gol 60. Although of no particular interest in itself, the function does perform other operations common to much systems programming (testing for zero, incrementing and decrementing integers). The function has two parameters M and N, the test being for (3, N) with N in the range 1 to 6. Like all tests, the interpretation of the results is not without difficulty.
    [Show full text]
  • ALGOL 60 Programming on the Decsystem 10.Pdf
    La Trobe University DEPARTMENT OF MATHEMATICS ALGOL 60 Programming on the DECSystem 10 David Woodhouse Revised, August 1975 MELBOURNE, AUSTRALIA ALGOL 60 Programming on the DECSystem 10 David Woodhouse Revised, August 1975 CE) David Woodhouse National Library of Australia card number and ISBN. ISBN 0 85816 066 8 INTRODUCTION This text is intended as a complete primer on ALGOL 60 programming. It refers specifically to Version 4 of the DECSystem 10 implementation. However, it avoids idiosyncracies as far as possible, and so should be useful in learning the language on other machines. The few features in the DEC ALGOL manual which are not mentioned here should not be needed until the student is sufficiently advanced to be using this text for reference only. Exercises at the end of each chapter illustrate the concepts introduced therein, and full solutions are given. I should like to thank Mrs. K. Martin and Mrs. M. Wallis for their patient and careful typing. D. Woodhouse, February, 1975. CONTENTS Chapter 1 : High-level languages 1 Chapter 2: Languagt! struct.ure c.f ALGOL 6n 3 Chapter 3: Statemp.nts: the se'1tences {'\f the language 11 Chapter 4: 3tandard functions 19 Chapter 5: Input an~ Outp~t 21 Chapter 6: l>rray~ 31 Chapter 7 : For ane! ~hil~ statements 34 Chapter 8: Blocks anr! ',: ock sc rll,~ turr. 38 Chapter 9: PrOCe(:l1-:-~S 42 Chapter 10: Strin2 vp·jaLlps 60 Chapter 11: Own v~rj;lI'.i..es clOd s~itc.hef, 64 Chapter 12: Running ~nd ,;ebllggi"1g 67 Bibliography 70 Solutions to Exercises 71 Appendix 1 : Backus NOlUlaj F\:q'm 86 Appendix 2 : ALGuL-like languages 88 Appenclix 3.
    [Show full text]
  • A History of C++: 1979− 1991
    A History of C++: 1979−1991 Bjarne Stroustrup AT&T Bell Laboratories Murray Hill, New Jersey 07974 ABSTRACT This paper outlines the history of the C++ programming language. The emphasis is on the ideas, constraints, and people that shaped the language, rather than the minutiae of language features. Key design decisions relating to language features are discussed, but the focus is on the overall design goals and practical constraints. The evolution of C++ is traced from C with Classes to the current ANSI and ISO standards work and the explosion of use, interest, commercial activity, compilers, tools, environments, and libraries. 1 Introduction C++ was designed to provide Simula’s facilities for program organization together with C’s effi- ciency and flexibility for systems programming. It was intended to deliver that to real projects within half a year of the idea. It succeeded. At the time, I realized neither the modesty nor the preposterousness of that goal. The goal was modest in that it did not involve innovation, and preposterous in both its time scale and its Draco- nian demands on efficiency and flexibility. While a modest amount of innovation did emerge over the years, efficiency and flexibility have been maintained without compromise. While the goals for C++ have been refined, elaborated, and made more explicit over the years, C++ as used today directly reflects its original aims. This paper is organized in roughly chronological order: §2 C with Classes: 1979– 1983. This section describes the fundamental design decisions for C++ as they were made for C++’s immediate predecessor. §3 From C with Classes to C++: 1982– 1985.
    [Show full text]
  • The BCPL Cintsys and Cintpos User Guide by Martin Richards [email protected]
    The BCPL Cintsys and Cintpos User Guide by Martin Richards [email protected] http://www.cl.cam.ac.uk/users/mr10/ Computer Laboratory University of Cambridge Revision date: Thu 19 Aug 16:16:54 BST 2021 Abstract BCPL is a simple systems programming language with a small fast compiler which is easily ported to new machines. The language was first implemented in 1967 and has been in continuous use since then. It is a typeless and provides machine independent pointer arithmetic allowing a simple way to represent vectors and structures. BCPL functions are recursive and variadic but, like C, do not allow dynamic free variables, and so can be represented by just their entry addresses. There is no built-in garbage collector and all input-output is done using library calls. This document describes both the single threaded BCPL Cintcode System (called Cintsys) and the Cintcode version of the Tripos portable operating system (called Cintpos). It gives a definition of the standard BCPL language including the recently added features such as floating point expressions and constructs involving operators such as <> and op:=. This manual describes an extended version of BCPL that include some of the features of MCPL, mainly concerning the pattern matching used in function definitions. This version can be compiled using the mbcpl command. This manual also describes the standard library and running environment. The native code version of the system based on Sial and the Cintpos portable operating system are also described. Installation instructions are included. Since May 2013, the standard BCPL distribution supports both 32 and 64 bit Cintcode versions.
    [Show full text]
  • The BCPL Reference Manual
    MASSACHUSETTS INSTITUTE OF TECHNOLOGY PROJECT MAC Memorandum-M-352 July 21, 1967 To: Project MAC Participants From: Martin Richards Subject: The BCPL Reference Manual ABSTRACT BCPL is a simple recursive programming language designed for compiler writing and system programming: it was derived from true CPL (Combined Programming Language) by removing those features of the full language which make compilation difficult namely, the type and mode matching rules and the variety of definition structures with their associated scope rules. 0.0 Index 1.0 Introduction 2.0 BCPL Syntax 2.1 Hardware Syntax 2.1:1 BCPL Canonical Symbols 2.1.2 Hardware Conventions and Preprocessor Rules 2.2 Canonical Syntax 3.0 Data Items 3.1 Rvalues, Lvalues and Data Items 3.2 Types 4.0 Primary Expressions 4.1 Names 4.2 String Constants 4.3 Numerical Constants 4.4 True and False 4.5 Bracketted Expressions 4.6 Result Blocks 4.7 Vector Applications 4.8 Function Applications 4.9 Lv Expressions 4.10 Rv Expressions 5.0 Compound Expressions 5.1 Arithmetic Expressions 5.2 Relational Expressions 5.3 Shift Expressions 5.4 Logical Expressions 5.5 Conditional Expressions 6.0 Commands 6.1 Assignment Commands 6.2 Simple Assignment Commands 6.3 Routine Commands 6.4 Labelled Commands 6.5 Goto Commands 6.6 If Commands 6.7 Unless Commands 6.8 While Commands 6.9 Until Commands 6.10 Test Commands 6.11 Repeated Commands 6.12 For Commands 6.13 Break Commands 6.14 Finish Commands 6.15 Return Commands 6.16 Resultis Commands 6.17 Switchon Commands 6.18 Blocks 7.0 Definitions 7.1 Scope Rules 7.2 Space Allocation and Extent of Data Items 7.3 Global Declarations 7.4 Manifest Declarations 7.5 Simple Definitions 7.6 Vector Definitions 7.7 Function Definitions 7.8 Routine Definitions 7.9 Simultaneous Definitions 8.0 Example Program 1.0 Introduction 1.
    [Show full text]
  • The Development of the C Languageߤ
    The Development of the C Languageߤ Dennis M. Ritchie Bell Labs/Lucent Technologies Murray Hill, NJ 07974 USA [email protected] ABSTRACT The C programming language was devised in the early 1970s as a system implementation language for the nascent Unix operating system. Derived from the typeless language BCPL, it evolved a type structure; created on a tiny machine as a tool to improve a meager programming environment, it has become one of the dominant languages of today. This paper studies its evolution. Introduction This paper is about the development of the C programming language, the influences on it, and the conditions under which it was created. For the sake of brevity, I omit full descriptions of C itself, its parent B [Johnson 73] and its grandparent BCPL [Richards 79], and instead concentrate on characteristic elements of each language and how they evolved. C came into being in the years 1969-1973, in parallel with the early development of the Unix operating system; the most creative period occurred during 1972. Another spate of changes peaked between 1977 and 1979, when portability of the Unix system was being demonstrated. In the middle of this second period, the first widely available description of the language appeared: The C Programming Language, often called the ‘white book’ or ‘K&R’ [Kernighan 78]. Finally, in the middle 1980s, the language was officially standardized by the ANSI X3J11 committee, which made further changes. Until the early 1980s, although compilers existed for a variety of machine architectures and operating systems, the language was almost exclusively associated with Unix; more recently, its use has spread much more widely, and today it is among the lan- guages most commonly used throughout the computer industry.
    [Show full text]
  • The C Language the C Language C History BCPL C History C History
    The C Language C History Currently, the most Developed between 1969 and 1973 along The C Language commonly-used language for with Unix embedded systems Due mostly to Dennis Ritchie COMS W4995-02 ”High-level assembly” Designed for systems programming Prof. Stephen A. Edwards Very portable: compilers • Fall 2002 exist for virtually every Operating systems Columbia University processor • Utility programs Department of Computer Science Easy-to-understand • Compilers compilation • Filters Produces efficient code Fairly concise Evolved from B, which evolved from BCPL BCPL C History C History Martin Richards, Cambridge, 1967 Original machine (DEC Many language features designed to reduce memory PDP-11) was very small: Typeless • Forward declarations required for everything • Everything a machine word (n-bit integer) 24K bytes of memory, 12K • Designed to work in one pass: must know everything used for operating system • Pointers (addresses) and integers identical • Written when computers No function nesting Memory: undifferentiated array of words were big, capital equipment PDP-11 was byte-addressed Natural model for word-addressed machines Group would get one, • Now standard Local variables depend on frame-pointer-relative develop new language, OS addressing: no dynamically-sized automatic objects • Meant BCPL’s word-based model was insufficient Strings awkward: Routines expand and pack bytes to/from word arrays Euclid’s Algorithm in C Euclid’s Algorithm in C Euclid on the PDP-11 .globl gcd GPRs: r0–r7 int gcd(int m, int n ) “New syle” function int gcd(int m, int n ) Automatic variable .text r7=PC, r6=SP, r5=FP { declaration lists { Allocated on stack gcd: int r; number and type of int r; when function jsr r5, rsave Save SP in FP arguments.
    [Show full text]
  • The Algol Family And
    The Algol family and SML INF 3040 INF - Volker Stolz 2020 [email protected] Department of Informatics – University of Oslo Initially by Gerardo Schneider. Based on John C. Mitchell’s slides (Stanford U.) 18.09.20 IN3040 – ML 1 SML lectures ! 18.09: The Algol Family and SML (Mitchell’s chap. 5) ! 25.09: More on ML & Types (chap. 5 and 6) IN3040 - ! 16.10: More on Types, Type Inference and 2020 Polymorphism (chap. 6) ! Control in sequential languages, Exceptions and Continuations (chap. 8) ! Prolog I / Prolog II 18.09.20 IN3040 – ML 1 Outline (Mitchell, Chapter 5) ! Brief overview of Algol-like programming languages Algol 60/Algol 68 • Pascal/Modula IN3040 • C - ! Basic SML 2020 ! Noteworthy this year: • You may use Haskell instead of SML in exercises and the exam! (*) • I will prepare short video snippets showing the differences. • (*) Terms and conditions apply! Don’t use Haskell-”power features”, we’ll only admit the Haskell-equivalents of SML-constructs (ie., no “do”-notation, language extensions, infinite data structure) 18.09.20 IN3040 – ML 1 A (partial) Language Sequence Lisp (McCarthy, MIT) Algol 60 late 50s Algol 68 IN3040 Simula - Pascal 2020 ML Modula Many other languages in the “family”: Algol 58, Algol W, Euclid, Ada, Simula 67, BCPL, Modula-2, Oberon, Modula-3 (DEC), Delphi, … 18.09.20 IN3040 – ML 1 Algol 60 ! Designed: 1958-1963 (J. Backus, J. McCarthy, A. Perlis,…) ! General purpose language. Features: • Simple imperative language + functions • Successful syntax, used by many successors IN3040 – Statement oriented - – begin … end blocks (like C { … } ) (local variables) 2020 – if … then … else • BNF (Backus Normal Form) – Became the standard for describing syntax • ALGOL became a standard language to describe algorithms.
    [Show full text]
  • Learning Algol 68 Genie
    LEARNING ALGOL 68 GENIE Algol 68 Genie 2.0.0 (September 2010) Edited by Marcel van der Veer Learning Algol 68 Genie copyright c Marcel van der Veer, 2008-2010. Algol 68 Genie copyright c Marcel van der Veer, 2001-2010. Learning Algol 68 Genie is a compilation of separate and independent documents or works, consisting of the following parts: I. Informal introduction to Algol 68, II. Programming with Algol 68 Genie, III. Example a68g programs, IV. Algol 68 Revised Report, V. Appendices Part I, II, III and V are distributed under the conditions of the GNU Free Documenta- tion License: Permission is granted to copy, distribute and / or modify the text under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. See http://www.gnu.org. Part IV is a translation of the Algol 68 Revised Report into LATEX and is therefore subject to IFIP’s condition contained in that Report: Reproduction of the Report, for any purpose, but only of the whole text, is explicitly permitted without formality. Chapter 20, "Specification of partial parametrization proposal", is not a part of the Algol 68 Revised Report, and is distributed with kind permission of the author of this proposal, C.H. Lindsey. IBM is a trademark of IBM corporation. Linux is a trademark registered to Linus Torvalds. Mac OS X is a trademark of Apple Computer.
    [Show full text]
  • Language Design Is LEGO Design and Library Design
    Language Design is LEGO Design and Library Design Stephen A. Edwards Columbia University Forum on Specification & Design Languages Southampton, United Kingdom, September 3, 2019 User-defined functions and pointers in imperative languages Language design choices are often heavily influenced by processor architectures. Understand the processor to understand the language Best to understand how to compile a feature before adding it to the language 1954: The IBM 704 Electronic Data-Processing Machine 36-bit Integer & Floating-point ALU 36-bit instructions Core: 4–32K words Incubated FORTRAN and LISP “Mass Produced”: [IBM 704 Manual of Operation, 1955] IBM sold 125 @ $2M ea. 1954: IBM 704 Processor Architecture 3 15-bit Index Registers 38-bit Accumulator 36-bit M-Q Register 15-bit Program Counter 1954: Calling a Subroutine on the IBM 704 TSX SINX, C Branch to SINX, remember PC in index register C TRA 2, C Return to 2 words past address in index register C 1954: FORTRAN 1954: FORTRAN — J. W. Backus, H. Herrick, and I. Ziller. Specifications for the the IBM Mathematical FORmula TRANslating System. IBM, November 10, 1954. 1957: FORTRAN I on the IBM 705 1, 2, 3D arrays Arithmetic expressions Integer and floating-point Loops and conditionals User-defined functions: expressions only [Programmer’s Primer for FORTRAN Automatic Coding System for the IBM 704, 1957] 1957: FORTRAN I User-Defined Functions Free variables are globals No recursion; backward references only No arrays “Activation Records” allocated statically 1957: EQUIVALENCE Statement for Sharing
    [Show full text]
  • DISCLAIMER This Document Was Prepared As an Account of Work
    DISCLAIMER This document was prepared as an account of work sponsored by the United States Government. While this document is believed to contain correct information, neither the United States Government nor any agency thereof, nor the Regents of the University of California, nor any of their employees, makes any warranty, express or implied, or assumes any legal responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by its trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or the Regents of the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof or the Regents of the University of California. : •.. :. March 1980 Fortran Newsletter Volmte 6, NlIDber 1, Page 1 =FOR-WORD=> X3J3 To Cmsider Real-Time arxl GraIitics Applications As Second arxl 'lhird Exanples of Applicatioo ~ules X3J3, the Technical Committee for Fortran under ANSI (American National Standards Institute) has maintained oontinuing liaison with U.S. and international Committees interested in Real-Time Applica­ tions of Fortran. At the most recent meeting of X3J3 (January 1980), an ad hoc Task Group was formed as a precursor to a formal Task Group (X3J3.2) on Control of Multi-Tasking-SYstems. This group will coordinate its \o,Ork closely with that of the Instrument Society of America (ISA), which has been work­ ing on standards in the process-control area, and with the work of the European Workshop on Industrial Control Systems (EWICS).
    [Show full text]
  • The C Language the C Language C History BCPL C History C History
    The C Language The C Language Currently, the most commonly-used language for embedded systems “High-level assembly” Prof. Stephen A. Edwards Very portable: compilers exist for virtually every processor Easy-to-understand compilation Produces efficient code Fairly concise Copyright © 2001 Stephen A. Edwards All rights reserved Copyright © 2001 Stephen A. Edwards All rights reserved C History BCPL Developed between 1969 and 1973 along with Unix Designed by Martin Richards (Cambridge) in 1967 Due mostly to Dennis Ritchie Typeless Designed for systems programming • Everything an n-bit integer (a machine word) • Pointers (addresses) and integers identical • Operating systems • Utility programs Memory is an undifferentiated array of words • Compilers Natural model for word-addressed machines • Filters Local variables depend on frame-pointer-relative Evolved from B, which evolved from BCPL addressing: dynamically-sized automatic objects not permitted Strings awkward • Routines expand and pack bytes to/from word arrays Copyright © 2001 Stephen A. Edwards All rights reserved Copyright © 2001 Stephen A. Edwards All rights reserved C History C History Original machine (DEC PDP-11) Many language features designed to reduce memory was very small • Forward declarations required for everything • 24K bytes of memory, 12K used • Designed to work in one pass: must know everything for operating system • No function nesting Written when computers were big, capital equipment PDP-11 was byte-addressed • Group would get one, develop new language, OS • Now standard
    [Show full text]