Process == state of a program when executing loaded in memorylinux
If the same program is launched more than once, multiple processes will be created面试
page table, do the mapping of the virtual address to the physical address并发
Data and text: 静态信息
page table
stack: 记录位置信息
heapapp
process state
process number
registersui
How is PCB used?spa
进程切换花销很大
direct cost: number of cycles for loading instructions
indirect cost: cold cache/ hot cache线程
the address space
code, data, files and its own thread
进程是不会有共同的address mapping的
不一样的线程会有本身私有的程序计数器, 栈, 栈指针指针
thread would share all of the virtual to physical address mappings
能够访问地址空间的不一样部分code
single CPU
multiple CPU
简单的比较:blog
thread data structure:
mechanisms to create and manage threads
mechanisms to safely coordinate among threads running concurrently
能够读取一样的地址, 会致使inconsistency
CPU太快,
获得CPU的时候,相关的资源必须已经就位, 除CPU以外的构成了程序的执行环境, 也就是咱们所说的程序上下文。
轮流执行CPU的方法: 先加载程序A的上下文,而后开始执行A,保存程序A的上下文,调入下一个要执行的程序B的程序上下文,而后开始执行B,保存程序B的上下文 进程就是包括了上下文切换的程序执行时间总和 = CPU 加载上下文 + CPU执行 + CPU保存上下文 线程就是贡献了进程的上下文环境的更细小的CPU时间段