[fpc-devel] Light weight threads for FPC

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 14 12:02:37 CET 2007


On 14 Dec 2007, at 11:44, Michael Schnell wrote:

>> No, TThread is either heavy or middle-weight, according to the  
>> definitions at
>>
>> http://whatis.techtarget.com/definition/0,,sid9_gci814910,00.html
>>
> Of course it would be possible to include a multitasking scheduler  
> in the RTL to avoid any system calls and share any resources.  
> (AFAIK, for Linux there somewhere was an alternate PThread library  
> that does exactly in order to avoid slight Posix incompatibilities  
> caused by "Linux Threads". But same is not necessary any more as  
> the OS-based NPTL is said to perform just as good and Posix- 
> compatible.)
>
> I.e. if using Linux with NPTL (or that old special PThread  
> library), I don't see how you could use "lighter" threads than with  
> TThread.
>
> If using Windows, (with it's quite heavy native Threads), pure user  
> mode threads might be a lot "lighter".

Windows has built-in support for user-space scheduled threads.  
They're called fibers (multiple fibers are bound to one thread; the  
OS schedules threads and you pick which fiber runs).


Jonas



More information about the fpc-devel mailing list