CS:APP--Chapter01 : A tour of computer systems
标签(空格分隔): CS:APP
目录- CS:APP--Chapter01 : A tour of computer systems
- 1.1 Information Is Bits + Context [chapter 2 overview]
- 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.5 Caches Matter
- 1.6 Storage Devices Form a Hierarchy
- 1.7 The Operating System Manages the Hardware
- 1.8 Systems Communicate with Other Systems Using Networks
- 1.9 Important Themes
- 1. Summary
NOTE: This is a brief introduction as a result of the overwheling knowledge this book shows and poor capability the author has of learning new knowledge.
The various and particular hardwares and softwares are composed of a computer system. Even though the evolution of computer goes ahead greatly,the underlying concepts don't change at all.
We begin with 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.
1.1 Information Is Bits + Context [chapter 2 overview]
Our hello program begins life with a source program (or source file) that the programmer creates with an editor and saves in a text file called hello.c. The source program is a sequence of bits, each with a value of 0 or 1, organized in 8-bit chunks called bytes. Each byte represents some text character in the program.
[source file,byte,bit,sequence]
Most computer systems represent text characters using the ASCII standard that represents each character with a unique byte-size integer value.(Other encoding methods are used to represent text in non-English language.)
The hello.c program is stored in a file as a sequence of bytes. Each byte has an integer value that corresponds to some character.
- Files such as hello.c that consist exclusively of ASCII characters are known as text files.
- All other files are known as binary files.
The representation of hello.c illustrates a fundamental idea: All information in a system—including disk files, programs stored in memory, user data stored in memory, and data transferred across a network—is represented as a bunch of bits.The only thing that distinguishes different data objects is the context in which we view them. [1]
- information
- context
As programmers, we need to understand machine representations of numbers because they are not the same as integers and real numbers. They are finite approximations that can behave in unexpected ways.
1.2 Programs Are Translated by Other Programs into Different Forms
The hello program begins life as a high-level C program because it can be read and understood by human beings in that form.The individual C statements must be translated by other programs into a sequence of low-level machine-language instructions. These instructions are then packaged in a form called an executable object program and stored as a binary disk file. Object programs are also referred to as executable object files.
A simplified demonstration for the lifetime of hello.c is shown below:
|steps|phase+software|file|
|--|--|
|0(initialzation)|editor|hello.c|
|1|preprocessing(preprocessor abbreviated by cpp)|hello.i|
|2|compilation(compiler)|hello.s|
|3|assembly(assembler)|hello.o(relocatable object file)|
|4|linking(linker)|hello.o(executable object file)|
On a Unix system, the translation from source file to object file is performed by a compiler driver:
(my own thoughts after learning the chapter 2:representing and manipulating information)
the information restored in computer and network(not reached yet!) are representated as a run of binaray numbers.So making how to represent integer as well as float and operate the arithmetic operation (happen to be a series of modular operation)clear can drive us further to learn the advanced techniques demonstrated in chapter 3,what is more is avoiding the bugs brought onto by some intuitive behaviors like the mixed type in one logic expression leading to the conversion of data type ,for example,convert int to unsigned int.
1.3 It Pays to Understand How Compilation Systems Work
Even though we've learnt the knowledge of different forms of files along the compilation of hello.c,but it's better to dig in the detail of how the computer itself work:
(1):the more information of computer we obtain,the more easily we coax computer to run program at a high-performance .
(2):have idea of how errors emerges during link-time.Due to the global or local variables declared in the file instead of main file,relocating head file is such a time-consuming and error-prone task.
1.4 Processors Read and Interpret Instructions Stored in Memory
This section may be beyond the mamimum number of characters this editor can hold if I would have detailened the each sub-component of computer system,So just the placement of a simple introduction for them is here instead.
- | name | description |
---|---|---|
1 | bus | conduits |
2 | processor | CPU |
3 | main memory | storage for arithmetic operation,etc |
4 | I/O devices | a device where data is read and wrote via interface such as controller and adapter. |
Then ,generally speaking, these steps play an important role during the lifetime of hello.c:
load->stoe->store->operate->jump.
1.5 Caches Matter
There is a increasing gap between the demand of CPU and the supply of register per second,so it's necessary to make data being suppied faster for a faster exexution of CPU,which can be solved by cache .
1.6 Storage Devices Form a Hierarchy
1.7 The Operating System Manages the Hardware
1.8 Systems Communicate with Other Systems Using Networks
1.9 Important Themes
1. Summary
CS:APP third edition,page 39. ↩︎