Why does OSThread exist?

David Holmes david.holmes at oracle.com
Tue Dec 7 09:25:32 UTC 2021


Hi Thomas,

On 7/12/2021 4:30 pm, Thomas Stüfe wrote:
> Hi,
> 
> does anybody know what the point is of a separate OSThread companion class
> to Thread? I understand that there is OS-specific information one wants to
> factor out on a per-platform base, but why two physically separate
> structures? AFAICS they never exist separately (an OSThread makes no sense
> without a Thread, and vice versa). We pay unnecessarily for two
> allocations, C-heap fragmentation, and for one additional dereferencing hop
> when accessing OSThread.

Can say for sure as it is historical - it's just the way the OS specific 
part was factored out.

We had a project to try and get rid of it a few years ago but it wasn't 
a clean/simple as thought at the time and the project was dropped. But 
Solaris complicated things and now that's gone so ...

Cheers,
David

> Thanks, Thomas
> 


More information about the hotspot-runtime-dev mailing list