Why are threads called lightweight processes?

后端 未结 6 1896
野性不改
野性不改 2020-12-08 19:49

A thread is \"lightweight\" because most of the overhead has already been accomplished through the creation of its process.

I found this in one of the tutorials.

6条回答
  •  旧巷少年郎
    2020-12-08 20:28

    process:

    1. process id
    2. environment
    3. folder
    4. registers
    5. stack
    6. heap
    7. file descriptor
    8. shared libraries
    9. instruments of interprocess communications (pipes, semaphores, queues, shared memory, etc.)
    10. specific OS sources

    thread:

    1. stack
    2. registers
    3. attributes (for sheduler, like priority, policy, etc.)
    4. specific thread data
    5. specific OS sources

提交回复
热议问题