What happens to running processes when I lose a remote connection to a *nix box?

Solution 1:

Normally the processes will terminate upon disconnection, but the old SSH sessions could either be waiting to timeout, or they could have hung upon exit, due to a race condition.

You should probably terminate the old sessions, although you don't necessarily have to. Type ps aux on the console to list the processes, then kill PID for each hung ssh session, where PID is the PID (process ID) for that session. The older, hung sessions should have lower PIDs than your current, new session.

If there is a long-running process that you specifically want to continue running even after you disconnect, you can prefix your command with nohup:

nohup badblocks -nvs /dev/sda &