When an application starts its library operating system must go through what is very similar to a full OS startup in a conventional system. This starts by calling ProcessStartup which then does per-subsystem initialization. Further, the very first process to start does special one-time-per-boot initialization for the entire system.
Sometimes different ExOS subsystems want to be able to do their own processing when a process forks or execs (for example, the fd code wants to close close-on-exec fd's and up the ref counts on the other fd's every time a process forks or execs). We handle this with call-backs. You register a function with OnExec or OnFork or atexit or ExosExitHandler. The function will then be called back with some useful args when the specified event occurrs.