深入理解计算机系统 英文版 第3版
作者:(美)兰德尔·E.布莱恩特(Randal E.Bryant),(美)大卫·R.奥哈拉伦
出版时间:2017年版
内容简介
本书是一本将计算机软件和硬件理论结合讲述的经典教材,内容涵盖计算机导论、体系结构和处理器设计等多门课程。本书*大的特点是为程序员描述计算机系统的实现细节,通过描述程序是如何映射到系统上,以及程序是如何执行的,使读者更好地理解程序的行为,找到程序效率低下的原因。和第2版相比,本版内容上*大的变化是,从以IA32和x86-64为基础转变为完全以x86-64为基础。主要更新如下:· 基于x86-64,大量地重写代码,首次介绍对处理浮点数据的程序的机器级支持。· 处理器体系结构修改为支持64位字和操作的设计。· 引入更多的功能单元和更复杂的控制逻辑,使基于程序数据流表示的程序性能模型预测更加可靠。· 扩充关于用GOT和PLT创建与位置无关代码的讨论,描述了更加强大的链接技术(比如库打桩)。· 增加了对信号处理程序更细致的描述,包括异步信号安全的函数等。· 采用*新函数,更新了与协议无关和线程安全的网络编程。
目录
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