Computer Organisation and Architecture Computer Organisation and Architecture An Introduction Second Edition B.S. Chalk, A.T. Carter and R.W. Hind Palgrave Macmillan © B.S.Chalk,A.T.Carter and R.W.Hind 2004 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,Designs and Patents Act 1988,or under the terms of any licence permitting limited copying issued by the Copyright Licensing Agency,90 Tottenham Court Road,London W1T 4LP. Any person who does any unauthorised act in relation to this publication may be liable to criminal prosecution and civil claims for damages. The authors have asserted their rights to be identified as the authors of this work in accordance with the Copyright, Designs and Patents Act 1988. First published 2004 by PALGRAVE MACMILLAN Houndmills,Basingstoke,Hampshire RG21 6XS and 175 Fifth Avenue,New York,N.Y.10010 Companies and representatives throughout the world PALGRAVE MACMILLAN is the global academic imprint of the Palgrave Macmillan division of St.Martin’s Press,LLC and of Palgrave Macmillan Ltd. Macmillan® is a registered trademark in the United States,United Kingdom and other countries.Palgrave is a registered trademark in the European Union and other countries. ISBN 978-1-4039-0164-4 ISBN 978-0-230-00060-5 (eBook) DOI 10.1007/978-0-230-00060-5 This book is printed on paper suitable for recycling and made from fully managed and sustained forest sources. A catalogue record for this book is available from the British Library. 10 9 8 7 6 5 4 3 2 1 13 12 11 10 09 08 07 06 05 04 Contents Preface to the second edition ix Acknowledgements x List oftrademarks xi Chapter 1 Introduction 1 1.1 Computer functionality 2 1.2 The von Neumann model 2 1.3 A personal computer system 3 1.4 Representing memory 5 1.5 High- and low-level languages 6 1.6 The operating system 7 1.7 Networked systems 7 Answers to in text questions 8 Exercises 8 Chapter 2 Data representation and computer arithmetic 10 2.1 Bits,bytes and words 10 2.2 Binary codes 11 2.3 Number systems 12 2.4 Negative numbers 15 2.5 Binary arithmetic 18 2.6 Binary coded decimal (BCD) 20 2.7 Floating point representation 20 2.8 Summary 23 Answers to in text questions 24 Exercises 24 Chapter 3 Boolean logic 26 3.1 Logic gates 26 3.2 Combinational logic circuits 28 v Contents 3.3 Sequential logic circuits 31 3.4 Flip-flop circuits 35 3.5 Summary 39 Answers to in text questions 40 Exercises 41 Chapter 4 Central processor unit operation 42 4.1 CPU details 42 4.2 Processor–Memory interconnection 43 4.3 Improving performance 52 4.4 The use ofmicrocode 61 4.5 Summary 64 Answers to in text questions 64 Exercises 66 Chapter 5 The Intel 80x86 family ofprocessors 68 5.1 The programmers model 68 5.2 Instruction types 71 5.3 Addressing modes 74 5.4 Instruction formats 77 5.5 Assembly code examples 80 5.6 Operating modes 83 5.7 Floating point arithmetic 83 5.8 Summary 86 Answers to in text questions 86 Exercises 88 Chapter 6 Primary memory 89 6.1 Memory hierarchy 89 6.2 RAM and cache basics 90 6.3 Semiconductor memory chips 90 6.4 Data and address buses 98 6.5 Cache memory 101 6.6 Summary 106 Answers to in text questions 107 Exercises 107 Chapter 7 Secondary memory 109 7.1 Magnetic surface technology 109 7.2 Magnetic disk storage 110 7.3 Optical disk storage systems 116 7.4 Summary 121 Answers to in text questions 121 Exercises 121 vi Contents Chapter 8 Input–Output 123 8.1 PC buses 123 8.2 Types ofinterface 124 8.3 I/O addressing 132 8.4 Modes ofI/O transfer 132 8.5 I/O buses 137 8.6 I/O devices 142 8.7 Summary 151 Answers to in text questions 152 Exercises 152 Chapter 9 Operating systems 154 9.1 Overview 154 9.2 Power-on self-test (POST) and system boot-up 155 9.3 Multiprogramming/multitasking 156 9.4 The process concept 156 9.5 Process management 157 9.6 Process scheduling 159 9.7 Inter-Process Communication (IPC) 160 9.8 Threads 163 9.9 Memory management 164 9.10 Operating system traps 170 9.11 File systems 171 9.12 Summary 174 Answers to in text questions 175 Exercises 176 Chapter 10 Reduced instruction set computers 177 10.1 CISC characteristics 178 10.2 Instruction usage 178 10.3 RISC architectures 179 10.4 The control unit 183 10.5 Pipelining 184 10.6 Hybrids 184 10.7 Performance and benchmarking 184 10.8 Superscalar and superpipelined architectures 185 10.9 Summary 186 Answers to in text questions 186 Exercises 187 Chapter 11 Networked systems 188 11.1 Introduction to networked systems 188 11.2 Local area networks 194 vii Contents 11.3 Wide area networks 205 11.4 Distributed systems 220 11.5 Security ofnetworked systems 223 11.6 Summary 227 Answers to in text questions 228 Exercises 229 Chapter 12 A look ahead 230 12.1 Processors 230 12.2 Primary memory 232 12.3 Secondary memory 232 12.4 Peripheral devices 233 12.5 Networks 235 12.6 Complete systems 236 12.7 Summary 237 Exercises 237 Appendix 1 Introduction to logic circuit minimisation using Karnaugh map methods 238 Appendix 2 Introduction to debug 247 Appendix 3 ASCII and Extended ASCII tables 257 Appendix 4 The 80x86 family ofprocessors 260 Appendix 5 IEEE 754 floating point format 265 Acronyms 267 References and further reading 271 Index 273 viii Preface to the second edition A great deal has happened in the world ofcomputing since the publication of the first edition ofthis book.Processors have become faster and the number oftransistors contained in the processor chip has greatly increased.The amount ofmemory,both primary and secondary,in the standard personal computer has increased and become faster.New peripheral devices have come onto the scene and some ofthe old ones have almost disappeared. Networked computers are the norm,as is connection to the Internet for almost all home computers.Having said all the above,the basic von Neumann architecture has not been superseded yet. This second edition ofComputer Organisation and Architecture,An Introduction,builds on the first edition,bringing the material up to date and adding new chapters on ‘Networking and what’s next’.After considerable thought,we have decided to use the Intel family ofprocessors rather than the Motorola 68000 for our examples.This is because the availability ofIntel based personal computers (PCs) tends to be greater than machines based on the Motorola 68000,taking into account that many people,especially students,have a PC at home.Our change must not be seen as a criticism of the Motorola processors,but simply a matter ofexpedience for experiential learning. Many ofour examples make reference to PCs,but all the basic principles apply to all sizes and shapes ofcomputers.There are still a large number of powerful high-end computers being used in big organisations and it must be remembered that the world ofcomputing is not just PCs. The target audience for this edition has not changed and with the addition ofthe networking chapter,we hope that the area ofappeal will have widened. We have included Chapter 12 in order to look briefly at some developments.Some are a few weeks away while others are experimental or just proposals.With the rate ofdevelopment we are seeing,it is difficult to imagine where computing will be in say five years time.We live in exciting times. Suggested answers to a number ofthe end ofchapter exercises are available on the WEB site associated with this book. A.T.Carter,R.W.Hind ix Acknowledgements Tony and I wish to thank Bernard Chalk for allowing us to produce a second edition ofhis book and for his helpful comments on our proposed changes. We also express grateful thanks to Dave Hatter ofPalgrave Macmillan, without whose assistance,both technical and editorial,this edition would not have reached completion. Thanks must also be extended to our wives,Deb and Margaret,for their patience and understanding. A.T.Carter,R.W.Hind March 2003 x