RFR(S): 8020753: pthread_get_stacksize_np() workaround for OS X 10.9 (round 2)
Igor Veresov
igor.veresov at oracle.com
Thu Oct 24 09:49:32 PDT 2013
Looks good to me.
igor
On Oct 24, 2013, at 7:51 AM, Gerard Ziemski <gerard.ziemski at oracle.com> wrote:
> Please review this proposed workaround (round 2) for OS X 10.9 (Mavericks)
>
> Description:
>
> On Mac Os X 10.9 (Mavericks) the pthread_get_stacksize_np() API returns 128 pages for both main (primodial, primary - ie. the one created by the OS itself) and secondary threads, when in fact 2048 pages are available for the main thread. pthread_get_stacksize_np() correctly returns 2048 pages for main thread on 10.8, 10.7, 10.6 and probably all previous OS X versions.
>
> An issue has been filed with Apple, but in the meantime we need to substitute 2048 pages whenever pthread_get_stacksize_np() returns anything else (ie. 128) on main thread. The workaround is only active if the kernel version shows we are running on 10.9 or later (the workaround will have to be modified once Apple fixes the issue)
>
> The workaround uses hardcoded value of 2048 pages for main thread, because:
>
> 1. The correct value can in fact be found at runtime using signals (please see my test case attached to the bug's JDK issue), however, such code needs signal handlers and also takes about 3.5 ms, so it's probably not a viable solution.
>
> 2. According to https://developer.apple.com/library/mac/documentation/cocoa/conceptual/Multithreading/CreatingThreads/CreatingThreads.html that's the size of the main thread for OS X.
>
>
> Testing:
>
> Issue's own test, UTE vm.quick and nsk.stack
>
>
> References:
>
> http://cr.openjdk.java.net/~hseigel/8020753/ <http://cr.openjdk.java.net/%7Ehseigel/8020753/>
> https://bugs.openjdk.java.net/browse/JDK-8020753
>
>
> cheers
>
More information about the hotspot-dev
mailing list