Henry Wong wrote:
Not sure what you mean by "the kernel can always cancel one of its tasks". All the issues mentioned, like hung on I/O also applies at the OS layer, and the same techniques also needs to be used. Or do you mean something specific that hasn't been mentioned yet?
Simply that the kernel can:
a. detect that a task is not dispatchable, i.e., not runnable because it's "blocked" waiting for something
b. impose a policy that says "cancel a task if it is blocked for N minutes"; or notify the operator and let him cancel the task from without
c. remove the canceled task's entry from the dispatch queue
d. reclaim resources associated with the canceled task
mean that the kernel can resolve the initial cause of the hang, e.g., a malfunctioning device.
The JVM architecture seems deficient re (b) and (d). There seems to be no way to cancel such a hung task, etc. Please note that this post is not meant as an "indictment" of the JVM architecture! I only bring it up because I am struck by what seems
to me to be a liability. I agree that it's a difficult problem.
I am just trying to find a graceful and not too labored solution to it.