logo资料库

Computer Systems A Programmer’s Perspective (2nd Edition).pdf

第1页 / 共1078页
第2页 / 共1078页
第3页 / 共1078页
第4页 / 共1078页
第5页 / 共1078页
第6页 / 共1078页
第7页 / 共1078页
第8页 / 共1078页
资料共1078页,剩余部分请下载后查看
Cover
Title Page
Copyright
Contents
Preface
About the Authors
1 A Tour of Computer Systems
1.1 Information Is Bits + Context
1.2 Programs Are Translated by Other Programs into Different Forms
1.3 It Pays to Understand How Compilation Systems Work
1.4 Processors Read and Interpret Instructions Stored in Memory
1.4.1 Hardware Organization of a System
1.4.2 Running the hello Program
1.5 Caches Matter
1.6 Storage Devices Form a Hierarchy
1.7 The Operating System Manages the Hardware
1.7.1 Processes
1.7.2 Threads
1.7.3 Virtual Memory
1.7.4 Files
1.8 Systems Communicate with Other Systems Using Networks
1.9 Important Themes
1.9.1 Concurrency and Parallelism
1.9.2 The Importance of Abstractions in Computer Systems
1.10 Summary
Bibliographic Notes
Part I: Program Structure and Execution
2 Representing and Manipulating Information
2.1 Information Storage
2.2 Integer Representations
2.3 Integer Arithmetic
2.4 Floating Point
2.5 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
3 Machine-Level Representation of Programs
3.1 A Historical Perspective
3.2 Program Encodings
3.3 Data Formats
3.4 Accessing Information
3.5 Arithmetic and Logical Operations
3.6 Control
3.7 Procedures
3.8 Array Allocation and Access
3.9 Heterogeneous Data Structures
3.10 Putting It Together: Understanding Pointers
3.11 Life in the Real World: Using the GDB Debugger
3.12 Out-of-Bounds Memory References and Buffer Overflow
3.13 x86-64: Extending IA32 to 64 Bits
3.14 Machine-Level Representations of Floating-Point Programs
3.15 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
4 Processor Architecture
4.1 The Y86 Instruction Set Architecture
4.2 Logic Design and the Hardware Control Language HCL
4.3 Sequential Y86 Implementations
4.4 General Principles of Pipelining
4.5 Pipelined Y86 Implementations
4.6 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
5 Optimizing Program Performance
5.1 Capabilities and Limitations of Optimizing Compilers
5.2 Expressing Program Performance
5.3 Program Example
5.4 Eliminating Loop Inefficiencies
5.5 Reducing Procedure Calls
5.6 Eliminating Unneeded Memory References
5.7 Understanding Modern Processors
5.8 Loop Unrolling
5.9 Enhancing Parallelism
5.10 Summary of Results for Optimizing Combining Code
5.11 Some Limiting Factors
5.12 Understanding Memory Performance
5.13 Life in the Real World: Performance Improvement Techniques
5.14 Identifying and Eliminating Performance Bottlenecks
5.15 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
6 The Memory Hierarchy
6.1 Storage Technologies
6.2 Locality
6.3 The Memory Hierarchy
6.4 Cache Memories
6.5 Writing Cache-friendly Code
6.6 Putting It Together: The Impact of Caches on Program Performance
6.7 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
Part II: Running Programs on a System
7 Linking
7.1 Compiler Drivers
7.2 Static Linking
7.3 Object Files
7.4 Relocatable Object Files
7.5 Symbols and Symbol Tables
7.6 Symbol Resolution
7.7 Relocation
7.8 Executable Object Files
7.9 Loading Executable Object Files
7.10 Dynamic Linking with Shared Libraries
7.11 Loading and Linking Shared Libraries from Applications
7.12 Position-Independent Code (PIC)
7.13 Tools for Manipulating Object Files
7.14 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
8 Exceptional Control Flow
8.1 Exceptions
8.2 Processes
8.3 System Call Error Handling
8.4 Process Control
8.5 Signals
8.6 Nonlocal Jumps
8.7 Tools for Manipulating Processes
8.8 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
9 Virtual Memory
9.1 Physical and Virtual Addressing
9.2 Address Spaces
9.3 VM as a Tool for Caching
9.4 VM as a Tool for Memory Management
9.5 VM as a Tool for Memory Protection
9.6 Address Translation
9.7 Case Study: The Intel Core i7/Linux Memory System
9.8 Memory Mapping
9.9 Dynamic Memory Allocation
9.10 Garbage Collection
9.11 Common Memory-Related Bugs in C Programs
9.12 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
Part III: Interaction and Communication Between Programs
10 System-Level I/O
10.1 Unix I/O
10.2 Opening and Closing Files
10.3 Reading and Writing Files
10.4 Robust Reading and Writing with the Rio Package
10.5 Reading File Metadata
10.6 Sharing Files
10.7 I/O Redirection
10.8 Standard I/O
10.9 Putting It Together: Which I/O Functions Should I Use?
10.10 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
11 Network Programming
11.1 The Client-Server Programming Model
11.2 Networks
11.3 The Global IP Internet
11.4 The Sockets Interface
11.5 Web Servers
11.6 Putting It Together: The TINY Web Server
11.7 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
12 Concurrent Programming
12.1 Concurrent Programming with Processes
12.2 Concurrent Programming with I/O Multiplexing
12.3 Concurrent Programming with Threads
12.4 Shared Variables in Threaded Programs
12.5 Synchronizing Threads with Semaphores
12.6 Using Threads for Parallelism
12.7 Other Concurrency Issues
12.8 Summary
Bibliographic Notes
Homework Problems
Solutions to Practice Problems
A: Error Handling
A.1 Error Handling in Unix Systems
A.2 Error-Handling Wrappers
References
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Computer Systems A Programmer’s Perspective
This page intentionally left blank
Computer Systems A Programmer’s Perspective Randal E. Bryant Carnegie Mellon University David R. O’Hallaron Carnegie Mellon University and Intel Labs Prentice Hall Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
Editorial Director: Marcia Horton Editor-in-Chief: Michael Hirsch Acquisitions Editor: Matt Goldstein Editorial Assistant: Chelsea Bell Director of Marketing: Margaret Waples Marketing Coordinator: Kathryn Ferranti Managing Editor: Jeff Holcomb Senior Manufacturing Buyer: Carol Melville Art Director: Linda Knowles Cover Designer: Elena Sidorova Image Interior Permission Coordinator: Richard Rodrigues Cover Art: © Randal E. Bryant and David R. O’Hallaron Media Producer: Katelyn Boller Project Management and Interior Design: Paul C. Anagnostopoulos, Windfall Software Composition: Joe Snowden, Coventry Composition Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Color/Hagerstown Copyright © 2011, 2003 by Randal E. Bryant and David R. O’Hallaron. 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, 501 Boylston Street, Suite 900, Boston, Massachusetts 02116. Many of the designations by manufacturers and seller 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 Bryant, Randal. Computer systems : a programmer’s perspective / Randal E. Bryant, David R. O’Hallaron.—2nd ed. p. cm. (Computer systems) QA76.5.B795 2010 004—dc22 Includes bibliographical references and index. ISBN-13: 978-0-13-610804-7 (alk. paper) ISBN-10: 0-13-610804-0 (alk. paper) 1. Computer systems. 2. Computers. 3. Telecommunication. 4. User interfaces I. O’Hallaron, David Richard. II. Title. 2009053083 10 9 8 7 6 5 4 3 2 1—EB—14 13 12 11 10 ISBN 10: 0-13-610804-0 ISBN 13: 978-0-13-610804-7
To the students and instructors of the 15-213 course at Carnegie Mellon University, for inspiring us to develop and refine the material for this book.
This page intentionally left blank
Contents Preface xix About the Authors xxxiii 1 A Tour of Computer Systems 1 1.1 1.2 1.3 1.4 3 20 24 4 vii 7 Information Is Bits + Context Programs Are Translated by Other Programs into Different Forms It Pays to Understand How Compilation Systems Work 6 Processors Read and Interpret Instructions Stored in Memory 1.4.1 Hardware Organization of a System 7 1.4.2 Running the hello Program 10 Caches Matter 12 Storage Devices Form a Hierarchy The Operating System Manages the Hardware 1.7.1 Processes 1.7.2 Threads 17 1.7.3 Virtual Memory 17 1.7.4 Files 19 Systems Communicate with Other Systems Using Networks Important Themes 21 1.9.1 Concurrency and Parallelism 21 1.9.2 The Importance of Abstractions in Computer Systems Summary 25 Bibliographic Notes 26 13 16 14 1.5 1.6 1.7 1.8 1.9 1.10 Part I Program Structure and Execution 2 Representing and Manipulating Information 29 2.1 Information Storage 33 2.1.1 Hexadecimal Notation 34 2.1.2 Words 38 2.1.3 Data Sizes 38
分享到:
收藏