0

In Linux,

  1. what is the definition of a light weight process?

    Is a light weight process defined as any thing created by clone() system call? (That is my understanding from the book Understanding the Linux Kernel)

    Is a regular process a light weight process? (I guess yes)

  2. Does Linux have a concept called "heavy weight process"? (I guess it means a regular process, so a heavy weight process is still a light weight process?)

Thanks.

Tim
  • 98,580
  • 191
  • 570
  • 977
  • Light basically means sharing the memory space with others, but since the process and threads concept is too ambiguous, so LWP is not precisely defined. Also there are tons of other resources/properties you need to consider, so it's useless concept. What you need to focus is what reality's like, not how human study the reality. – 炸鱼薯条德里克 Sep 30 '18 at 01:30

1 Answers1

1

No, light process is just a thread share resources with others. Because early Linux doesn't support threads and TGID. But not anymore, modern Linux do have thread concept and TGID, which is what you get from getpid. Today people don't talk about light or heavy anymore.

But important thing is, for KERNEL, threads in the same process can be much more independent than you think(I believe they all have their own PCBs), threads not in the same process may also share amazing things you may not expected. KERNEL force threads in one process to share some things like user namespace, mount namespace, PID namespace, but not credentials or some others. To get "threads" that acts more like what you expected, use 1-1 mapping or m-n mapping user-space thread like pthread or Go threads.

炸鱼薯条德里克
  • 1,337
  • 1
  • 12
  • 31