Utkarsh Srivastav
Utkarsh Srivastav

Reputation: 3227

Background process vs Foreground Process

Is there a difference how a processor executes a background or foreground process or how operating system deals with their scheduling. If there is no difference at processor level between background and foreground job then at which level the difference comes ?

Upvotes: 1

Views: 5260

Answers (1)

prathmesh.kallurkar
prathmesh.kallurkar

Reputation: 5686

Creating a new background process in shell has nothing to do with the way the processor executes it. Only difference is that the shell does not wait for a background process to finish.

Code for a process creation :
1) fork a process
2) if (& symbol is present at the end of command)
continue to accept new command
else
wait on pid of child.

The only difference is whether the shell reduces the priority of a background process. The answer is "depends" on the shell you are using. But i don't know any existing shell assigning such dynamic priorities.

Upvotes: 2

Related Questions