Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Operating Systems
Operating Systemsmedium

What are signals and how do processes handle them?

Tags
#signals#process#lifecycle
Back to categoryPractice quiz

Answer

Signals are asynchronous notifications sent to a process (e.g., SIGTERM, SIGINT). A process can handle them with signal handlers, ignore them, or use default actions like termination.

Advanced answer

Deep dive

Signals are used for control and lifecycle events:

  • SIGTERM requests graceful shutdown; SIGKILL forces termination.
  • Handlers must be fast and async-signal-safe.
  • Use flags/pipe to notify the main loop safely.
  • Child processes report via SIGCHLD.

Examples

Graceful shutdown pattern:

SIGTERM -> set flag -> stop accepting traffic -> flush -> exit

Common pitfalls

  • Doing non-reentrant work inside a handler.
  • Ignoring SIGTERM and forcing SIGKILL.
  • Missing SIGCHLD handling (zombie processes).

Interview follow-ups

  • What’s the difference between SIGTERM and SIGKILL?
  • How do you avoid zombies?
  • How do signals work with threads?

Related questions

Spring
Bean lifecycle callbacks: what do `@PostConstruct` and `@PreDestroy` do?
#spring#lifecycle#postconstruct
Architecture
What is an ADR (Architecture Decision Record) and why is it useful?
#architecture#documentation#decisions
Spring
Bean lifecycle: when do `@PostConstruct` and `@PreDestroy` run?
#spring#beans
#lifecycle
Spring
What are Bean Scopes?
#bean#scope#lifecycle