随笔分类 - Operating System
摘要:Loading and Linking Shared Libraries from Applications Up to this point, we have discussed the scenario in which the dynamic linker loads and links sh
阅读全文
摘要:Executable Object Files The format of an executable object file is similar to that of a relocatable object file. The ELF header describes the overall
阅读全文
摘要:Relocation Once the linker has completed the symbol resolution step, it has associated each symbol reference in the code with exactly one symbol defin
阅读全文
摘要:Linking with Static Libraries In practice, all compilation systems provide a mechanism for packaging related object modules into a single file called
阅读全文
摘要:简介和分类 Linking is the process of collecting and combining various pieces of code and data into a single file that can be loaded (copied) into memory an
阅读全文
摘要:Hiding variable and function names with static C programmers use the static attribute to hide variable and function declarations inside modules, much
阅读全文
摘要:Procedure Example 准备调用swap_add之前的代码: 此时,ebp指向顶部,esp指向中部,call之后push return address 要改变ebp之前必须保存,以便之后恢复: setup code for swap_add: 此时,ebp指向中部,esp指向中部 bod
阅读全文
摘要:Loops: Instead, combinations of condi- tional tests and jumps are used to implement the effect of loops. Most compilers generate loop code based on th
阅读全文
摘要:Unary and Binary Operations unary operations: This operand can be either a register or a memory location. For example, the instruction incl (%esp) cau
阅读全文
摘要:Data Formats 如图: Accessing Information 如图: The low-order 2 bytes of the first four registers can be independently read or written by the byte operatio
阅读全文
摘要:x86(wiki): x86 is a family of backward-compatible(向后兼容) instruction set architectures[a]based on the Intel 8086 CPU and its Intel 8088 variant(变种). IA
阅读全文
摘要:需要虚拟存储器的原因: As demand on the CPU increases, processes slow down in some reasonably smooth way. But if too many processes need too much memory, then so
阅读全文
摘要:Fully Associative Caches: definition: A fully associative cache consists of a single set (i.e., E = C/B) that contains all of the cache lines. 只有一个set
阅读全文
摘要:Generic Cache Memory Organization: 这个结构可以用一个四元组表示: (S, E, B, m) 图示: S表示set的数量,标志了s的长度。如果在address里的set index也为3,那么应该把这个缓存放在Set3 B代表cache block的大小,标志了b的
阅读全文
摘要:局部性: 局部性分为时间局部性和空间局部性:Locality is typically described as having two distinct forms: temporal locality and spatial locality. In a program with good tem
阅读全文
摘要:csapp 560: 不同层次存储器的区别: If the data your program needs are stored in a CPU register, then they can be accessed in zero cycles during the execution of t
阅读全文
摘要:以前写过一篇对于这几个概念的粗略解释,现在再深入一些。 同步和异步的区别: 同步是调用协议中结果在调用完成时返回,调用过程中参与双方处于一种状态同步的过程。 异步是指调用方发出请求就立即返回。 请求甚至可能还没有到达接收方。比如放到了某个缓冲区,等待对方取走或者第三方转交。 结果由接收方主动推送,或
阅读全文
摘要:线程池是一个操作系统的概念,它是对多线程的一种优化。 多线程的时候,创建和销毁线程伴随着操作系统的开销,如果频繁创建/销毁线程,则会使效率大大降低。 而线程池,是先创建出一批线程放入池子里,需要创建线程的时候从这个池子里取,用过了再放这个池子里。 显然,使用线程池节省的是线程创建和销毁的时间。 因为
阅读全文
摘要:实现并发,可以使用多进程,多线程。 进程和线程有个共同点,他们都是通过操作系统来调度的。 而协程,则把调度的权力交给了程序员。 协程可以看作用户态下协作的线程。 用户态:是说协程的调度权属于程序员。 协作:是说协程的调度是协作式的,不是抢占的。在协程中,某部分可以通过调用某个方法,将控制权交出,这时
阅读全文
摘要:同步与异步: 同步:发出一个调用,若没有得到结果,则调用不返回;若调用返回,那么一定得到结果了 异步:发出一个调用,立即返回,没有返回结果。当被调用者有结果了,再通过状态、通知来告诉调用者来获取结果 核心在消息通信机制。 一个典型的例子,异步IO: 将调用者视作主线程,通常情况下,主线程中会实现一个
阅读全文