Randal E. Bryant,1981年于麻省理工学院获得计算机博士学位,1984年至今任教于卡内基-梅隆大学。现任卡内基-梅隆大学计算机科学学院院长、教授,同时还受邀任教于电子和计算机工程系。他从事本科生和研究生计算机系统方面课程的教学近40年,和O’Hallaron教授一起在卡内基-梅隆大学开设了15-213课程“计算机系统导论”,那便是本书的基础。他还是ACM院士、IEEE院士、美国国家工程院院士和美国人文与科学研究院院士。其研究成果被Intel、IBM、Fujitsu和Microsoft等主要计算机制造商使用,他还因研究获得过Semiconductor Research Corporation、ACM、IEEE颁发的多项大奖。
David R. O’Hallaron,卡内基-梅隆大学电子和计算机工程系教授。在弗吉尼亚大学获得计算机科学的博士学位,2007年-2010年为Intel匹兹堡实验室主任。他教授本科生和研究生的计算机系统方面的课程已有20余年,并和Bryant教授一起教授“计算机系统导论”课程。曾获得卡内基-梅隆大学计算机学院颁发的Herbert Simon杰出教学奖。他主要从事计算机系统领域的研究,与Quake项目成员一起获得过高性能计算领域中的*高国际奖项——Gordon Bell奖。他目前的工作重点是研究自动分级(autograding)概念,即评价其他程序质量的程序。
Preface xix About the Authors xxxv
1 A Tour of Computer Systems 1
1.1 Information Is Bits + Context 3
1.2 Programs Are Translated by Other Programs into Different Forms 4
1.3 It Pays to Understand How Compilation Systems Work 6
1.4 Processors Read and Interpret Instructions Stored in Memory 7
1.5 Caches Matter 11
1.6 Storage Devices Form a Hierarchy 14
1.7 The Operating System Manages the Hardware 14
1.8 Systems Communicate with Other Systems Using Networks 19
1.9 Important Themes 22
1.10 Summary 27 Bibliographic Notes 28 Solutions to Practice Problems 28
Part I Program Structure and Execution
2 Representing and Manipulating Information 31
2.1 Information Storage 34
2.2 Integer Representations 59
2.3 Integer Arithmetic 84
2.4 Floating Point 108
2.5 Summary 126
Bibliographic Notes 127
Homework Problems 128
Solutions to Practice Problems 143
3 Machine-Level Representation of Programs 163
3.1 A Historical Perspective 166
3.2 Program Encodings 169
3.3 Data Formats 177
3.4 Accessing Information 179
3.5 Arithmetic and Logical Operations 191
3.6 Control 200
3.7 Procedures 238
3.8 Array Allocation and Access 255
3.9 Heterogeneous Data Structures 265
3.10 Combining Control and Data in Machine-Level Programs 276
3.11 Floating-Point Code 293
3.12 Summary 309
Bibliographic Notes 310
Homework Problems 311
Solutions to Practice Problems 325
4 Processor Architecture 351
4.1 The Y86-64 Instruction Set Architecture 355
4.2 Logic Design and the Hardware Control Language HCL 372
4.3 Sequential Y86-64 Implementations 384
4.4 General Principles of Pipelining 412
4.5 Pipelined Y86-64 Implementations 421
4.6 Summary 470
4.6.1 Y86-64 Simulators 472
Bibliographic Notes 473
Homework Problems 473
Solutions to Practice Problems 480
5 Optimizing Program Performance 495
5.1 Capabilities and Limitations of Optimizing Compilers 498
5.2 Expressing Program Performance 502
5.3 Program Example 504
5.4 Eliminating Loop Inef.ciencies 508
5.5 Reducing Procedure Calls 512
5.6 Eliminating Unneeded Memory References 514
5.7 Understanding Modern Processors 517
5.8 Loop Unrolling 531
5.9 Enhancing Parallelism 536
5.10 Summary of Results for Optimizing Combining Code 547
5.11 Some Limiting Factors 548
5.12 Understanding Memory Performance 553
5.13 Life in the Real World: Performance Improvement Techniques 561
5.14 Identifying and Eliminating Performance Bottlenecks 562
5.15 Summary 568
Bibliographic Notes 569
Homework Problems 570
Solutions to Practice Problems 573
6 The Memory Hierarchy 579
6.1 Storage Technologies 581
6.2 Locality 604
6.3 The Memory Hierarchy 609
6.4 Cache Memories 614
6.5 Writing Cache-Friendly Code 633
6.6 Putting It Together: The Impact of Caches on Program Performance 639
6.7 Summary 648
Bibliographic Notes 648
Homework Problems 649
Solutions to Practice Problems 660
Part II Running Programs on a System
7 Linking 669
7.1 Compiler Drivers 671
7.2 Static Linking 672
7.3 Object Files 673
7.4 Relocatable Object Files 674
7.5 Symbols and Symbol Tables 675
7.6 Symbol Resolution 679
7.7 Relocation 689
7.8 Executable Object Files 695
7.9 Loading Executable Object Files 697
7.10 Dynamic Linking with Shared Libraries 698
7.11 Loading and Linking Shared Libraries from Applications 701
7.12 Position-Independent Code (PIC) 704
7.13 Library Interpositioning 707
7.14 Tools for Manipulating Object Files 713
7.15 Summary 713
Bibliographic Notes 714
Homework Problems 714
Solutions to Practice Problems 717
8 Exceptional Control Flow 721
8.1 Exceptions 723
8.2 Processes 732
8.3 System Call Error Handling 737
8.4 Process Control 738
8.5 Signals 756
8.6 Nonlocal Jumps 781
8.7 Tools for Manipulating Processes 786
8.8 Summary 787
Bibliographic Notes 787
Homework Problems 788
Solutions to Practice Problems 795
9 Virtual Memory 801
9.1 Physical and Virtual Addressing 803
9.2 Address Spaces 804
9.3 VM as a Tool for Caching 805
9.4 VM as a Tool for Memory Management 811
9.5 VM as a Tool for Memory Protection 812
9.6 Address Translation 813
9.7 Case Study: The Intel Core i7/Linux Memory System 825
9.8 Memory Mapping 833
9.9 Dynamic Memory Allocation 839
9.10 Garbage Collection 865
9.11 Common Memory-Related Bugs in C Programs 870
9.12 Summary 875
Bibliographic Notes 876
Homework Problems 876
Solutions to Practice Problems 880
Part III Interaction and Communication between Programs
10 System-Level I/O 889
11 Network Programming 917
12 Concurrent Programming 971
12.1 Concurrent Programming with Processes 973
12.2 Concurrent Programming with I/O Multiplexing 977
12.3 Concurrent Programming with Threads 985
12.4 Shared Variables in Threaded Programs 992
12.5 Synchronizing Threads with Semaphores 995
12.6 Using Threads for Parallelism 1013
12.7 Other Concurrency Issues 1020
12.8 Summary 1030