Why the JVM can't rely on some OS timer interrupts instead of simulating one ?

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5.7
  • Open JDK*

Issue

  • Why the JVM can't rely on some OS timer interrupts instead of simulating one ?

Resolution

  • An interrupt is an indication to a thread that it should stop what it is doing and do something else. Java provides freedom to the programmer to decide exactly how a thread responds to an interrupt, for multi-tasking and better performance. A thread sends an interrupt by invoking interrupt on the Thread object for the thread to be interrupted.

  • If the JVM rely on some OS timer interrupts, of course developers won't have liberty to have their own interrupt implementation and if this has to be managed by OS, it increases the complexity and has its own challenges and may result in breaking the java multi-threading system.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments