计算机基础知识问答

  1. 线程和进程的区别和联系(What's the difference between process and thread? What kind of information does thread maintain? its own stack? heap?How and when to do a context switch? How do you handle an time slice interrupt?What are the possible pitfalls for multi-thread programming?)

Diff threads in the same process share the same address space. Different processes do not.
Different threads have their own stack. as do different processes. Thread switch is like a jump in the code since no TLB flush is required. Context switch happens when the processor schedules a new process to execute.  (TLB:Translation lookaside buffer,即旁路转换缓冲,或称为页表缓冲;里面存放的是一些页表文件(虚拟地址到物理地址的转换表))
Possible pitfalls for mt : locking, synchronization

你可能感兴趣的:(计算机)