SIGALRM syscall interruptions
JakubVanek opened this issue · 1 comments
JakubVanek commented
Hi,
I'm thinking about how to solve the problem with timers interrupting running syscalls.
- Implement syscall restarting: https://github.com/openjdk/jdk11u/blob/d46b56eb81b07b452141c7dcd078d33fc8e49d63/src/hotspot/os/linux/os_linux.inline.hpp#L84
➕ Minimal changes to the code surrounding the syscall.➖ Has to be followed in user code as well.
- Make SIGALRM restart the syscalls automatically:
SA_RESTART
➕ Small change just in the related code.➖ Not all syscalls are restartable (https://stackoverflow.com/a/48553220).- added in 7a65eca
- Provide an alternative implementation based on threads
➕ Removes (most?) interruptions due to signals, so changes to syscall code are not necessary.➖ Callbacks need to be aware that they're executing in a different thread context (locking/atomic is necessary).➖ Memory overhead of threads (however I have no data to determine the actual impact).➖ Scheduling/CPU overhead of threads (ditto).
Best regards,
Jakub
a3f commented
SA_RESTART
is a good default, I think.