What is the difference between lightweight process and thread?

前端 未结 8 1303
醉话见心
醉话见心 2021-02-01 19:32

I found an answer to the question here. But I don\'t understand some ideas in the answer. For instance, lightweight process is said to share its logical address space with other

8条回答
  •  鱼传尺愫
    2021-02-01 19:37

    Based on Tanenbaum's book "Distributes Systems", light weight processes is generally referred to a hybrid form of user-level thread and kernel-level thread. An LWP runs in the context of a single process, and there can be several LWPs per process. In addition each LWP can be running its own (user-level) thread. Multi-threaded applications are constructed by creating threads (with thread library package), and subsequently assigning each thread to an LWP.

    The biggest advantage of using this hybrid approach is that creating, destroying, and synchronizing threads is relatively cheap and do not need any kernel intervention. Beside that, provided that a process has enough LWPs, a blocking system call will not suspend the entire process.

提交回复
热议问题