简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM