LWPs and LWKTs, how they relate

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Oct 5 15:42:41 PDT 2005


On 06.10.2005, at 00:14, Alex Burke wrote:
Firstly, I hope this email is in the correct format.... I am sending 
from gmail, and have disabled the rich text formatting stuff.
Unfortunately something in the mailway still fucks up the 
base64-encoded mails from gmail...

I was just wondering, what will be the interaction between LWPs (I saw 
a commit message indicating we will be implementing these) and LWKTs.
Each LWP has exactly one LWKT associated.  This is the 1:1 part of the 
threading.  Of course there still will be LWKTs that don't have any LWP 
associated (kernel threads).

Also, in the conext of DragonFlyBSD after this change... what will a 
"process" entity actually be?
The process entity will still be "struct proc".  This represents the 
process, i.e. vmspace, credentials, open files, alarm timers, signal 
actions (not masks), and stuff like that.

I notice in a commit mesasage that a mapping of one LWP to one process 
is currently enforced, will this change?
Yes.  As soon as the kernel is fully aware of lwps and uses them to 
actually access thread-local data (sigmask, accounting statistics) we 
can remove the embedded lwp and allocate a new lwp every time a process 
spawns a new thread.

What distinguishes a classic process from a LWP? (reading'moden 
operating systems', i thought a process was something that had 
executable conext, possibly multiple (i.e. a threaded program), but 
included all associated file descriptors etc... not sure what this new 
subdivision does).
That's exactly the division.  A process (struct proc) has a vmspace, 
file descriptors, etc.  Each thread within a process (struct lwp) 
carries that data neccessary for its execution (signal mask and 
attached lwkt being one of the most important things).

So it is:

proc 1 <-> lwp 1 <-> lwkt 1  [single threaded]

proc 2 <-> lwp 2 <-> lwkt 2  [multi threaded]
        \> lwp 3 <-> lwkt 3
                     lwkt 4  [kernel thread]

One proc groups multiple "threads" called struct lwp.

Hope this question does not seem too stupid.
Not at all!  I will come up with a roadmap in some minutes.

cheers
  simon
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Attachment:
PGP.sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00000.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20051005/5dc950e3/attachment-0014.obj>


More information about the Kernel mailing list