个人觉得读Linux内核架构是理解操作系统最好的方式,于是在实习之余开始读这本书。估计要很久才能读完。这是上周的笔记。
1. 当Linux在中断模式的情况下,内核没有权限访问用户的内存空间。
2. 对于32bit的操作系统,每个进程眼中的虚存都是4G,64位的会小于2的64次方,大约用其中的47位。。。因为用的字长越多,映射寻址时越慢。
3. 虚存往往大于实际内存。虚存和实际内存都切分成很多大小相同的pages。两个进程的虚存可能共享实际内存中的同一个Page。虚存的page中可能有一些没有对应内存中Page。
4. 实际的内存页 也叫 page frames. In contrast, 而虚存的页叫做 page 。
5. 海量数组处理: 如果需要的数组很大,但数组对应的distinct 值却没有那么多,可以把数组切成多个。例如数组长度本为1000,可以切成三层,每层长度为10的三个数组。缺点是访问多级数组比访问一个数组要慢。.
6. 在内核的抢占调度模型中,system call 是不能被一般进程抢占的。但可以被中断暂停。中断具有最高的优先级。
7. Copy on Write方法: 即在需要修改时才进行实际数据的copy。例如Linux 中 在fork时,父进程的所有资源需复制给新建的子进程,而现在linux使用Copy on Write, 即fork时只复制page table(即一张映射表),所以父子进程的page table 指向同一块 physical pages,但只读,当父子进程中的任何一个需要write或update 这块