www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/16/11:54:03

Date: Fri, 16 May 1997 11:49:29 -0400 (EDT)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
To: David McKee <david DOT mckee AT rtp DOT gtegsc DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: Some questions about LWP.
In-Reply-To: <337C28C7.5D35@rtp.gtegsc.com>
Message-Id: <Pine.D-G.3.91.970516113647.28380A-100000@dg1>
Mime-Version: 1.0

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019