The difference between shells that do job control and shells that don't
Apart from having job control, the difference between a job control shell and a non job control shell is that job control shells put each command into a difference process group. They do this even for commands running in the foreground, because you may later want to ^Z the command and push it into the background, and process groups are the core mechanism of doing job control.
(Process groups do two things in job control. First, they let the shell
reliably send stop or start signals to all of the processes spawned
by a command. Second, they control what processes can do IO with the
terminal; only processes in the foreground process group can read from
the terminal, and you can use '
stty tostop' to make it so that only
the foreground process group can write to the terminal.)
Shells that don't do job control just ignore process groups and thus leave all commands in the current process group (which is also the foreground process group).
This matters because of what happens when you end a session. When a
terminal closes (either a pty or a real terminal), only the current
foreground process group is sent a
SIGHUP; other process groups are
left alone. Thus, background processes started by commands run from a
job control shell are insulated from
SIGHUP, because they inherit the
command's process group and when the command finished, that is no longer
the foreground process group. This allows commands to be somewhat
sloppy in how they start long running
(So how do suspended processes get cleaned up when you log out? There's
a second mechanism: orphaned process groups that have one or more
suspended processes are sent
SIGHUP and then
Since there are very few shells these days that don't do job control,
this may be a hard error for people to see in testing. But it's really
not hard to see in code; the rule is that if you want a process to
survive the session ending, you must take explicit steps to insulate
SIGHUP et al. If you don't, you're being lazy and counting on
the side effects of running under a job control shell.
(A recent correction got me interested in all of this.)