没有合适的资源?快使用搜索试试~ 我知道了~
首页深入解析程序员视角的计算机系统第二版
深入解析程序员视角的计算机系统第二版
需积分: 2 4 下载量 154 浏览量
更新于2024-07-21
收藏 6.75MB PDF 举报
《深入理解计算机系统(原书第2版)》[英文版]是一本由Randal E. Bryant和David R. O'Hallaron合著的经典计算机科学教材,专为程序员提供深入理解计算机系统运作机制的视角。本书作为计算机系统领域的权威指南,旨在帮助读者掌握从底层原理到高级设计的关键概念,使他们能够更好地设计、优化和调试软件。 该书以程序设计者的独特视角,探讨了计算机硬件与软件之间的交互,涵盖了计算机体系结构的核心主题,包括处理器、内存管理、并发控制、输入输出系统、操作系统以及网络通信等。通过理论分析和实践案例相结合的方式,作者引导读者理解计算机是如何处理数据、执行指令和执行任务的。 书中不仅深入剖析了计算机硬件的工作原理,还强调了抽象层次的重要性,让读者能够逐步剥离系统的复杂性,理解各个层面的逻辑关系。此外,作者还讨论了现代计算机架构中的热点问题,如虚拟化技术、并行计算和云计算,以及它们对系统性能和可扩展性的影响。 在编写过程中,这本书得到了业内专家的精心策划和编辑,包括Marcia Horton担任编辑总监,Michael Hirsch担任主编,以及多位专业人员负责项目管理、设计和排版。这些专业团队确保了内容的专业性和易读性,使得无论是初学者还是经验丰富的开发者都能从中受益匪浅。 《深入理解计算机系统(原书第2版)》不仅是一本理论教材,也是一本实践手册,它将理论与实践紧密结合,帮助读者建立起对计算机系统全面而深入的理解,从而提升他们的编程技能和解决问题的能力。无论是在学术研究还是职业发展道路上,这都是一本不可或缺的参考书籍。
资源详情
资源推荐
Contents xv
9.7.1 Core i7 Address Translation 800
9.7.2 Linux Virtual Memory System 803
9.8 Memory Mapping 807
9.8.1 Shared Objects Revisited 807
9.8.2 The
fork Function Revisited 809
9.8.3 The
execve Function Revisited 810
9.8.4 User-level Memory Mapping with the
mmap Function 810
9.9 Dynamic Memory Allocation 812
9.9.1 The
malloc and free Functions 814
9.9.2 Why Dynamic Memory Allocation? 816
9.9.3 Allocator Requirements and Goals 817
9.9.4 Fragmentation 819
9.9.5 Implementation Issues 820
9.9.6 Implicit Free Lists 820
9.9.7 Placing Allocated Blocks 822
9.9.8 Splitting Free Blocks 823
9.9.9 Getting Additional Heap Memory 823
9.9.10 Coalescing Free Blocks 824
9.9.11 Coalescing with Boundary Tags 824
9.9.12 Putting It Together: Implementing a Simple Allocator 827
9.9.13 Explicit Free Lists 835
9.9.14 Segregated Free Lists 836
9.10 Garbage Collection 838
9.10.1 Garbage Collector Basics 839
9.10.2 Mark&Sweep Garbage Collectors 840
9.10.3 Conservative Mark&Sweep for C Programs 842
9.11 Common Memory-Related Bugs in C Programs 843
9.11.1 Dereferencing Bad Pointers 843
9.11.2 Reading Uninitialized Memory 843
9.11.3 Allowing Stack Buffer Overflows 844
9.11.4 Assuming that Pointers and the Objects They Point to Are the
Same Size 844
9.11.5 Making Off-by-One Errors 845
9.11.6 Referencing a Pointer Instead of the Object It Points to 845
9.11.7 Misunderstanding Pointer Arithmetic 846
9.11.8 Referencing Nonexistent Variables 846
9.11.9 Referencing Data in Free Heap Blocks 847
9.11.10 Introducing Memory Leaks 847
9.12 Summary 848
Bibliographic Notes 848
Homework Problems 849
Solutions to Practice Problems 853
xvi Contents
Part III Interaction and Communication Between
Programs
10
System-Level I/O 861
10.1 Unix I/O 862
10.2 Opening and Closing Files 863
10.3 Reading and Writing Files 865
10.4 Robust Reading and Writing with the Rio Package 867
10.4.1 Rio Unbuffered Input and Output Functions 867
10.4.2 Rio Buffered Input Functions 868
10.5 Reading File Metadata 873
10.6 Sharing Files 875
10.7 I/O Redirection 877
10.8 Standard I/O 879
10.9 Putting It Together: Which I/O Functions Should I Use? 880
10.10 Summary 881
Bibliographic Notes 882
Homework Problems 882
Solutions to Practice Problems 883
11
Network Programming 885
11.1 The Client-Server Programming Model 886
11.2 Networks 887
11.3 The Global IP Internet 891
11.3.1 IP Addresses 893
11.3.2 Internet Domain Names 895
11.3.3 Internet Connections 899
11.4 The Sockets Interface 900
11.4.1 Socket Address Structures 901
11.4.2 The
socket Function 902
11.4.3 The
connect Function 903
11.4.4 The
open_clientfd Function 903
11.4.5 The
bind Function 904
11.4.6 The
listen Function 905
11.4.7 The
open_listenfd Function 905
11.4.8 The
accept Function 907
11.4.9 Example Echo Client and Server 908
Contents xvii
11.5 Web Servers 911
11.5.1 Web Basics 911
11.5.2 Web Content 912
11.5.3 HTTP Transactions 914
11.5.4 Serving Dynamic Content 916
11.6 Putting It Together: The Tiny Web Server 919
11.7 Summary 927
Bibliographic Notes 928
Homework Problems 928
Solutions to Practice Problems 929
12
Concurrent Programming 933
12.1 Concurrent Programming with Processes 935
12.1.1 A Concurrent Server Based on Processes 936
12.1.2 Pros and Cons of Processes 937
12.2 Concurrent Programming with I/O Multiplexing 939
12.2.1 A Concurrent Event-Driven Server Based on I/O
Multiplexing 942
12.2.2 Pros and Cons of I/O Multiplexing 946
12.3 Concurrent Programming with Threads 947
12.3.1 Thread Execution Model 948
12.3.2 Posix Threads 948
12.3.3 Creating Threads 950
12.3.4 Terminating Threads 950
12.3.5 Reaping Terminated Threads 951
12.3.6 Detaching Threads 951
12.3.7 Initializing Threads 952
12.3.8 A Concurrent Server Based on Threads 952
12.4 Shared Variables in Threaded Programs 954
12.4.1 Threads Memory Model 955
12.4.2 Mapping Variables to Memory 956
12.4.3 Shared Variables 956
12.5 Synchronizing Threads with Semaphores 957
12.5.1 Progress Graphs 960
12.5.2 Semaphores 963
12.5.3 Using Semaphores for Mutual Exclusion 964
12.5.4 Using Semaphores to Schedule Shared Resources 966
12.5.5 Putting It Together: A Concurrent Server Based on
Prethreading 970
12.6 Using Threads for Parallelism 974
xviii Contents
12.7 Other Concurrency Issues 979
12.7.1 Thread Safety 979
12.7.2 Reentrancy 980
12.7.3 Using Existing Library Functions in Threaded Programs 982
12.7.4 Races 983
12.7.5 Deadlocks 985
12.8 Summary 988
Bibliographic Notes 989
Homework Problems 989
Solutions to Practice Problems 994
A
Error Handling 999
A.1 Error Handling in Unix Systems 1000
A.2 Error-Handling Wrappers 1001
References 1005
Index 1011
Preface
This book (CS:APP) is for computer scientists, computer engineers, and others
who want to be able to write better programs by learning what is going on “under
the hood” of a computer system.
Our aim is to explain the enduring concepts underlying all computer systems,
and to show you the concrete ways that these ideas affect the correctness, perfor-
mance, and utility of your application programs. Other systems books are written
from a builder’s perspective, describing how to implement the hardware or the sys-
tems software, including the operating system, compiler, and network interface.
This book is written from a programmer’s perspective, describing how application
programmers can use their knowledge of a system to write better programs. Of
course, learning what a system is supposed to do provides a good first step in learn-
ing how to build one, and so this book also serves as a valuable introduction to
those who go on to implement systems hardware and software.
If you study and learn the concepts in this book, you will be on your way to
becoming the rare “power programmer” who knows how things work and how
to fix them when they break. Our aim is to present the fundamental concepts in
ways that you will find useful right away. You will also be prepared to delve deeper,
studying such topics as compilers, computer architecture, operating systems, em-
bedded systems, and networking.
Assumptions about the Reader’s Background
The presentation of machine code in the book is based on two related formats
supported by Intel and its competitors, colloquially known as “x86.” IA32 is the
machine code that has become the de facto standard for a wide range of systems.
x86-64 is an extension of IA32 to enable programs to operate on larger data and to
reference a wider range of memory addresses. Since x86-64 systems are able to run
IA32 code, both of these forms of machine code will see widespread use for the
foreseeable future. We consider how these machines execute C programs on Unix
or Unix-like (such as Linux) operating systems. (To simplify our presentation,
we will use the term “Unix” as an umbrella term for systems having Unix as
their heritage, including Solaris, Mac OS, and Linux.) The text contains numerous
programming examples that have been compiled and run on Linux systems. We
assume that you have access to such a machine and are able to log in and do simple
things such as changing directories.
If your computer runs Microsoft Windows, you have two choices. First, you
can get a copy of Linux (www.ubuntu.com) and install it as a “dual boot” option,
so that your machine can run either operating system. Alternatively, by installing
a copy of the Cygwin tools (www.cygwin.com), you can run a Unix-like shell under
xix
剩余1077页未读,继续阅读
sinat_33202840
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- OptiX传输试题与SDH基础知识
- C++Builder函数详解与应用
- Linux shell (bash) 文件与字符串比较运算符详解
- Adam Gawne-Cain解读英文版WKT格式与常见投影标准
- dos命令详解:基础操作与网络测试必备
- Windows 蓝屏代码解析与处理指南
- PSoC CY8C24533在电动自行车控制器设计中的应用
- PHP整合FCKeditor网页编辑器教程
- Java Swing计算器源码示例:初学者入门教程
- Eclipse平台上的可视化开发:使用VEP与SWT
- 软件工程CASE工具实践指南
- AIX LVM详解:网络存储架构与管理
- 递归算法解析:文件系统、XML与树图
- 使用Struts2与MySQL构建Web登录验证教程
- PHP5 CLI模式:用PHP编写Shell脚本教程
- MyBatis与Spring完美整合:1.0.0-RC3详解
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功