Let's assume we have a process that allocates a socket listening on a specific port, does something with it and then terminates abnormaly. Now a second process starts and wants to allocate a socket listening on the same port that was previously held by the crahsed process. Is this socket available for re-allocation?
How does the Operating System recover resources that weren't released properly? Does the OS track the process id along with each allocated resource?
Is this cleanup something I can expect every POSIX compliant system to do?