unix
8 minUnix process inheritance: environment variables and file descriptors
Trace what survives fork and exec, and close capabilities a child should not inherit.
Loading page...
unix
8 minTrace what survives fork and exec, and close capabilities a child should not inherit.
unix
18 minConnect kernel readiness APIs, resource limits, cgroups, socket queues, page cache, and inode behavior to production symptoms.
unix
8 minUnderstand users, groups, permission bits, file descriptors, and redirection so shell and service behavior is easier to debug.
Q&A
Q&ANative stack memory, scheduling overhead, context switching, and file descriptors can be exhausted.
Each platform thread consumes native resources, including stack reservation, and excessive runnable threads add scheduling and context-switching overhead. The service may hit native-thread creation errors or degrade before that point. Bound executors, measure queue depth and task latency, and apply backpressure rather than creating one thread per unbounded unit of work.
Q&A
Q&AEnvironment strings and open descriptors not marked close-on-exec.
Construct a deliberate environment and descriptor allowlist. Descriptors grant capabilities to files, sockets, or pipes; inherited writers can delay EOF and inherited secrets can leak to less-trusted children.
Q&A
Q&Aepoll tracks interest and reports readiness changes instead of requiring repeated full-set scans.
select requires rebuilding and scanning descriptor sets on each wait and has platform-specific descriptor limits; poll also examines a supplied list. epoll maintains kernel-side interest and ready structures, which suits large mostly-idle sets. It does not remove per-connection memory costs, application scheduling, or edge-triggered drain requirements.
Q&A
Q&AAn already open descriptor still refers to the old file object.
Write a complete temporary file on the same filesystem and replace the pathname. New opens see the replacement; existing descriptors keep the old object. Durability and concurrent-writer coordination are separate guarantees.