首页 > 其他分享 >CS:APP--Chapter01 : A tour of computer systems

CS:APP--Chapter01 : A tour of computer systems

时间:2022-12-31 23:24:03浏览次数:47  
标签:program -- APP tour computer file data hello

CS:APP--Chapter01 : A tour of computer systems

标签(空格分隔): CS:APP

目录


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]

  1. information
  2. 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


  1. CS:APP third edition,page 39. ↩︎

标签:program,--,APP,tour,computer,file,data,hello
From: https://www.cnblogs.com/UQ-44636346/p/17017547.html

相关文章

  • 2022年flag总结与2023年新的flag
    碎碎念正常讲有关年总应该是多方面的,虽然博客园是一个技术的平台,但我的一堆破烂事也会发在这里。毕竟只有这里是真的没人认识我年末来个总结我认为挺有必要,尤其是对那些......
  • 年终总结
    年终总结对于2022年总的来说,渗透方向有了实习经验、有了一些漏洞挖掘经验,但是基础还是不扎实2023年还是要返回去打一下靶场,把基础巩固巩固。然后有了一些新的方......
  • 聚焦技术,2022巨杉荣获国内外多家权威机构认可
    作为分布式数据库的领先企业巨杉成立十年来,一直聚焦分布式技术的自研与深耕在分布式数据库领域已取得丰硕的成果 回望2022,巨杉除在客户案例及产品方面屡获殊荣外也凭......
  • 动态代理
    动态代理1.什么是代理模式代理模式是一种设计模式,就是通过代理对象操作原对象并且给原对象添加一些额外功能。代理模式分为静态代理和动态代理两种2.静态代理静态代......
  • logistic回归
    一、概念logistic回归是一种广义线性回归(generalizedlinearmodel),因此与多重线性回归分析有很多相同之处。它们的模型形式基本上相同,都具有w‘x+b,其中w和b是待求参数,其......
  • pytest基础使用
    pytest记录pytest执行测试用例规则#.py测试文件必须以test_xxx.py开头,或者以(_test结尾)#测试类必须以Test开头,并且不能有init方法#测试方法必须以test_开头#断言......
  • Day6:结束基础语法学习
    运算符补充部分+,-,*,/packageoperator;publicclassDemo01{publicstaticvoidmain(String[]args){//二元运算符//Ctrl+D复制当前......
  • C语言两结构体之间的成员互换
    今天在写一个通讯录实现程序的时候,遇到个让我突然卡壳的问题,不知道怎么进行两个结构体之间的成员互换......结构体成员有“姓名”,“性别”,“年龄”,“地址”,“电话”,目的就......
  • buuctf-web-[极客大挑战 2019]PHP 1
    知识点:文件备份、反序列化打开网站后发现源码没有提示,页面提示“备份的好习惯”,用御剑扫后台,扫出www.zip,打开发现有几个php文件打开index.php发现关键代码<?phpin......
  • 解决WPF的TextBox的复制、剪切功能被其他应用程序妨碍的问题
    在一些应用程序运行时,它会使WPF的TextBox的复制、剪切功能发生错误,我遇到的情况是会卡顿并且无法成功执行。听说这个问题是由多个应用程序同时访问剪切板导致的。我解决了......