2014-05-11 05:55
原题:
difference between thread and process.
题目:请描述进程和线程的区别。
解法:操作系统理论题。标准答案在恐龙书上,我自己回忆了一点。我想就算是面试官也不会一字一句地要求你背书的,对于要点掌握住就可以了。
代码:
// http://www.careercup.com/question?id=5718181884723200
Answer:
Process:
. Basic element of resource allocation in the operating system.
. Possesses independent resources:
a. code segment
b. data segment
i. constant data
ii. global variable
iii. stack
iv. heap
c. register
d. program counter
. Have independent virtual address mapping.
. It has life cycle, it is running, in contrast to a program.
Thread:
. Basic element of CPU scheduling.
. Possesses part of independent resources:
a. register
b. stack
c. program counter
. Multiple threads share part of resources in same process:
a. code segment
b. data segment
i. constant data
ii. global variable
iii. heap
. All threads in a process share the same address space.
. It has life cycle