Reputation: 5993
& # disown the functions
As we all know &
put a task into background, and most importantly disowns the task.
But how is it achieved?
Upvotes: 3
Views: 888
Reputation: 43508
Without a &
, the shell forks itself, calls execve
in the child process to start the task, and waits via wait
or waitpid
for the child to terminate (which suspends the shell), not doing anything else than that.
When starting a background task, the shell forks itself again, calls execve
to start the task in the child process, but doesn't wait for its termination and rather return the control immediately after the start of the task.
Upvotes: 5