0XFF-96 / golang-snippet

My practice code repo
3 stars 0 forks source link

202009019-CSAPP-READING-NOTES #21

Closed 0XFF-96 closed 3 years ago

0XFF-96 commented 4 years ago

Aside

This is the repo I used for keep track of my reading notes of CSAPP book .

I would like to challenge myself to keep notes in english . Because I am reading this book in english version.

And there are a few rules I set up for myself, as the following:

0XFF-96 commented 4 years ago

Chapter 1 -Notes

Chapter 1 is the roadmap of this book started by a simple example that every programmer should have known - The "Hello world" program.

Unlike the other book's, The author break this program down into serval part and introduces the idea in computer systems by tracing the life cycle of the program, which give me a more clear picture of what this program doing in machine level.

There is a few key opinions I would like to bear in mind in the future .

Bits + Context = Information .

If you search wiki for the definition of information, there is a lots[bad expression] of sayings. But the author says, in the computer science context, information is equal to bits with context. information can be defined to bits with context.

what is it context the above talking about ? I thought it mean the state of cpu register or the state of the process, for which it can take the same input bits, but interpret it into different objects.

A memory hierarchy

Why we need memory hierarch ? Because, On top of the memory hierarchy memory has faster access time, less capacity and higher cost per bit stored. At the bottom there is larger storage capacity, slower access time and lower cost per bit stored.

As the book says

As we move from the top of hierarchy to the bottom, the devices become slower, larger, and less costly per byte. 

More Detail: Memory Hierarchy Introduction

Operating system manages the hardware

There two primary purposes of operating system:

So it can be discussed into three parts: process、virtual memory、files.

Level of concurrency

There is a three ways of concurrency:

What is the different of these three levels ? how to distinguish them from each other ?

REFERENCE

Aside

这些有趣的表达,在中译本会被翻译成什么样呢?

0XFF-96 commented 4 years ago

Chapter 2 -Notes

This section is mainly talking about how to represent and manipulate information. And it reveals the relationship between the representation of bits and the implementation of bits . The most important things the author want us to figure out is that casting between signed and unsigned number of different data size.

there is a few key points .

Information storage

Most Computer use blocks of eight bits, or bytes. Bit operation do not subject(obey) to common mathematical properties, such as associativity, commutativity, and distributivity, which allows compiler to do many optimizations.

two-conventions:

ordering becomes issues

Integer Representations

image

Aside

Reference

0XFF-96 commented 4 years ago

Chatper 3 Notes

When it comes to Assembly, many programers will stop and get stuck here. And starting to complain about it, like why shall we learn this kind of low-level language, since we can do almost everything by using high-level language like C++, C, Golang. To be honest, I was one of them before I forced my self to go through this obstacle. Now I have a lots of reason telling why we should study Assembly and have a better understanding of it.

Why every programmers should learn assembly ?

Tools we use for learning Assembly

What to learn

Concept

REFERENCE

Aside

0XFF-96 commented 4 years ago

Chapter 3 Notes 2

This is a difficult chapter I have encountered so far ! not only requiring us to read the book again and again, but also we need to run the assembly code in machine . For my own opinion, this chapter can be break down into a few topic below. we much know the levels of abstraction of different code

image

image

Conclusion

example

Case1:

image

Case2: Leq 和 salq 相关指令

image

Aside

0XFF-96 commented 4 years ago

Operand Combinations

image

image

image

image

相关情况。

image

Leq 和 salq 相关指令

image

0XFF-96 commented 4 years ago

Chapter 6 The Memory hierarchy

This week we skip a few chapter and moved on to chapter 6 the memory hierarchy. The author introduces us a few key concepts, such as the locality of the program and memory hierarchy of storage.

About RAM(random-access-memory)

there mainly two kind of ram , (static ram and Dynamic ram) .

SRAM is for Cache memories, but DRAM is for Main memories, frame buffers.

Bus connection

Store operation: movq %rax, A Load operation: movq A, %rax

image

what it is inside disk ?

disk consists of serval parts including actuator、arm、spindle、platters、scsi connector。

0XFF-96 commented 4 years ago

chapter Linker

why learning about linking ?

why linkers ?

obj file and ELF

there are three kind of object file, .o file and a.out file and .so file . image

How linkers resolve multiply defined global symbols

the linker's algorithm

image

interpositionning

image

summary

0XFF-96 commented 4 years ago

ECF = Exceptional Control Flow

image

Concept

Control Flow

For program state

there are two ways can change the control flow . But it is insufficient for a useful system.

For system state

An exception is a transfer of control to the os kernel in response to some event.

it can be classify into two sets: low level mechanisms and higher level mechanisms.

image

image

concept

image

Process graph example

Modeling for with process graphs

Any topological sort of the graph corresponds to a feasible total ordering

image

reaping

0XFF-96 commented 3 years ago

Virtual Memory

Overview

image

why we need virtual memory ?

What is virtual memory ?

There are three main reason .

Virtual Addressing

Addressing translation

direction Addressing PA

image

image

When Page Hit

Page Fault

speed up page fetch with tlb ( translation lookaside buffer )

image

image

image

0XFF-96 commented 3 years ago

结束