Which process knows what applications are open? I'm trying to find the process that takes care of what applications are open. For example, an app I closed stills shows as open in Dock and Force Quit, so I want to kill/restart that process (which takes care of what processes are open). Logging out would solve it too, but I can't right now. Restarting Dock does not work.

For example, I'm 100% sure I have killed Safari, using kill -9, but it still shows up in the Dock and in Force Quit. The process is definitely killed, but the Dock and Force Quit haven't got that, because the process that lists which applications are open have frozen. I want to know the name of that process.
The process which keeps track of all processes is launchd (PID 1) which is the first process launched when the OS starts. There is no standard way of killing it (technically speaking sending the TERM or KILL signal will not kill it), if you could it would immediately lead to a reboot.