您的位置:首页 > 职场人生

Careercup - Microsoft面试题 - 5718181884723200

2014-05-11 06:29 423 查看
2014-05-11 05:55

题目链接

原题:

difference between thread and process.


题目:请描述进程和线程的区别。

解法:操作系统理论题。标准答案在恐龙书上,我自己回忆了一点。我想就算是面试官也不会一字一句地要求你背书的,对于要点掌握住就可以了。

代码:

// http://www.careercup.com/question?id=5718181884723200 Answer:
Process:
1. Basic element of resource allocation in the operating system.
2. Possesses independent resources:
a. code segment
b. data segment
i. constant data
ii. global variable
iii. stack
iv. heap
c. register
d. program counter
3. Have independent virtual address mapping.
4. It has life cycle, it is running, in contrast to a program.
Thread:
1. Basic element of CPU scheduling.
2. Possesses part of independent resources:
a. register
b. stack
c. program counter
3. Multiple threads share part of resources in same process:
a. code segment
b. data segment
i. constant data
ii. global variable
iii. heap
4. All threads in a process share the same address space.
5. It has life cycle
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: