computer systems-a programmer's perspective---chapter1

本文以hello.c程序为例,概述了程序从源代码到可执行文件的整个生命周期,并介绍了计算机系统的关键概念,包括高速缓存、进程、线程、虚拟内存等。同时探讨了shell的工作原理及系统的硬件组成。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

深入理解计算机系统第一章——计算机系统漫游


本章以hello.c程序为例,沿着该程序的生命周期,简要地介绍了逐步出现的关键概念、专业术语和组成部分。

该程序经历这几个阶段:预处理(.i)->编译(.s)->汇编(.o)->链接(可执行文件)。

shell是一个命令行解释器,它输出一个提示符,等待输入一个命令行,然后执行这个命令。如果该命令的第一个单词不是一个内置的shell命令,那么shell就会假设他是一个可执行文件的名字,它将加载并运行这个文件。


系统的硬件组成:总线、I/O设备、主存、处理器。


1.该章节的重要概念:

高速缓存、进程、线程、虚拟内存、文件、并发和并行以及抽象。

2.Amdahl定律:S=1/(1+a+a/k);

A Programmer's Perspective Most books on systemscomputer architecture, compilers, operating systems, and networking—are written as if the reader were going to design and implement such a system. We call this the “builder's persepective.” We believe that students should first learn about systems in terms of how they affect the behavior and performance of their programs—a “programmer's perspective.” Here are some simple examples showing the contrast between the two perspectives: Computer Arithmetic Logic design and computer architecture courses describe how to implement fast and efficient arithmetic circuits. For programmers, what really matters is how the finite word sizes used to represent integer and floating point data determines what values can be represented and the behavior of different operations. For example, consider the following C function to compute the squares of 5, 50, 500, 5000, 50000, 500000, and 5000000: void show_squares() { int x; for (x = 5; x <= 5000000; x*=10) printf("x = %d x^2 = %d\n", x, x*x); } When compiled on most machines, this program produces the following values: x = 5 x^2 = 25 x = 50 x^2 = 2500 x = 500 x^2 = 250000 x = 5000 x^2 = 25000000 x = 50000 x^2 = -1794967296 x = 500000 x^2 = 891896832 x = 5000000 x^2 = -1004630016 The first four values are exactly what one would expect, but the last three seem quite peculiar. We even see that the “square” of a number can be negative! Since data type int uses a 32-bit, two's complement representation on most machines, programs cannot represent the value 2.5 X 109 as an int. In Chapter 2 we cover the two's complement number system used to represent integers on most computers and its mathematical properties. We also cover the IEEE floating point representation from a programmer's perspective.
08-25
Operating Systems Courses in operating systems cover the design of the components of an operating system—scheduler, memory manager, file system, etc. Only a small fraction of programmers ever write this kind of code, though. On the other hand, they can access many features of the OS using system calls such as fork, wait, exec, etc. This level of programming is not generally covered in any course. In Chapter 8, we describe process management, and how programmers can make use of the process control features of Unix and Linux. Other Topics We cover a wide range of systems topics, all from a programmer's perspective. Besides those mentioned above, these include machine-level programming, optimizing compilers, processor architecture, linking, performance measurement, virtual memory, I/O, network programming and concurrency. In viewing what to cover about a subject and how to present it, we have used the filter “How could a sophisticated application programmer make use of this material?” Key Points The material in this book has direct value for programmers. Students find that it explains many of the mysterious problems they've already encountered, that it helps them write and debug code more efficiently, and that their programs are more reliable and efficient. Even if this is the only systems course they ever take, they will have achieved a higher level of competence than many entry-level programmers. The material in this book is unique. Much of it is not presented in any other book or taught in previous courses. Instead, a traditional coverage of systems requires programmers to figure out on their own how the characteristics of the systems they study in builder-centric courses can be exploited to improve their programs. Programmers must struggle through confusing Unix man pages or read advanced systems programming books just to use the simple process control functions provided by Unix. The book provides a solid foundation for builder-centric courses. We believe that more advanced systems courses should present systems from a builder's perspective. Students will be much better oriented to the needs and constraints of these systems by first studying them from a programmer's perspective. At Carnegie Mellon, our Introduction to Computer Systems course has become a prequisite for courses in both CS and ECE covering: operating systems, networking, compilers, computer graphics, computer architecture, and embedded system design. Copyright © 2011, 2015 Randal E. Bryant and David R. O'Hallaron翻译以上英文为中文
最新发布
08-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值