24.12.2012 Views

CSC322 C Programming and UNIX - Department of Computer ...

CSC322 C Programming and UNIX - Department of Computer ...

CSC322 C Programming and UNIX - Department of Computer ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basic Process Control<br />

You can start processes in the foreground or in the background<br />

– Foreground processes are started by just typing a normal comm<strong>and</strong><br />

– Background processes are started by appending an ampers<strong>and</strong> (&) to the<br />

comm<strong>and</strong>. This is particularly useful for graphical applications: emacs &<br />

– While a foreground process is running, the shell is blocked because the process<br />

is using the terminal as its stdin (i.e. you can have at most one non-suspended<br />

foreground process)<br />

– (Most) foreground processes can be terminated by hitting [C-c] (<strong>of</strong>ten written<br />

as ^C).<br />

– (Most) foreground processes can be suspended by hitting [C-z]<br />

– A suspended process can be continued by typing fg (to continue it as a<br />

foreground process) or bg (to let it run in the background)<br />

– A background process will be suspended automatically, if it needs to read data<br />

from stdin<br />

– jobs gives a numbered list <strong>of</strong> all processes started by the shell<br />

– You can use fg % to take a particular process into the foreground (bg<br />

% works on the same principle)<br />

– You can use kill % to terminate the named job<br />

Stephan Schulz 69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!