RustConf 2023 - Beyond Ctrl-C the dark corners of Unix signal handling

Explore the dark corners of Unix signal handling, learn how to customize signal behavior, and discover the Tokyo crate's solutions for handling signals in a portable and concurrent way.

Key takeaways
  • Signals are a fundamental part of Unix and not a concern for most programs.
  • Signal handling is complex and can lead to unexpected behavior if not handled properly.
  • Most modern programs use a default signal handling mechanism, but this can be modified to customize behavior.
  • Signal handlers can be used to perform custom actions when a signal is received, but this is limited by the fact that memory allocation is not possible in a signal handler.
  • The Tokyo crate provides a way to handle signals in a portable way.
  • Signals can be used for job control, such as suspending or resuming processes.
  • Some signals, such as SIGINT, are commonly used and can be handled using a signal handler.
  • Signals can also be used to terminate a process, and can be customized using the kill command.
  • Processing multiple signals concurrently can be challenging.
  • The Tokyo crate provides a way to handle multiple signals concurrently using its select function.
  • Handling signals in a program that uses threads can be complex and requires careful consideration of shared state and synchronization.
  • The Tokyo crate provides a way to handle signals in a program that uses threads using its join function.
  • Signals can be used to manage process groups and handle signals that are sent to a group of processes.
  • The Tokyo crate provides a way to handle signals that are sent to a group of processes using its group function.
  • One of the main challenges of handling signals is that the default signal handling mechanism is not customizable.
  • SIGINT is commonly used and can be handled using a signal handler.
  • Signals can be used to manage process groups and handle signals that are sent to a group of processes.
  • The Tokyo crate provides a way to handle signals that are sent to a group of processes using its group function.
  • When a process group is created, it inherits the signal handling mechanism of its parent process.
  • Signals can be used to manage process groups and handle signals that are sent to a group of processes.
  • The Tokyo crate provides a way to handle signals that are sent to a group of processes using its group function.