RFR: JDK-8030957 - AIX: Implement OperatingSystemMXBean.getSystemCpuLoad() and .getProcessCpuLoad() on AIX [v4]
Thomas Stuefe
stuefe at openjdk.org
Thu Aug 7 06:06:18 UTC 2025
On Thu, 7 Aug 2025 05:46:29 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Suchismith Roy has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update ProblemList.txt
>
> src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c line 43:
>
>> 41: static perfstat_cpu_total_t cpu_total_old;
>> 42: static time_t last_sample_time = 0;
>> 43: static double last_cpu_load = -1.0;
>
> Not threadsafe. What happens if you call this concurrently from multiple threads? Visibility of these three values can be in any order of updates. You'd get skewed values.
>
> Check out how Linux does it. They use mutexes to synchronize access to this function.
Style nit, you may want to group these together into a nice structure, too.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25332#discussion_r2259142734
More information about the serviceability-dev
mailing list