A computer system consists of hardware and systems software that work together to run application programs. Specific implementations of systems change over time, but the underlying concepts do not. All computers have similar hardware and software components that perform similar functions. This book is written for programmers who want to get better at their craft by understanding how these components work and how they affect the correctness and performance of their programs.
You are poised for an exciting journey.If you dedicate yourself to learning the concepts in this book. Then you will be on your way to becoming a are "power programmer", enlightened by an understanding of the underlying computer system and its impacts on your application programs.(为了这一目标,还不能坚持把本书啃完吗!?)
You are going to learn practical skills such an how to avoid strange numerical errors caused by the way that computers represent numbers. You will learn how to optimize your c code by using clever tricks that exploit the designs of modern processors and memory systems. You will learn how the compiler implements procedure calls and how to use this knowledge to avoid to the security holes from buffer overflow vulnerabilities that plague network and internet software. You will learn how to recognize and avoid the nasty errors during linking that confound the average programmer. You will learn how to write you own Unix shell, your own dynamic storage allocation package, and even you own Web Server. You will learn the promises and pitfalls of concurrency, a topic of increasing importance as multiple processor cores are integrated onto single chips.
In their classic text on the C programming language, Kernighan and Ritchie introduce readers to C using the hello program shown in figure 1.1. Although hello is a very simple program, every major part of the system must work in concert in order for it to run to completion. In a sense, the goal of this book is to help you understand what happens and why, when you run hello on your system.
We begin our study of systems by tracing the lifetime of the hello program, from the time it is created by a programmer, until it runs on a system, prints its simple message, and terminates. As we follow the lifetime of the program, we will briefly introduce the key concepts, terminology, components that come into play. Later chapters will expand on these ideas.
__________________________________________code/intro/hello.c
1. #include <stdio.h>
2.
3. int main()
4. {
5. printf("hello, world\n");
6. }
__________________________________________code/intro/hello.c
figure 1.1 The hello program.