DOC PREVIEW
FSU COP 4342 - Processes

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesProcesses (see chapters 23 and 24)Executables can be executed as processesKeyboard control of jobsps, top, pstreekill doesn’t kill, it sends signalscron, anacronUnix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesProcesses come from executablesA process has an entry in the process table, and is initially loadedfrom a file in the filesystemAn executable is a file in the filesystem whichHas the appropriate “x” flag(s) setEither begins with a line of the form#!/SOME/OTHER/EXECUTABLE or is in a binary format suchas ELF or COFFUnix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processes“Foreground” versus “Background”A process that is in the “foreground” of a shell means that theshell is waiting for the process to finish before accepting moreinput.A process that is in the “background” of a shell means that theshell will accept other commands while the process is executing.Generally, a “background” process can be brought to the“foreground”.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesShell communication with processesIf a process is in the foreground, then by default when a ctrl-c ispressed and then mapped by stty to send a signal SIGINT, thatSIGINT will be propagated to the foreground process. By defaultwhen a ctrl-z is pressed and then mapped by stty to send a signalSIGSTOP to the foreground process suspending the process.From there, you can either terminate it, put it in the background,or unsuspend it back to the foreground.If a process is in the background, you can use kill to explicitlysend signals.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesShell job controlYou can place many processes simultaneously in thebackground; most shells will keep track of these and allow youto also access them via logical pids.You can either use ctrl-z / bg for a process that is in theforeground, or use a terminal “&” when you start the process.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesShell job control continuedYou can use jobs to keep up with which jobs you have running.You can use fg %N to bring job N back to the foreground.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processeskillSending signals:kill -KILL pid → “unstoppable” kill (aka kill -9 pid)kill -TERM pid → terminate, usually much cleanerkill -HUP pid → either reload or terminate, usually clean ifterminationkill -STOP pid → suspend a processkill -CONT pid → restart a suspended processkill is generally a built-in, but there is also usually a killprogram. The program version will not usually work with logicalpids (unless your shell happens to translate logical pids to realpids before invoking kill, or the kill program is written such thatit reparses the command line. For example, try/usr/bin/kill -STOP %1).Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processespsYou can also use ps to look at various portions of the processtable.My favorites are ps alxwww and ps -elf.You pick and choose whatever format you like for output withthe ps -o -sort option. For example, ps -e-opid,uid,cmd -sort=uidYou can also show threads with the ps -m option.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processestopThe program top gives you a dynamic view of the process table.You can make it run faster with the “s” command.You can do “snapshots” with the -b (batch) option and the -iiterations option.Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processespstreeShows processes as a tree. Some options are:-c → Disable compaction.-G → Try to make graphical line drawing rather than justcharacter-Hpid → Try to highlight a particular process and its ancestors-p → Show pidsYou can limit output to a user (specified by a user name) or topid (specified by pid number)Unix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processescronYou can run programs at arbitrary times with cronUse crontab -e to edit your crontab (you can set EDITOR tospecify an editor)The five time fields are minute, hour, dayOfMonth,month, dayOfWeek where Sunday=0 for dayOfWeekUnix Tools: Processesuniversity-logoProcessesOverviewJob controlkill means send signalJack-of-all-trades: psMore ways to view processesStarting periodic processesExample crontab:COP4342$ crontab -l#10 0,3,6,18,21* * *echo "test at ‘date +\%F-\%T‘" |Mail -s "‘date +\%F-\%T‘" [email protected] 10* *0,6 echo "test at ‘date +\%F-\%T‘" |Mail -s "Weekend test ‘date +\%F-\%T‘"[email protected] Tools:


View Full Document

FSU COP 4342 - Processes

Download Processes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Processes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Processes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?