The intent of this book is to provide a thorough discussion of the fundamentals of computer organization and architecture and to relate these to contemporary design issues.. PREFACE xvFo
Trang 3Credits: Figure 2.14: reprinted with permission from The Computer Language Company, Inc Figure 17.10:
Buyya, Rajkumar, High-Performance Cluster Computing: Architectures and Systems, Vol I, 1st edition,
©1999 Reprinted and Electronically reproduced by permission of Pearson Education, Inc Upper Saddle River, New Jersey, Figure 17.11: Reprinted with permission from Ethernet Alliance.
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on the appropriate page within text.
Copyright © 2013, 2010, 2006 by Pearson Education, Inc., publishing as Prentice Hall All rights reserved Manufactured in the United States of America This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in
a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data available upon request
10 9 8 7 6 5 4 3 2 1
ISBN 10: 0-13-293633-X ISBN 13: 978-0-13-293633-0
Editorial Director: Marcia Horton
Executive Editor: Tracy Dunkelberger
Associate Editor: Carole Snyder
Director of Marketing: Patrice Jones
Marketing Manager: Yez Alayan
Marketing Coordinator: Kathryn Ferranti
Marketing Assistant: Emma Snider
Director of Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Production Project Manager: Kayla Smith-Tarbox
Production Editor: Pat Brown
Manufacturing Buyer: Pat Brown
Creative Director: Jayne Conte
Designer: Bruce Kenselaar Manager, Visual Research: Karen Sanatar Manager, Rights and Permissions: Mike Joyce Text Permission Coordinator: Jen Roach Cover Art: Charles Bowman/Robert Harding Lead Media Project Manager: Daniel Sandin Full-Service Project Management: Shiny Rajesh/ Integra Software Services Pvt Ltd.
Composition: Integra Software Services Pvt Ltd Printer/Binder: Edward Brothers
Cover Printer: Lehigh-Phoenix Color/Hagerstown Text Font: Times Ten-Roman
Trang 4To Tricia (ATS),
my loving wife, the kindest and gentlest person
Trang 5This page intentionally left blank
Trang 6Online Resources xi
Preface xiii
About the Author xxi
Chapter 0 Reader’s and Instructor’s Guide 1
0.1 Outline of the Book 2
0.2 A Roadmap for Readers and Instructors 2
0.3 Why Study Computer Organization and Architecture? 3
0.4 Internet and Web Resources 5
PART ONE OVERVIEW 6
Chapter 1 Introduction 6
1.1 Organization and Architecture 7
1.2 Structure and Function 8
1.3 Key Terms and Review Questions 14
Chapter 2 Computer Evolution and Performance 15
2.1 A Brief History of Computers 16
2.2 Designing for Performance 37
2.3 Multicore, MICs, and GPGPUs 43
2.4 The Evolution of the Intel x86 Architecture 44
2.5 Embedded Systems and the ARM 45
2.6 Performance Assessment 49
2.7 Recommended Reading 59
2.8 Key Terms, Review Questions, and Problems 60
PART TWO THE COMPUTER SYSTEM 65
Chapter 3 A Top-Level View of Computer Function
3.8 Key Terms, Review Questions, and Problems 108
Chapter 4 Cache Memory 112
4.1 Computer Memory System Overview 113
4.2 Cache Memory Principles 120
4.3 Elements of Cache Design 123
Trang 7vi CONTENTS
4.4 Pentium 4 Cache Organization 141
4.5 ARM Cache Organization 144
4.6 Recommended Reading 146
4.7 Key Terms, Review Questions, and Problems 147
Appendix 4A Performance Characteristics of Two-Level Memories 152
Chapter 5 Internal Memory 159
5.1 Semiconductor Main Memory 160
5.2 Error Correction 170
5.3 Advanced DRAM Organization 174
5.4 Recommended Reading 180
5.5 Key Terms, Review Questions, and Problems 181
Chapter 6 External Memory 185
7.5 Direct Memory Access 240
7.6 I/O Channels and Processors 246
7.7 The External Interface: Thunderbolt and Infiniband 248
7.8 IBM zEnterprise 196 I/O Structure 256
7.9 Recommended Reading 260
7.10 Key Terms, Review Questions, and Problems 260
Chapter 8 Operating System Support 265
8.1 Operating System Overview 266
8.2 Scheduling 277
8.3 Memory Management 283
8.4 Pentium Memory Management 294
8.5 ARM Memory Management 299
8.6 Recommended Reading 304
8.7 Key Terms, Review Questions, and Problems 304
PART THREE ARITHMETIC AND LOGIC 309
Chapter 9 Number Systems 309
9.1 The Decimal System 310
9.2 Positional Number Systems 311
9.3 The Binary System 312
9.4 Converting Between Binary and Decimal 312
Trang 8CONTENTS vii
9.5 Hexadecimal Notation 315
9.6 Recommended Reading 317
9.7 Key Terms and Problems 317
Chapter 10 Computer Arithmetic 319
10.1 The Arithmetic and Logic Unit 320
10.7 Key Terms, Review Questions, and Problems 359
Chapter 11 Digital Logic 364
11.7 Key Terms and Problems 401
PART FOUR THE CENTRAL PROCESSING UNIT 405
Chapter 12 Instruction Sets: Characteristics and Functions 405
12.1 Machine Instruction Characteristics 406
12.7 Key Terms, Review Questions, and Problems 441
Appendix 12A Little-, Big-, and Bi-Endian 447
Chapter 13 Instruction Sets: Addressing Modes and Formats 451
13.7 Key Terms, Review Questions, and Problems 479
Chapter 14 Processor Structure and Function 483
Trang 9viii CONTENTS
14.6 The ARM Processor 520
14.7 Recommended Reading 526
14.8 Key Terms, Review Questions, and Problems 527
Chapter 15 Reduced Instruction Set Computers 531
15.1 Instruction Execution Characteristics 533
15.2 The Use of a Large Register File 538
15.3 Compiler-Based Register Optimization 543
15.4 Reduced Instruction Set Architecture 545
15.10 Key Terms, Review Questions, and Problems 569
Chapter 16 Instruction-Level Parallelism and Superscalar Processors 573 16.1 Overview 574
16.2 Design Issues 579
16.3 Pentium 4 589
16.4 ARM Cortex-A8 595
16.5 Recommended Reading 603
16.6 Key Terms, Review Questions, and Problems 605
PART FIVE PARALLEL ORGANIZATION 611
Chapter 17 Parallel Processing 611
17.1 Multiple Processor Organizations 613
17.2 Symmetric Multiprocessors 615
17.3 Cache Coherence and the MESI Protocol 619
17.4 Multithreading and Chip Multiprocessors 626
17.5 Clusters 633
17.6 Nonuniform Memory Access 640
17.7 Vector Computation 644
17.8 Recommended Reading 656
17.9 Key Terms, Review Questions, and Problems 657
Chapter 18 Multicore Computers 664
18.1 Hardware Performance Issues 665
18.2 Software Performance Issues 669
Trang 10CONTENTS ix
Appendix A Projects for Teaching Computer Organization
and Architecture 691 A.1 Interactive Simulations 692
A.2 Research Projects 694
A.3 Simulation Projects 694
A.4 Assembly Language Projects 695
A.5 Reading/Report Assignments 696
A.6 Writing Assignments 696
A.7 Test Bank 696
Appendix B Assembly Language and Related Topics 697
PART SIX THE CONTROL UNIT 19-1
Chapter 19 Control Unit Operation 19-1
19.1 Micro-operations 19-3
19.2 Control of the Processor 19-13
19.3 Hardwired Implementation 19-30
19.4 Recommended Reading 19-35
19.5 Key Terms, Review Questions, and Problems 19-35
Chapter 20 Microprogrammed Control 20-1
Appendix D Victim Cache Strategies
D.1 Victim Cache
D.2 Selective Victim Cache
1 Online chapters, appendices, and other documents are Premium Content, available via the access card
at the front of this book.
Trang 11x CONTENTS
Appendix E Interleaved Memory
Appendix F The International Reference Alphabet
Appendix G Virtual Memory Page Replacement Algorithms G.1 Optimal
G.2 Least Recently Used
G.3 First-In-First-Out
G.4 Other Page Replacement Algorithms
Appendix H Recursive Procedures
H.1 Recursion
H.2 Activation Tree Representation
H.3 Stack Processing
H.4 Recursion and Iteration
Appendix I Additional Instruction Pipeline Topics
I.1 Pipeline Reservation Tables
I.2 Reorder Buffers
I.3 Tomasulo’s Algorithm
L.2 The TCP/IP Protocol Architecture
L.3 The Role of an Internet Protocol
O.1 Stack Structure
O.2 Stack Implementation
O.3 Expression Evaluation
Glossary 723
References 733
Index 745
Trang 12Companion Website WilliamStallings.com/
ComputerOrganization
Student Resources link: Useful links
and documents for students.
Instructor Resources link: Useful links
and documents for instructors.
Premium Content Click on Premium Content link
at Companion Website or at pearsonhighered.com/stallings and enter the student access code found
on the card in the front of the book.
Online chapters, appendices, and other documents that supplement the book.
Instructor Resource
Center (IRC)
Click on Pearson Resources for
Instructors link at Companion
Website or on Instructor Resource
link at pearsonhighered.com/stallings.
Solutions manual, projects manual, slides, and other useful documents.
Computer Science
Student Resource Site
ComputerScienceStudent.com Useful links and documents for
computer science students.
O NLINE R ESOURCES
Trang 13This page intentionally left blank
Trang 14WHAT’S NEW IN THE NINTH EDITION
In the four years since the eighth edition of this book was published, the field has seen tinued innovations and improvements In this new edition, I try to capture these changes while maintaining a broad and comprehensive coverage of the entire field To begin this process of revision, the eighth edition of this book was extensively reviewed by a number
con-of prcon-ofessors who teach the subject and by prcon-ofessionals working in the field The result is that, in many places, the narrative has been clarified and tightened, and illustrations have been improved
Beyond these refinements to improve pedagogy and user-friendliness, there have been substantive changes throughout the book Roughly the same chapter organization has been retained, but much of the material has been revised and new material has been added The most noteworthy changes are as follows:
• Point-to-point interconnect: The traditional bus architecture has increasingly been
re-placed with high-speed point-to-point interconnect schemes A new section explores this technology, using Intel’s QuickPath Interconnect (QPI) as an example
• PCI Express: PCI Express (PCIe) has become a standard peripheral interconnect
archi-tecture, replacing PCI and other bus-based architectures A new section covers PCIe
• Solid state drive and flash memory: Solid state drives are increasingly displacing hard
disk drives over a range of computers A new section covers SSDs and the underlying flash memory technology
• IEEE 754 Floating-Point Standard: The coverage of IEEE 754 has been updated to
reflect the 2008 standard
• Contemporary mainframe organization: Chapters 7 and 18 include sections on the
zEnterprise 196, IBM’s latest mainframe computer offering (at the time of this writing), introduced in 2010
• I/O standards: The book has been updated to reflect the latest developments, including
Trang 15xiv PREFACE
• Sample syllabus: The text contains more material than can be conveniently covered in
one semester Accordingly, instructors are provided with several sample syllabi that guide the use of the text within limited time (e.g., 16 weeks or 12 weeks) These samples are based on real-world experience by professors with the eighth edition
• Test bank: A set of review questions, including yes/no, multiple choice, and fill in the
blank is provided for each chapter
With each new edition it is a struggle to maintain a reasonable page count while adding new material In part this objective is realized by eliminating obsolete material and tighten-ing the narrative For this edition, chapters and appendices that are of less general interest have been moved online, as individual PDF files This has allowed an expansion of material without the corresponding increase in size and price
OBJECTIVES
This book is about the structure and function of computers Its purpose is to present, as clearly and completely as possible, the nature and characteristics of modern-day computer systems
This task is challenging for several reasons First, there is a tremendous variety of ucts that can rightly claim the name of computer, from single-chip microprocessors costing
prod-a few dollprod-ars to supercomputers costing tens of millions of dollprod-ars Vprod-ariety is exhibited not only in cost but also in size, performance, and application Second, the rapid pace of change that has always characterized computer technology continues with no letup These changes cover all aspects of computer technology, from the underlying integrated circuit technology used to construct computer components to the increasing use of parallel organization con-cepts in combining those components
In spite of the variety and pace of change in the computer field, certain fundamental concepts apply consistently throughout The application of these concepts depends on the current state of the technology and the price/performance objectives of the designer The intent of this book is to provide a thorough discussion of the fundamentals of computer organization and architecture and to relate these to contemporary design issues
The subtitle suggests the theme and the approach taken in this book It has always been important to design computer systems to achieve high performance, but never has this requirement been stronger or more difficult to satisfy than today All of the basic perform-ance characteristics of computer systems, including processor speed, memory speed, memory capacity, and interconnection data rates, are increasing rapidly Moreover, they are increas-ing at different rates This makes it difficult to design a balanced system that maximizes the performance and utilization of all elements Thus, computer design increasingly becomes a game of changing the structure or function in one area to compensate for a performance mismatch in another area We will see this game played out in numerous design decisions throughout the book
A computer system, like any system, consists of an interrelated set of components The system is best characterized in terms of structure—the way in which components are interconnected, and function—the operation of the individual components Furthermore, a computer’s organization is hierarchical Each major component can be further described by decomposing it into its major subcomponents and describing their structure and function
Trang 16PREFACE xv
For clarity and ease of understanding, this hierarchical organization is described in this book from the top down:
• Computer system: Major components are processor, memory, I/O.
• Processor: Major components are control unit, registers, ALU, and instruction
execu-tion unit
• Control unit: Provides control signals for the operation and coordination of all processor
components Traditionally, a microprogramming implementation has been used, in which major components are control memory, microinstruction sequencing logic, and registers More recently, microprogramming has been less prominent but remains an important implementation technique
The objective is to present the material in a fashion that keeps new material in a clear context This should minimize the chance that the reader will get lost and should provide better motivation than a bottom-up approach
Throughout the discussion, aspects of the system are viewed from the points of view
of both architecture (those attributes of a system visible to a machine language mer) and organization (the operational units and their interconnections that realize the architecture)
program-EXAMPLE SYSTEMS
This text is intended to acquaint the reader with the design principles and implementation issues of contemporary operating systems Accordingly, a purely conceptual or theoretical treatment would be inadequate To illustrate the concepts and to tie them to real-world design choices that must be made, two processor families have been chosen as running examples:
• Intel x86 architecture: The x86 architecture is the most widely used for nonembedded
computer systems The x86 is essentially a complex instruction set computer (CISC) with some RISC features Recent members of the x86 family make use of superscalar and multicore design principles The evolution of features in the x86 architecture pro-vides a unique case study of the evolution of most of the design principles in computer architecture
• ARM: The ARM architecture is arguably the most widely used embedded processor,
used in cell phones, iPods, remote sensor equipment, and many other devices The ARM is essentially a reduced instruction set computer (RISC) Recent members of the ARM family make use of superscalar and multicore design principles
Many, but by no means all, of the examples in this book are drawn from these two computer families Numerous other systems, both contemporary and historical, provide examples of important computer architecture design features
PLAN OF THE TEXT
The book is organized into six parts (see Chapter 0 for an overview):
• Overview
• The computer system
Trang 17xvi PREFACE
• Arithmetic and logic
• The central processing unit
• Parallel organization, including multicore
• The control unit
The book includes a number of pedagogic features, including the use of interactive simulations and numerous figures and tables to clarify the discussion Each chapter includes
a list of key words, review questions, homework problems, and suggestions for further ing The book also includes an extensive glossary, a list of frequently used acronyms, and a bibliography
read-INTENDED AUDIENCE
The book is intended for both an academic and a professional audience As a textbook,
it is intended as a one- or two-semester undergraduate course for computer science, puter engineering, and electrical engineering majors It covers all the core topics in the
com-body of knowledge category, Architecture and Organization, in the IEEE/ACM Computer Curriculum 2008: An Interim Revision to CS 2001 This book also covers the core area CE-CAO Computer Architecture and Organization from the IEEE/ACM Computer Engineering Curriculum Guidelines 2004.
For the professional interested in this field, the book serves as a basic reference ume and is suitable for self-study
vol-INSTRUCTOR SUPPORT MATERIALS
Support materials for instructors are available at the Instructor Resource Center (IRC) for
this textbook, which can be reached through the Publisher’s Website www.pearsonhighered com/stallings or by clicking on the link labeled “Pearson Resources for Instructors” at this book’s Companion Website at WilliamStallings.com/ComputerOrganization To gain access
to the IRC, please contact your local Pearson sales representative via pearsonhighered com/educator/replocator/requestSalesRep.page or call Pearson Faculty Services at 1-800-526-0485 The IRC provides the following materials:
• Projects manual: Project resources including documents and portable software, plus
suggested project assignments for all of the project categories listed subsequently in this Preface
• Solutions manual: Solutions to end-of-chapter Review Questions and Problems.
• PowerPoint slides: A set of slides covering all chapters, suitable for use in lecturing.
• PDF files: Copies of all figures and tables from the book.
• Test bank: A chapter-by-chapter set of questions.
• Sample syllabuses: The text contains more material than can be conveniently covered
in one semester Accordingly, instructors are provided with several sample syllabuses that guide the use of the text within limited time These samples are based on real-world experience by professors with the first edition
Trang 18PREFACE xviiThe Companion Website, at WilliamStallings.com/ComputerOrganization (click on
Instructor Resources link) includes the following:
• Links to Websites for other courses being taught using this book
• Sign-up information for an Internet mailing list for instructors using this book to exchange information, suggestions, and questions with each other and with the author
STUDENT RESOURCES
For this new edition, a tremendous amount of original supporting material for students
has been made available online, at two Web locations The Companion Website, at
WilliamStallings.com/ComputerOrganization (click on Student Resources link), includes a list of relevant links organized by chapter and an errata sheet for the book
Purchasing this textbook new grants the reader six months of access to the Premium
Content Site, which includes the following materials:
• Online chapters: To limit the size and cost of the book, two chapters of the book are
provided in PDF format The chapters are listed in this book’s table of contents
• Online appendices: There are numerous interesting topics that support material found
in the text but whose inclusion is not warranted in the printed text A total of 13 dices cover these topics for the interested student The appendices are listed in this book’s table of contents
appen-• Homework problems and solutions: To aid the student in understanding the material, a
separate set of homework problems with solutions are available Students can enhance their understanding of the material by working out the solutions to these problems and then checking their answers
• Key papers: Several dozen papers from the professional literature, many hard to find,
are provided for further reading
• Supporting documents: A variety of other useful documents are referenced in the text
and provided online
Finally, I maintain the Computer Science Student Resource Site at WilliamStallings
.com/StudentSupport.html.
PROJECTS AND OTHER STUDENT EXERCISES
For many instructors, an important component of a computer organization and ture course is a project or set of projects by which the student gets hands-on experience to reinforce concepts from the text This book provides an unparalleled degree of support for including a projects component in the course The instructor’s support materials available through Prentice Hall not only includes guidance on how to assign and structure the projects but also includes a set of user’s manuals for various project types plus specific assignments, all written especially for this book Instructors can assign work in the following areas:
architec-• Interactive simulation assignments: Described subsequently.
Trang 19xviii PREFACE
• Research projects: A series of research assignments that instruct the student to research
a particular topic on the Internet and write a report
• Simulation projects: The IRC provides support for the use of the two simulation
pack-ages: SimpleScalar can be used to explore computer organization and architecture design issues SMPCache provides a powerful educational tool for examining cache design issues for symmetric multiprocessors
• Assembly language projects: A simplified assembly language, CodeBlue, is used and
assignments based on the popular Core Wars concept are provided
• Reading/report assignments: A list of papers in the literature, one or more for each
chapter, that can be assigned for the student to read and then write a short report
• Writing assignments: A list of writing assignments to facilitate learning the material.
• Test bank: Includes T/F, multiple choice, and fill-in-the-blanks questions and answers.
This diverse set of projects and other student exercises enables the instructor to use the book as one component in a rich and varied learning experience and to tailor a course plan to meet the specific needs of the instructor and students See Appendix A in this book for details
INTERACTIVE SIMULATIONS
An important feature in this edition is the incorporation of interactive simulations These simulations provide a powerful tool for understanding the complex design features of a mod-ern computer system A total of 20 interactive simulations are used to illustrate key functions and algorithms in computer organization and architecture design At the relevant point in the book, an icon indicates that a relevant interactive simulation is available online for student use Because the animations enable the user to set initial conditions, they can serve as the basis for student assignments The instructor’s supplement includes a set of assignments, one for each
of the animations Each assignment includes several specific problems that can be assigned
to students For access to the animations, click on the rotating globe at this book’s Website at http://williamstallings.com/ComputerOrganization
ACKNOWLEDGMENTS
This new edition has benefited from review by a number of people, who gave generously
of their time and expertise The following professors and instructors reviewed all or a large part of the manuscript: Branson Murrill (Virginia Commonwealth University), Pan Deng (Florida International University), Bob Broeg (Western Oregon University), Curtis Meadow (University of Maine, Orono), Charles Weems (University of Massachusetts), and Mike Jochen (East Stroudsberg University)
Thanks also to the many people who provided detailed technical reviews of one or more chapters: Kauser Johar, Todd Bezenek (Quantum), Moustafa Mohamed (University
of Colorado at Boulder), Dharmesh Parikh, Qigang Wang, Rajiv Dasmohapatra (WIPRO Ltd), Anup Holey (University of Minnesota, Twin Cities), Alexandre Keunecke Ignacio de Mendonca, Douglas Tiedt, Kursad Albayraktaroglu (Advanced Micro Device), Nilanjan Goswami (University of Florida, Gainesville), Adnan Khaleel (Cray, Inc.), Geri Lamble,
Trang 20PREFACE xix
Liu Han, Mafijul Islam (Volvo Technology, Sweden), Roger Kahn, Brian Case, Mani Srinivasan, Abhishek Deb, Sushil Menon (University of Pennsylvania), Jigar Savla (Georgia Institute of Technology), Madhu Mutyam, Karl Stevens, Vineet Chadha (Intel Labs), Xingxing Jin (University of Saskatchewan), Jan Hoogerbrugge (NXP Semiconductors), Ninad Laxman Sawant, Aziz Eker (TOBB University of Economics and Technology, Ankara, Turkey), Bhupati Shukla, Niket Choudhary (North Carolina State University), and Oguz Ergin (TOBB University of Economics and Technology, Ankara, Turkey)
Professor Cindy Norris of Appalachian State University, Professor Bin Mu of the University of New Brunswick, and Professor Kenrick Mock of the University of Alaska kindly supplied homework problems
Aswin Sreedhar of the University of Massachusetts developed the interactive tion assignments and also wrote the test bank
simula-Professor Miguel Angel Vega Rodriguez, simula-Professor Dr Juan Manuel Sánchez Pérez, and Professor Dr Juan Antonio Gómez Pulido, all of University of Extremadura, Spain, prepared the SMPCache problems in the instructor’s manual and authored the SMPCache User’s Guide
Todd Bezenek of the University of Wisconsin and James Stine of Lehigh University prepared the SimpleScalar problems in the instructor’s manual, and Todd also authored the SimpleScalar User’s Guide
Finally, I would like to thank the many people responsible for the publication of the book, all of whom did their usual excellent job This includes the staff at Pearson Education, particularly my editor Tracy Dunkelberger, her assistant Carole Snyder, and production managers Kayla Smith-Tarbox and Pat Brown I also thank Shiny Rajesh and the produc-tion staff at Integra for another excellent and rapid job Thanks also to the marketing and sales staffs at Pearson, without whose efforts this book would not be in your hands
Trang 21This page intentionally left blank
Trang 22Dr William Stallings has made a unique contribution to understanding the broad sweep of technical developments in computer security, computer networking and computer architec-ture He has authored 17 titles, and counting revised editions, a total of 42 books on various aspects of these subjects His writings have appeared in numerous ACM and IEEE publica-
tions, including the Proceedings of the IEEE and ACM Computing Reviews.
He has 10 times received the award for the best Computer Science textbook of the year from the Text and Academic Authors Association
In over 30 years in the field, he has been a technical contributor, technical manager, and an executive with several high-technology firms He has designed and implemented both TCP/IP-based and OSI-based protocol suites on a variety of computers and operating systems, ranging from microcomputers to mainframes As a consultant, he has advised gov-ernment agencies, computer and software vendors, and major users on the design, selection, and use of networking software and products
He created and maintains the Computer Science Student Resource Site at
WilliamStallings.com/StudentSupport.html This site provides documents and links on a variety of subjects of general interest to computer science students (and professionals) He
is a member of the editorial board of Cryptologia, a scholarly journal devoted to all aspects
Trang 23This page intentionally left blank
Trang 240.1 Outline of the Book
0.2 A Roadmap for Readers and Instructors
0.3 Why Study Computer Organization and Architecture?
0.4 Internet and Web Resources
Web Sites for This BookComputer Science Student Resource SiteOther Web Sites
CHAPTER
Trang 252 CHAPTER 0 / READER’S AND INSTRUCTOR’S GUIDE
This book, with its accompanying Web sites, covers a lot of material In this chapter,
we give the reader an overview
0.1 OUTLINE OF THE BOOK
The book is organized into five parts:
Part One Overview: Provides an overview of computer organization and
archi-tecture and looks at how computer design has evolved
Part Two The Computer System: Examines the major components of a
com-puter and their interconnections, both with each other and the outside world This part also includes a detailed discussion of internal and external memory and of input/output (I/O) Finally, the relationship between a computer’s archi-tecture and the operating system running on that architecture is examined
Part Three Arithmetic and Logic: This part begins with a chapter that reviews
number systems Chapter 10 is an extended discussion of computer arithmetic Chapter 11 is a survey of digital logic
Part Four The Central Processing Unit: Examines the internal architecture
and organization of the processor This part looks at the instruction set tecture The remainder of the part deals with the structure and function of the processor, including a discussion of reduced instruction set computer (RISC) and superscalar approaches
archi-Part Five Parallel Organization: Deals with parallel organization, including
symmetric multiprocessing, clusters, and multicore architecture
Part Six The Control Unit: Discusses the internal structure of the processor’s
control unit and the use of microprogramming
A number of online chapters and appendices at this book’s Web site cover additional topics relevant to the book
This text is intended to acquaint you with the design principles and implementation issues of contemporary computer organization and architecture Accordingly, a purely conceptual or theoretical treatment would be inadequate This book uses examples from
a number of different machines to clarify and reinforce the concepts being presented Many, but by no means all, of the examples are drawn from two computer families: the Intel x86 family and the ARM family These two systems together encompass most of the current computer design trends The Intel x86 architecture is essentially a complex instruction set computer (CISC) with some RISC features, while the ARM is essentially a RISC Both systems make use of superscalar design principles, and both support multiple processor and multicore configurations
0.2 A ROADMAP FOR READERS AND INSTRUCTORS
This book follows a top–down approach to the presentation of the material As
we discuss in more detail in Section 1.2, a computer system can be viewed as a hierarchical structure At a top level, we are concerned with the major components
Trang 260.3 / WHY STUDY COMPUTER ORGANIZATION AND ARCHITECTURE? 3
of the computers: processor, I/O, memory, and peripheral devices Part Two ines these components and looks in some detail at each component except the processor This approach allows us to see the external functional requirements that drive the processor design, setting the stage for Parts Three and Four Part Three looks at the arithmetic and logic component of the processor in detail Then Part Four examine the processor in great detail Because we have the context provided
exam-by Part Two, we are able, in Part Four, to see the design decisions that must be made
so that the processor supports the overall function of the computer system Next, in Part Five, we examine systems with multiple processors, including clusters, multi-processor computers, and multicore computers Finally, Part Six looks at the control unit, which is at the heart of the processor Again, the design of the control unit can best be explained in the context of the function it performs within the context of the processor
0.3 WHY STUDY COMPUTER ORGANIZATION
AND ARCHITECTURE?
The IEEE/ACM Computer Science Curriculum 2008, prepared by the Joint Task
Force on Computing Curricula of the IEEE (Institute of Electrical and Electronics Engineers) Computer Society and ACM (Association for Computing Machinery), lists computer architecture as one of the core subjects that should be in the curricu-lum of all students in computer science and computer engineering The report says the following:
The computer lies at the heart of computing Without it most of the computing disciplines today would be a branch of theoreti-cal mathematics A professional in any field of computing should not regard the computer as just a black box that executes pro-grams by magic All students of computing should acquire some understanding and appreciation of a computer system’s functional components, their characteristics, their performance, and their interactions Students need to understand computer architecture
in order to make best use of the software tools and computer languages they use to create programs In this introduction the term architecture is taken to include instruction set architecture (the programmer’s abstraction of a computer), organization or microarchitecture (the internal implementation of a computer at the register and functional unit level), and system architecture (the organization of the computer at the cache and bus level) Students should also understand the complex trade-offs between CPU clock speed, cache size, bus organization, number of core proces-sors, and so on Computer architecture also underpins other areas
of the computing curriculum such as operating systems (input/
output, memory technology) and high-level languages (pointers, parameter passing)
Trang 274 CHAPTER 0 / READER’S AND INSTRUCTOR’S GUIDE
Another publication of the task force, Computer Engineering 2004 Curriculum Guidelines, emphasized the importance of Computer Architecture and Organization
as follows:
Computer architecture is a key component of computer engineering and the practicing computer engineer should have a practical under-standing of this topic It is concerned with all aspects of the design and organization of the central processing unit and the integration
of the CPU into the computer system itself Architecture extends upward into computer software because a processor’s architecture must cooperate with the operating system and system software
It is difficult to design an operating system well without knowledge
of the underlying architecture Moreover, the computer designer must have an understanding of software in order to implement the optimum architecture
The computer architecture curriculum has to achieve multiple objectives It must provide an overview of computer architecture and teach students the operation of a typical computing machine
It must cover basic principles, while acknowledging the complexity
of existing commercial systems Ideally, it should reinforce topics that are common to other areas of computer engineering; for example, teaching register indirect addressing reinforces the concept of point-ers in C Finally, students must understand how various peripheral devices interact with, and how they are interfaced to a CPU
[CLEM00] gives the following examples as reasons for studying computer architecture:
1 Suppose a graduate enters the industry and is asked to select the most effective computer for use throughout a large organization An understanding
cost-of the implications cost-of spending more for various alternatives, such as a larger cache or a higher processor clock rate, is essential to making the decision
2 Many processors are not used in PCs or servers but in embedded systems
A designer may program a processor in C that is embedded in some real-time
or larger system, such as an intelligent automobile electronics controller Debugging the system may require the use of a logic analyzer that displays the relationship between interrupt requests from engine sensors and machine-level code
3 Concepts used in computer architecture find application in other courses In particular, the way in which the computer provides architectural support for programming languages and operating system facilities reinforces concepts from those areas
As can be seen by perusing the table of contents of this book, computer ization and architecture encompasses a broad range of design issues and concepts
organ-A good overall understanding of these concepts will be useful both in other areas of study and in future work after graduation
Trang 280.4 / INTERNET AND WEB RESOURCES 5
0.4 INTERNET AND WEB RESOURCES
There are a number of resources available on the Internet and the Web that support this book and help readers keep up with developments in this field
Web Sites for This Book
Three Web sites provide additional resources for students and instructors
We maintain a Companion Web site for this book at http://williamstallings.
com/ComputerOrganization For students, this Web site includes a list of relevant links, organized by chapter, and an errata list for the book For instructors, this Web site provides links to course pages by professors teaching from this book
There is also an access-controlled Premium Content Web site that provides
a wealth of supporting material, including additional online chapters, additional online appendices, a set of homework problems with solutions, copies of a number
of key papers in this field, and a number of other supporting documents See the card at the front of this book for access information
Finally, additional material for instructors is available at the Instructor
Resource Center (IRC) for this book See Preface for details and access information.
Computer Science Student Resource Site
I also maintain the Computer Science Student Resource Site, at ComputerScienceStudent.com The purpose of this site is to provide documents, information, and links for computer science students and professionals Links and documents are organized into six categories:
• Math: Includes a basic math refresher, a queuing analysis primer, a number
system primer, and links to numerous math sites
• How-to: Advice and guidance for solving homework problems, writing
technical reports, and preparing technical presentations
• Research resources: Links to important collections of papers, technical
reports, and bibliographies
• Miscellaneous: A variety of other useful documents and links.
• Computer science careers: Useful links and documents for those considering a
career in computer science
• Humor and other diversions: You have to take your mind off your work once
in a while
Other Web Sites
Numerous Web sites provide information related to the topics of this book The Companion Web site provides links to these sites, organized by chapter
Trang 29I NTRODUCTION
1.1 Organization and Architecture
1.2 Structure and Function
FunctionStructure
1.3 Key Terms and Review Questions
CHAPTER
6
Trang 301.1 / ORGANIZATION AND ARCHITECTURE 7
This book is about the structure and function of computers Its purpose is to present,
as clearly and completely as possible, the nature and characteristics of modern-day computers This task is a challenging one for two reasons
First, there is a tremendous variety of products, from single-chip ers costing a few dollars to supercomputers costing tens of millions of dollars, that
microcomput-can rightly claim the name computer Variety is exhibited not only in cost, but also in
size, performance, and application Second, the rapid pace of change that has always characterized computer technology continues with no letup These changes cover all aspects of computer technology, from the underlying integrated circuit technology used to construct computer components to the increasing use of parallel organization concepts in combining those components
In spite of the variety and pace of change in the computer field, certain mental concepts apply consistently throughout To be sure, the application of these concepts depends on the current state of technology and the price/performance objectives of the designer The intent of this book is to provide a thorough discussion
funda-of the fundamentals funda-of computer organization and architecture and to relate these
to contemporary computer design issues This chapter introduces the descriptive approach to be taken
1.1 ORGANIZATION AND ARCHITECTURE
In describing computers, a distinction is often made between computer architecture and computer organization Although it is difficult to give precise definitions
for these terms, a consensus exists about the general areas covered by each (e.g., see [VRAN80], [SIEW82], and [BELL78a]); an interesting alternative view
is presented in [REDD76]
Computer architecture refers to those attributes of a system visible to a
programmer or, put another way, those attributes that have a direct impact on
the logical execution of a program Computer organization refers to the
opera-tional units and their interconnections that realize the architectural specifications Examples of architectural attributes include the instruction set, the number of bits used to represent various data types (e.g., numbers, characters), I/O mechanisms, and techniques for addressing memory Organizational attributes include those hardware details transparent to the programmer, such as control signals; interfaces between the computer and peripherals; and the memory technology used
For example, it is an architectural design issue whether a computer will have
a multiply instruction It is an organizational issue whether that instruction will
be implemented by a special multiply unit or by a mechanism that makes repeated use of the add unit of the system The organizational decision may be based on the anticipated frequency of use of the multiply instruction, the relative speed of the two approaches, and the cost and physical size of a special multiply unit
Historically, and still today, the distinction between architecture and zation has been an important one Many computer manufacturers offer a family of computer models, all with the same architecture but with differences in organization Consequently, the different models in the family have different price and perform-ance characteristics Furthermore, a particular architecture may span many years and
Trang 31organi-8 CHAPTER 1 / INTRODUCTION
encompass a number of different computer models, its organization changing with changing technology A prominent example of both these phenomena is the IBM System/370 architecture This architecture was first introduced in 1970 and included
a number of models The customer with modest requirements could buy a cheaper, slower model and, if demand increased, later upgrade to a more expensive, faster model without having to abandon software that had already been developed Over the years, IBM has introduced many new models with improved technology to replace older models, offering the customer greater speed, lower cost, or both These newer models retained the same architecture so that the customer’s software investment was protected Remarkably, the System/370 architecture, with a few enhancements, has survived to this day as the architecture of IBM’s mainframe product line
In a class of computers called microcomputers, the relationship between tecture and organization is very close Changes in technology not only influence organization but also result in the introduction of more powerful and more complex architectures Generally, there is less of a requirement for generation-to-generation compatibility for these smaller machines Thus, there is more interplay between organizational and architectural design decisions An intriguing example of this is the reduced instruction set computer (RISC), which we examine in Chapter 15.This book examines both computer organization and computer architecture The emphasis is perhaps more on the side of organization However, because a computer organization must be designed to implement a particular architectural specification, a thorough treatment of organization requires a detailed examination
archi-of architecture as well
1.2 STRUCTURE AND FUNCTION
A computer is a complex system; contemporary computers contain millions of elementary electronic components How, then, can one clearly describe them? The key is to recognize the hierarchical nature of most complex systems, including the computer [SIMO96] A hierarchical system is a set of interrelated subsystems, each of the latter, in turn, hierarchical in structure until we reach some lowest level
of elementary subsystem
The hierarchical nature of complex systems is essential to both their design and their description The designer need only deal with a particular level of the system at a time At each level, the system consists of a set of components and their interrelationships The behavior at each level depends only on a simplified, abstracted characterization of the system at the next lower level At each level, the designer is concerned with structure and function:
• Structure: The way in which the components are interrelated.
• Function: The operation of each individual component as part of the structure.
In terms of description, we have two choices: starting at the bottom and ing up to a complete description, or beginning with a top view and decomposing the system into its subparts Evidence from a number of fields suggests that the top-down approach is the clearest and most effective [WEIN75]
Trang 32build-1.2 / STRUCTURE AND FUNCTION 9
The approach taken in this book follows from this viewpoint The computer system will be described from the top down We begin with the major components
of a computer, describing their structure and function, and proceed to successively lower layers of the hierarchy The remainder of this section provides a very brief overview of this plan of attack
Function
Both the structure and functioning of a computer are, in essence, simple Figure 1.1 depicts the basic functions that a computer can perform In general terms, there are only four:
Operating environment (source and destination of data)
Control mechanism
Data storage facility
Data processing facility
Trang 3310 CHAPTER 1 / INTRODUCTION
The computer, of course, must be able to process data The data may take a wide
variety of forms, and the range of processing requirements is broad However, we shall see that there are only a few fundamental methods or types of data processing
It is also essential that a computer store data Even if the computer is
process-ing data on the fly (i.e., data come in and get processed, and the results go out immediately), the computer must temporarily store at least those pieces of data that are being worked on at any given moment Thus, there is at least a short-term data storage function Equally important, the computer performs a long-term data storage function Files of data are stored on the computer for subsequent retrieval and update
The computer must be able to move data between itself and the outside
world The computer’s operating environment consists of devices that serve as either sources or destinations of data When data are received from or delivered to
a device that is directly connected to the computer, the process is known as input– output (I/O), and the device is referred to as a peripheral When data are moved over longer distances, to or from a remote device, the process is known as data communications.
Finally, there must be control of these three functions Ultimately, this control
is exercised by the individual(s) who provides the computer with instructions Within the computer, a control unit manages the computer’s resources and orchestrates the performance of its functional parts in response to those instructions
At this general level of discussion, the number of possible operations that can be performed is few Figure 1.2 depicts the four possible types of operations The computer can function as a data movement device (Figure 1.2a), simply transferring data from one peripheral or communication line to another It can also function as a data storage device (Figure 1.2b), with data transferred from the external environment to computer storage (read) and vice versa (write) The final two diagrams show operations involving data processing, on data either in storage (Figure 1.2c) or en route between storage and the external environment (Figure 1.2d)
The preceding discussion may seem absurdly generalized It is certainly ble, even at a top level of computer structure, to differentiate a variety of functions, but, to quote [SIEW82],
possi-There is remarkably little shaping of computer structure to fit the function to be performed At the root of this lies the general-purpose nature of computers, in which all the functional specialization occurs
at the time of programming and not at the time of design
Structure
Figure 1.3 is the simplest possible depiction of a computer The computer acts in some fashion with its external environment In general, all of its linkages to the external environment can be classified as peripheral devices or communication lines We will have something to say about both types of linkages
Trang 34inter-1.2 / STRUCTURE AND FUNCTION 11
Movement Movement
Trang 3512 CHAPTER 1 / INTRODUCTION
But of greater concern in this book is the internal structure of the computer itself, which is shown in Figure 1.4 There are four main structural components:
• Central processing unit (CPU): Controls the operation of the computer and
performs its data processing functions; often simply referred to as processor.
• Main memory: Stores data.
• I/O: Moves data between the computer and its external environment.
• System interconnection: Some mechanism that provides for communication
among CPU, main memory, and I/O A common example of system
intercon-nection is by means of a system bus, consisting of a number of conducting
wires to which all the other components attach
There may be one or more of each of the aforementioned components Traditionally, there has been just a single processor In recent years, there has been increasing use of multiple processors in a single computer Some design issues relat-ing to multiple processors crop up and are discussed as the text proceeds; Part Five focuses on such computers
Each of these components will be examined in some detail in Part Two However, for our purposes, the most interesting and in some ways the most complex component is the CPU Its major structural components are as follows:
• Control unit: Controls the operation of the CPU and hence the computer.
• Arithmetic and logic unit (ALU): Performs the computer’s data processing
functions
• Registers: Provides storage internal to the CPU.
• CPU interconnection: Some mechanism that provides for communication
among the control unit, ALU, and registers
Trang 361.2 / STRUCTURE AND FUNCTION 13
Each of these components will be examined in some detail in Part Three, where
we will see that complexity is added by the use of parallel and pipelined tional techniques Finally, there are several approaches to the implementation of
organiza-the control unit; one common approach is a microprogrammed implementation In
essence, a microprogrammed control unit operates by executing microinstructions that define the functionality of the control unit With this approach, the structure of the control unit can be depicted, as in Figure 1.4 This structure will be examined in Part Four
Main memory I/O
CPU
COMPUTER
System bus
ALU Registers
Control unit
CPU
Internal bus
Control unit registers and decoders
CONTROL UNIT Sequencing
logic
Control memory
Trang 37input–output (I/O) main memory
processor registers system bus
Trang 38CHAPTER
2.1 A Brief History of Computers
The First Generation: Vacuum TubesThe Second Generation: TransistorsThe Third Generation: Integrated CircuitsLater Generations
2.2 Designing for Performance
Microprocessor SpeedPerformance BalanceImprovements in Chip Organization and Architecture
2.3 Multicore, MICs, and GPGPUs
2.4 The Evolution of the Intel x86 Architecture
2.5 Embedded Systems and the ARM
Embedded SystemsARM Evolution
2.6 Performance Assessment
Clock Speed and Instructions per SecondBenchmarks
Amdahl’s LawLittle’s Law
2.7 Recommended Reading
2.8 Key Terms, Review Questions, and Problems
Trang 3916 CHAPTER 2 / COMPUTER EVOLUTION AND PERFORMANCE
We begin our study of computers with a brief history This history is itself ing and also serves the purpose of providing an overview of computer structure and function Next, we address the issue of performance A consideration of the need for balanced utilization of computer resources provides a context that is useful throughout the book Finally, we look briefly at the evolution of the two systems that serve as key examples throughout the book: the Intel x86 and ARM processor families
2.1 A BRIEF HISTORY OF COMPUTERS1
The First Generation: Vacuum Tubes
and constructed at the University of Pennsylvania, was the world’s first purpose electronic digital computer The project was a response to U.S needs during World War II The Army’s Ballistics Research Laboratory (BRL), an agency responsible for developing range and trajectory tables for new weapons, was having difficulty supplying these tables accurately and within a reasonable time frame Without these firing tables, the new weapons and artillery were useless to gunners The BRL employed more than 200 people who, using desktop calculators, solved the necessary ballistics equations Preparation of the tables for a single weapon would take one person many hours, even days
general-John Mauchly, a professor of electrical engineering at the University of Pennsylvania, and John Eckert, one of his graduate students, proposed to build a general-purpose computer using vacuum tubes for the BRL’s application In 1943, the Army accepted this proposal, and work began on the ENIAC The resulting
LEARNING OBJECTIVES
After studying this chapter, you should be able to:
Present an overview of the evolution of computer technology from early digital computers to the latest microprocessors
Understand the key performance issues that relate to computer design
Explain the reasons for the move to multicore organization, and understand the trade-off between cache and processor resources on a single chip
Distinguish among multicore, MIC, and GPGPU organizations
Present an overview of the evolution of the x86 architecture
Define embedded systems and list some of the requirements and constraints that various embedded systems must meet
Summarize some of the issues in computer performance assessment
1 This book’s Companion Web site contains several links to sites that provide photographs of many of the devices and components discussed in this section.
Trang 402.1 / A BRIEF HISTORY OF COMPUTERS 17
machine was enormous, weighing 30 tons, occupying 1500 square feet of floor space, and containing more than 18,000 vacuum tubes When operating, it consumed
140 kilowatts of power It was also substantially faster than any electromechanical computer, capable of 5000 additions per second
The ENIAC was a decimal rather than a binary machine That is, numbers were represented in decimal form, and arithmetic was performed in the decimal
system Its memory consisted of 20 accumulators, each capable of holding a 10-digit
decimal number A ring of 10 vacuum tubes represented each digit At any time, only one vacuum tube was in the ON state, representing one of the 10 digits The major drawback of the ENIAC was that it had to be programmed manually by setting switches and plugging and unplugging cables
The ENIAC was completed in 1946, too late to be used in the war effort Instead, its first task was to perform a series of complex calculations that were used
to help determine the feasibility of the hydrogen bomb The use of the ENIAC for
a purpose other than that for which it was built demonstrated its general- purpose nature The ENIAC continued to operate under BRL management until 1955, when it was disassembled
the ENIAC was extremely tedious But suppose a program could be represented in
a form suitable for storing in memory alongside the data Then, a computer could get its instructions by reading them from memory, and a program could be set or altered by setting the values of a portion of memory
This idea, known as the stored-program concept, is usually attributed to the
ENIAC designers, most notably the mathematician John von Neumann, who was
a consultant on the ENIAC project Alan Turing developed the idea at about the same time The first publication of the idea was in a 1945 proposal by von Neumann for a new computer, the EDVAC (Electronic Discrete Variable Computer).2
In 1946, von Neumann and his colleagues began the design of a new program computer, referred to as the IAS computer, at the Princeton Institute for Advanced Studies The IAS computer, although not completed until 1952, is the prototype of all subsequent general-purpose computers.3
stored-Figure 2.1 shows the general structure of the IAS computer (compare to dle portion of Figure 1.4) It consists of
• A main memory, which stores both data and instructions4
• An arithmetic and logic unit (ALU) capable of operating on binary data
• A control unit, which interprets the instructions in memory and causes them
to be executed
• Input/output (I/O) equipment operated by the control unit
2 The 1945 report on EDVAC is in the Premium Content section of this book’s Web site.
3 A 1954 report [GOLD54] describes the implemented IAS machine and lists the final instruction set It is provided in the Premium Content section of this book’s Web site.
4In this book, unless otherwise noted, the term instruction refers to a machine instruction that is directly
interpreted and executed by the processor, in contrast to an instruction in a high-level language, such as Ada or C++, which must first be compiled into a series of machine instructions before being executed.