Date: Fri, 16 May 1997 11:49:29 -0400 (EDT) From: "Art S. Kagel" To: David McKee Cc: djgpp AT delorie DOT com Subject: Re: Some questions about LWP. In-Reply-To: <337C28C7.5D35@rtp.gtegsc.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 16 May 1997, David McKee wrote: > Alex Holden wrote: > > [SNIP] > > I have a problem here: LWP stands (presumably) for "Light Weight > Process" which > implies threads. "Pre-emptive" implies process. These are (usually) > mutually > exclusive, the lib is either a multi-tasking pre-emptive process based > lib > (which is "Heavy Weight") or it is a cooperative, non pre-emptive, > thread based > lib ("Light Weight"). Which is it? Does it have both implementations? > You are mistaken. LWP does indeed stand for Light Weight Process, however, your assumption that LWPs are cooperative by nature and that only Heavy Weight Process (HWP) multi-tasking is preemptive is in error. In a true POSIX Thread (LWP) environment even individual threads within a process are scheduled, preemptively, by the OS task scheduler, if there is one, such as the UNIX scheduler. The only difference between a LWP -vs- a HWP is that since all LWPs within a process share memory and resources, there is no need to swap memory out in order to switch between threads within the process while a switch to a thread in another process, or to a different single threaded process, may require a memory swap in addition to the register/context switch. Many LWP libraries for single tasking OSs like DOS implement LPW as cooperative multitasking because DOS has no built in scheduler and it is easier to execute a single thread context until it ends or reaches a coordination point and treat this as a voluntary/cooperative task switch. Art S. Kagel, kagel AT bloomberg DOT com