You are on page 1of 10

Fundamentals of Computer Science

Macmillan Computer Science Series

Consulting Editor
Professor F. H. Sumner, University of Manchester

S.T. Allworth and R.N. Zobel, Introduction to Real-Time Software Design, second edition
Ian 0. Angell, A Practical Introduction to Computer Graphics
Ian 0. Angell and Gareth Griffith, High Resolution Graphics Using Fortran 77
R.E. Berry and B.A.E. Meekings, A Book on C
G.M. Birtwistle, Discrete Event Modelling on Simula
T.B. Boffey, Graph Theory in Operations Research
Richard Bornat, Understanding and Writing Compilers
J .K. Buckle, Software Configuration Management
W.D. Burnham and A.R. Hall, Prolog Programming and Applications
J.C. Cluley, Interfacing to Microprocessors
Robert Cole, Computer Communications, second edition
Derek Coleman, A Structured Programming Approach to Data
Andrew J. T. Colin, Fundamentals of Computer Science
Andrew J.T. Colin·, Programming and Problem-solving in Algo/68
S.M. Deen, Fundamentals of Data Base Systems
S.M. Deen, Principles and Practice of Data Base Systems
B. T. Denvir, Introduction to Discrete Mathematics for Software Engineering
P.M. Dew and K.R. James, Introduction to Numerical Computation in Pascal
M.R.M. Dunsmuir and G.J. Davies, Programming the UNIX System
K.C.E. Gee, Introduction to Local Area Computer Networks
J .B. Gosling, Design of Arithmetic Units for Digital Computers
Roger Hutty, Fortran for Students
Roger Hutty, Z80 Assembly Language Programming for Students
Roland N. Ibbett, The Architecture of High Performance Computers
Patrick Jaulent, The 68000- Hardware and Software
J.M. King and J.P. Pardoe, Program Design Using JSP- A Practical Introduction
H. Kopetz, Software Reliability
E. V. Krishnamurthy, Introductory Theory of Computer Science
V.P. Lane, Security of Computer Based Information Systems
Graham Lee, From Hardware to Software: an introduction to computers
A.M. Lister, Fundamentals of Operating Systems, third edition
G.P. McKeown and V.J. Rayward-Smith, Mathematics for Computing
Brian Meek, Fortran, PL/1 and the Algols
Barry Morrell and Peter Whittle, CP/M 80 Programmer's Guide
Derrick Morris, System Programming Based on the PDP//
Pim Oets, MS-DOS and PC-DOS - A Practical Guide
Christian Queinnec, LISP
W.P. Salman, 0. Tisserand and B. Toulout, FORTH
L.E. Scales, Introduction to Non-linear Optimization
Peter S. Sell, Expert Systems - A Practical Introduction
Colin J. Theaker and Graham R. Brookes, A Practical Course on Operating Systems
J-M. Trio, 8086-8088 Architecture and Programming
M.J. Usher, Information Theory for Information Technologists
Colin Walls, Programming Dedicated Microprocessors
B.S. Walker, Understanding Microprocessors
Peter J.L. Wallis, Portable Programming
I.R. Wilson and A.M. Addyman, A Practical Introduction to Pascal- with BS6192,
second edition
Fundamentals of
Computer Science
Andrew J. T. Colin
Professor of Computer Science,
University of Strathclyde

M
MACMILLAN
© Andrew J. T. Colin 1980

All rights reserved. No reproduction, copy or transmission


of this publication may be made without written permission.
No paragraph of this publication may be reproduced, copied
or transmitted save with written permission or in accordance
with the provisions of the Copyright Act 1956 (as amended).
Any person who does any unauthorised act in relation to
this publication may be liable to criminal prosecution and
civil claims for damages.

First published 1980


Reprinted 1982, 1983, 1986

Published by
MACMILLAN EDUCATION LTO
Houndmills, Basingstoke, Hampshire RG21 2XS
and London
Companies and representatives
throughout the world

ISBN 978-0-333-30503-4 ISBN 978-1-349-16350-2 (eBook)


DOI 10.1007/978-1-349-16350-2

The paperback edition of this book is sold subject to the condition that it shall
not, by way of trade or otherwise, be lent, resold, hired out, or otherwise
circulated without the publisher's prior consent in any form of binding or cover
other than that in which it is published and without a similar condition including
this condition being imposed on the subsequent purchaser.
Contents

Preface viii

1. Information
1.1 The Four Information Revolutions
1.2 Some Properties of Information 2
1.3 Coding 8

2. Information Inside Computers 12


2.1 Representation of Characters 12
2.2 Representation of Numbers 13
2.3 External Representations of Binary Numbers 21

3. The Basic Structure of a Computer 24


3.1 An Over-all View 24
3.2 Logic Networks 25
3.3 The Hydraulic Analogy 26
3.4 Electronic Circuitry 28
3.5 Truth Tables 29
3.6 Conversion between Truth Tables and Logic Networks 30
3.7 Propagation Time 36

4. The Implementation of Binary Arithmetic 37


4.1 Serial and Parallel Transmission of Words 37
4.2 Addition of Numbers 37
4.3 Subtraction of Numbers 41
4.4 The Multiplexer 41
4.5 Shifting Binary Numbers 43
4.6 An Arithmetic Unit 44

5. Sequential Networks 47
5.1 Storage Elements 47
5.2 Registers 51
5.3 Bus Structures 53
5.4 Register Transfer Notation 56

6. Immediate Access Stores 57


6.1 Random Access Memory 57
6.2 Read-only Memory 61
6.3 Timing 61

7. Introduction to SNARK 62
7 .I The SNARK Computer 62
7.2 The Basic Structure of the SNARK 63
7.3 Instructions 63
7.4 Address Modes 66
7.5 Input and Output 67

8. Jump Instructions on SNARK 69


8.1 Conditional Jumps 70
8.2 Flow Charts 71
8.3 Controlled Loops 73

9. Array Handling on SNARK 78


9.1 The Internal Format of SNARK Instructions 78
9.2 Index Modification 80
9.3 Table Look-up 81
9.4 Access to Entire Tables 82
9.5 Table Searching 83

10. Computers- the Grand Design 87


10.1 Sequences of Operations 87
10.2 Variable Sequences 92
10.3 Design of the SNARK 99

11. Backing Stores 120


11.1 Serial Storage 120
11.2 Cyclic Storage 123
11.3 Hierarchies of Stores 128

12. Peripheral Devices 129


12.1 Peripherals for Human Communication 129
12.2 Punched Paper 135
12.3 Links with Mechanical Systems 136
12.4 Communication 137
Contents vii

13. Software 139


13.1 S:ymbolic Assemblers 140
13.2 High-level Languages 141
13.3 Operating Systems 145
13.4 The Program library 145

14. Translators 147


14.1 Language Definition 147
14.2 Lexical Analysis 151
14.3 Syntactic Analysis 154
14.4 Code Generation 158
14.5 Compilers and Interpreters 166

15. The History of Computers 168


IS .1 A Classification of Computers 172

16. Main-frame Computers 174


16.1 File Maintenance 174
16.2 Physical and Engineering Problems 177
16.3 Operating Systems 178

17. Minicomputers 184


17.1 General Applications 184
17.2 Plant Control 184
17.3 X-ray Tomography 187
17.4 Packet Switching 190

18. Microprocessors 194


18.1 Toys and Games 195
18.2 Word Processing 195
18.3 Microcomputers 197
18.4 Conclusion 199

Appendix A: SNARK- An Abstract Teaching Machine 200


Appendix B: The SNARK Simulator Program 205
Assignments 212

Sample Solutions 238


Bibliography 254
Index 255
Preface

Computer science can be divided into two great streams of knowledge: one is
programming, and the other deals with the principles, construction and
applications of computer systems. This book is centred on the second stream; it
is not primarily about programming, but assumes that the reader is following a
parallel course on this key subject.
The range of knowledge needed to understand a computer system is large. It
includes elementary physics, electronics, information theory, logic design,
computer architecture, microcoding, machine code programming, compilers,
interpreters, operating systems and a selection of typical applications. Most
important of all is an over-all view which reveals how all these different areas
can be made to work together in harmony to form an integrated system.
Traditional introductory computer science courses tend to consider a selection
of these topics in isolation. Thus students may well be taught elementary logic
design by one lecturer, assembly code programming by another and a high-level
language by a third, but the links between these areas are never explored. The
student's impression of the subject is of a few islands of clarity set in a sea of
incomprehensible magic.
The aim of this book is to dispel the magic by providing a continuous and
logically connected survey of the subject. For example, the section on logic
design does not stop short at elementary combinatorial functions such as binary
addition, but goes on to introduce multiplexers, sequential circuits, and buses.
The chapter on over-all computer design does not therefore need to rely on
abstractions which have no apparent connection with anything already covered
in the course, but can use concepts which are familiar to the student.
This continuity of treatment in a first-year course cannot be achieved except
at a certain cost. First, the text moves fast, and does not often pause to examine
details which are not essential to the main theme. Second, the book traces but a
single path across the subject. The aim is to show just one way in which a
computer system could be implemented. The route chosen is largely arbitrary,
and alternative routes that exist at every stage are simply ignored.
Every teacher of computer science will be able to name numerous topics which
are given the briefest treatment, or not even mentioned. Nevertheless, the student
Preface ix

who reads and understands the book will know at least one way to implement a
working computer system. His knowledge will not have any conceptual gaps, and
he will have a unified framework on which to hang new concepts that he may
learn in the future.
A computer system is one of the most complex artefacts in existence. The
only way to understand it is by a holistic approach. This word, first used by
Koestler, describes any hierarchic system in which every component part is itself
a system constructed from more elementary components. In computer science,
the principle of holism appears at every stage, both in software and hardware,
and this book puts it to considerable use. Sometimes, as in describing hardware,
the approach is from 'bottom-up'. Some functional unit (say a full adder or a
multiplexer) is fully described in terms of its elementary components, then it is
notionally sealed in a box with the appropriate number of terminals, and used as
an 'elementary' component in a more complex structure such as a parallel adder
or arithmetic unit.
In software, the design method is more often 'top-down'. The book recom-
mends the use of flow charts in which the portions which are not clearly
understood at any stage are drawn as 'clouds'. Later, these clouds are expanded
and elaborated, perhaps through several levels, until the entire algorithm can be
expressed in elementary terms.
The use of structure to describe complex systems is perhaps one of the most
important mental tools at our disposal. It is hoped that the integrated approach
used in this book will help its readers to become totally familiar with the method,
and be able to apply it in their everyday study and work.
At the end of the book there are ten 'assignments', each based on the ground
covered by one or two chapters. Sample solutions are provided.
The three assignments on machine coding assume the use of a simple simulator
for the SNARK abstract machine. Appendix B includes the listing of a suitable
BASIC program for an 8K Commodore PET 2001 *.The program does not make
use of graphics or any other of the special features of this machine, and can
easily be adapted to run on other systems.
My thanks are due to many people who have made the publication of this
book possible: to students and colleagues at the University of Strathclyde, who
have read the manuscript, made comments and found errors; to Frank Sumner
and Simon Lavington, who gave me constant encouragement and detailed,
constructive criticism; to Miss Agnes Wisley who typed the book (parts of it many
times over); and above all to my wife and family, who left me undisturbed at
times when they had every legitimate claim on my time and attention.

Glasgow ANDREWCOUN
January, 1980

* A cassette tape of this program can be bought from Commodore Ltd, 360 Euston Road,
London,NWl
Abbreviations

ACC Accumulator
ARPA Advanced Research Project Agency
ASCII American Standard Code for Information Interchange
BASIC Beginners' All-purpose Symbolic Information Code
BNF Backus-Naur Form
CIR Current Instruction Register
COBOL Common Business-oriented Language
DEC Digital Equipment Corporation
EBCDIC Extended Binary Coded Decimal Interchange Code
EMI Electrical and Musical Industries Ltd
GPO General Post Office
IBM International Business Machines Ltd
ICL International Computers Ltd
JCL Job Description Language
MAR Memory Address Register
PET Personal Electronic Transactor

You might also like