Fork() can fail: this is important (2014)
Everything can fail. Things can fail <i>without even telling you they failed</i>. Writes to disk can fail even when it returns success, even with a synchronous write, even after <i>sync()</i>. The world can lie to us. For your own sanity, I recommend not thinking about this often...<p>&gt; Neither of them fail often, but when they do, you can&#x27;t just ignore it. You have to do something intelligent about it.<p>Nope. You can often do very dumb shit in response to it. Just like you don&#x27;t have to do anything intelligent when malloc() fails, you don&#x27;t have to do anything intelligent when fork() fails. The most common thing to do is to restart whatever was failing , starting with the smallest &quot;thing&quot; and going up in size (threads-&gt;pids-&gt;pgroups-&gt;containers-&gt;vms-&gt;bare metal, tasks-&gt;services-&gt;clusters, etc). Of course, you should probably have some kind of cumulative alert to tell someone to fix it, but often the restart is good enough to keep requests being processed. Such is the reality of imperfect production systems.