[CSAPP] Chapter 1 Overview of Computer
1.1 information is bits + context
All computer programs are just a sequence of bits, each with a value of 0 or 1, organized in 8-bit chunks called by bytes.
8 bits = 1 byte
All files is binary files.
1.2 Programs are translated by other programs into different forms

To compile a program, we have 4 phases.
Preprocessoring phases: The preprocessor modifies the original program acording to the character in the program.
The result is another program. Just like how preprocessor deal with '#' in C program.
Compiler phases: translate high-level language into assembler language
Assembler phases: translate the program into machine language
Linker phases: link to the standard libary
1.4 Processors read and Interpret Instructions stored in memory
The shell is a command-line interpreter. If the first word does not correspond to a built-in shell command, then shell will assume that it's a executable file.
1.4.1 Hardware organization of a System

Buses: running through the system, a collection of electrical conduits
carry bytes of information between devices
I/O Devices: system's connection to the external world
Each I/O device is connected to the I/O bus by either a controlled or an adapter.
Main memory: a temporary storage device
Processor: CPU or simple processor, control the hold system
1.5 Caches Matter
A system spend a lot of time moving information from one place to another.
A major goal is decrease the copy time.
The major part of copy time is copying between processor and memory.
Between these two devices, we have processor-memory gap.
To solve this problem, we will use cache.

1.6 storage devices form a hierarchy

1.7 OS manage the hardware
OS is a layer between the application program and the hardware.

purpose:
(1) protect hardware from misuse;
(2) make the hardware easy to use.

1.7.1 Processes
A process is the operating system's abstraction for a running program.
Multiple processes can run concurrently on the same system, and each process appears to have exclusive use of hardware.
Single CPU can appear to execute multiple processes concurrently by having the processor switch among them.
This mechanism is called context switching.

1.7.2 Threads
Threads running in the context of the process and sharing the same code and global data
Multi-threading can make program run faster.
1.7.3 virtual memory
Virtual memory is an abstraction that provides each process with the illusion that it has exclusive use of the main memory.
Each process -----> uniform view of memory -----> virtual address space

Program code and data:
Code begins at the same fixed address for all process followed by data locations.
Heap:
expand and contract dynamically at run time as a result of calls to standard C library routines such as malloc and free.
Shared libraries:
hold the codes and data for shared libraries such as C standard library and the math library
Stack:
compiler uses to implement functions call
expand and contract dynamically at run time
Kernel Virtual Memory:
the part of OS
1.7.4 files
A sequence of bytes
Every I/O devices is modeled as a file
1.8 Systems communicate with other systems using Networks
networks can be just viewed as an I/O device.
main memory ---> network adapter ----> network ----> another machine

1.9 Important Themes
1.9.1 Concurrency and Parallelism
Thread-level concurrency:
multiple programs execute at the same time
Hyperthreading = simultaneous multi-threading allows a single CPU to execute multiple flows of control.

Instruction-level Parallelism:
Processors execute multiple instructions at one time.
Single-instruction, Multiple-Data(SIMD) Parallelism:
special hardware allows a single instruction to cause multiple operations to be performed in parallel
1.9.2 The importance of abstractions in Computer System
formulate a simple application-program interface (API) for a set of functions that allows programmers to use the code without diving into its inner workings

1.10 summary
computer system = hardware + software
Information = groups of bits
Computer spends most of time copying data ----> the storage device is a hierarchy
3 fundamenta abstractions:
(1) Files are abstractions for I/O devices.
(2) Virtual memory is an abstraction for both main memory and disk.
(3) Processes are abstractions for the processor, main memory and I/O device.
[CSAPP] Chapter 1 Overview of Computer的更多相关文章
- CSAPP Chapter 8:Exception Control Flow
prcesssor在运行时,假设program counter的值为a0, a1, ... , an-1,每个ak表示相对应的instruction的地址.从ak到ak+1的变化被称为control ...
- Chapter 2. Overview gradle概览
2.1. Features //gradle特性 Here is a list of some of Gradle's features. Declarative builds and build-b ...
- optimization blocks (csapp chapter 5.1)
p_511 编译器在没有指示下,会做‘ safe optimization',因此有些优化在没有参数的指示下是不会对代码做优化的,故在程序中应该避免某一类代码,因为它们妨碍了编译器做优化. optim ...
- Chapter 1. Introduction gradle介绍
We would like to introduce Gradle to you, a build system that we think is a quantum leap for build ...
- 计算机网络 Computer Networks 期末复习总提纲
平时不学习,期末火葬场. 一周时间靠王道考研和各路 pdf 自学计网,留下的提纲都在这里了.全是干货.全文 pdf 可以在这里下载:http://cloud.billc.io/s/xNHarppQPG ...
- Networked Graphics: Building Networked Games and Virtual Environments (Anthony Steed / Manuel Fradinho Oliveira 著)
PART I GROUNDWORK CHAPTER 1 Introduction CHAPTER 2 One on One (101) CHAPTER 3 Overview of the Intern ...
- Image Segmentation的定义
Definition 图像分割将一张图分为\(n\)个region, 需要满足下面5个条件 每一个像素都要属于一个region 每个region都是连通的 region与region之间没有交集 re ...
- 正则表达式——语法
正则表达式(regular expression)--描述一种字符串匹配模式,可以用来检测一个字符串是否包含特定的子串.用其他字符串将其代替.提取出某个符合要求的子串. 正则表达式 由普通字符 和 ...
- <转载> OpenGL Projection Matrix
原文 OpenGL Projection Matrix Related Topics: OpenGL Transformation Overview Perspective Projection Or ...
随机推荐
- iOS runloop 自定义输入源
创建自定义输入源需要定义以下内容 1)输入源要处理的信息 2)使感兴趣的客户端知道如何和输入源交互的调度例程 3)处理其他任何客户发送请求的例程 4)使输入源失效的取消例程 上图的处理流程:主线程(M ...
- css3实现对radio和checkbox的美化
一,如何隐藏小程序中的很粗的滚动条,实现页面的美化? tit: 在开发小程序的过程中,无论是横向或者纵向当产生滚动条时,系统默认的滚动条会很粗,效果展示十分难看,我们可以通过设置如下wxss代码实 ...
- 【剑指offer】反转链表,C++实现(链表)
1.题目 输入一个链表的头结点,首先反转链表后,然后输出链表的所有元素(牛客网). struct ListNode { int val; struct ListNode *next; }; 2.思路 ...
- GLSL 内建函数
内建函数基本上可以分为一下三类: (1)它们使用一些简便的方式提供必要的硬件功能,如材质贴图.这些函数单独通过着色器是无法模拟出来的. (2)它们展示了一些可以常简单的写入的繁琐操作(clamp, m ...
- MySQL实战 | 04 为什么要使用索引?
原文链接:MySQL实战 | 为什么要使用索引? 用过 MySQL 的应该都知道索引是干啥的吧,应该多少都设置过索引,但是若是问你索引是怎么实现的,你能说上来吗? 索引是什么? MySQL 官方对索引 ...
- #ifndef/#define/#endif以及#if defined/#else/#endif使用详解
1.#ifndef_WINDOWS_PLAYM4_H_ #define _WINDOWS_PLAYM4_H_ #endif 问题:想必很多人都看过"头文件中的 #ifndef/#d ...
- 【oracle】Oracle中as关键字
在Oracle中as关键字不能用于指定表的别名 在Oracle中指定表的别名时只需在原有表名和表的别名之间用空格分隔即可 但as关键字可以用于指定列的别名 但在存储过程中如果列的别名与原有列名相同,在 ...
- LeetCode 417. Pacific Atlantic Water Flow
原题链接在这里:https://leetcode.com/problems/pacific-atlantic-water-flow/description/ 题目: Given an m x n ma ...
- 在linux修改文件夹及其子文件夹的权限。
加入-R 参数,就可以将读写权限传递给子文件夹例如chmod -R 777 /home/mypackage那么mypackage 文件夹和它下面的所有子文件夹的属性都变成了777.777是读.写.执行 ...
- FastAdmin 中 Bootstrap-Table 列宽控制
FastAdmin 中 Bootstrap-Table 列宽控制 使用 css 控制 1 使用 formatter 处理 2 http://issues.wenzhixin.net.cn/bootst ...