What if there was a new keyword available in system programming whose function was only to request for a guarantee that the operating system would make extra effort to avoid terminating the main process during a certain function call?
system fun storeSessionData() {
// process persists or avoids system interrupts if possible
}
What extra effort could be made (over and above the usual exception handling)? Which OSs provide support for that?
Presumably you’re intending this for Kotlin/Native? (I can’t imagine the JVM, JS, or Android apps being used for systems programming…)
If you’re thinking of a Unix-like OS, then maybe something related to signal handling? But AIUI, a process can’t do anything to trap or ignore a -9/KILL signal; and other signals would need to be explicitly listened for and trapped — otherwise they’d simply be ignored, and so no further effort would be needed to avoid termination.