Re: LDT/GDT and TCB use by threads

From: Floyd, Paul <>
Date: Tue, 07 Jun 2022 09:14:28 UTC

I have now fixed this issue, mainly by tracing the working Valgrind x86 
Linux version.

Previously, on FreeBSD the first thread created would allocate a GDT and 
this would be reused by all other threads until the creation of the 
8192nd thread when there would no longer be a free slot and it would fail.

Now each thread gets its own GDT which is initialized as a copy of the 
parent thread's GDT. This GDT gets freed after thr_exit. No more slot 
exhaustion due to large numbers of short-lived threads being created.