RFR: 8367319: Add os interfaces to get machine and container values separately

Casper Norrbin cnorrbin at openjdk.org
Mon Oct 6 14:39:44 UTC 2025


On Mon, 6 Oct 2025 14:23:51 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Then, is it possible to keep the original API for "most use cases"? For others, they can query `is_containerized` and new `machine_` APIs.
> 
> The current proposed API kind of forces all users to distinguish btw inside a container or not, even though most use cases don't care.

The original API is untouched, so "most use cases" can still use that without ever worrying about containers. The `machine_` functions is simply an add-on to that API. Both the examples above remain unchanged, `os:: active_processor_count()` still returns both machine/container values, and `os::physical_memory()` still returns the appropriate memory limit.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27646#issuecomment-3372029042


More information about the hotspot-dev mailing list