[fpc-devel] threadvar implementation

Nikolai Zhubr n-a-zhubr at yandex.ru
Mon Jul 26 19:39:07 CEST 2010


26.07.2010 13:04, Michael Schnell:
> On 07/24/2010 06:55 PM, Nikolai Zhubr wrote:
>>
>> I think only FS selector (and/or descriptor) varies across threads.
> Seemingly not the selector value (the FS content seems to stay constant
> among the threads), but the table entry it selects.

You are right. Just verified here too. Seems a bit illogical, especially 
as 3B is a GDT (not LDT) selector, therefore it's not subject to 
automatic substitution upon task switch. The scheduler patching GDT 
entry on every task switch is IMHO too crazy. It might be that FS's 
(descriptor) base points to some non-shared region of linear address 
space, so that different threads have different paging tables (It might 
be alpha's relict, whatever)

Anyway. MS designed it in those ancient times when they still cared that 
their NT OS was technically good. Both delphi and gcc use this 
mechanism. Therefore, I'd suppose it probably makes some sense. (I don't 
have time to get deep into it right now myself, and not that I'm going 
to push anyone, especially developers, but I still don't see a reason 
why it couldn't be employed in FPC eventually)

Nikolai
>
> -Michael
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>




More information about the fpc-devel mailing list