A job is essentially a process group consisting of a process created by the shell together with its descendant processes.
If a ctrl-z is typed while job is running in the foreground, a SIGTSTP signal should be sent to every process in that job (process group).
A job will be in one of these states:
- FG - running in foreground
- BG - running in background
- ST - stopped (so not now the foreground job)
A job is represented by a struct
struct job_t { /* The job struct */ pid_t pid; /* job PID */ int jid; /* job ID [1, 2, ...] */ int state; /* UNDEF, BG, FG, or ST */ char cmdline[MAXLINE]; /* command line */ };
The set of current jobs is stored in an array of these structs:
struct job_t jobs[MAXJOBS]; /* The job list */