The citation comes from: http://blog.ragozin.info/2012/10/safepoints-in-hotspot-jvm.html
Safepoint status check itself is implemented in very cunning way. Normal memory variable check would require expensive memory barriers. Though, safepoint check is implemented as memory reads a barrier. Then safepoint is required, JVM unmaps page with that address provoking page fault on application thread (which is handled by JVM’s handler). This way, HotSpot maintains its JITed code CPU pipeline friendly, yet ensures correct memory semantic (page unmap is forcing memory barrier to processing cores).
I have some doubts:
- From what I know page fault is always handled by OS (and, from what I understsand it can handled only by kernel because of security). So, what autor does mean?
- The second is very similar to the first one: How JVM is able to unmap a page?
munmap
; similar calls are available on Windows.