/
Unix Processes Norman Matloff Department of Computer Science University of California Unix Processes Norman Matloff Department of Computer Science University of California

Unix Processes Norman Matloff Department of Computer Science University of California - PDF document

tatyana-admore
tatyana-admore . @tatyana-admore
Follow
652 views
Uploaded On 2014-12-21

Unix Processes Norman Matloff Department of Computer Science University of California - PPT Presentation

If for example three people are running the same program simultaneously there are three processes there not just one In fact we might have more than one process running even with only person executing the program because you will see later the progr ID: 27205

for example three

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Unix Processes Norman Matloff Department..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

2DeterminingInformationAboutCurrentProcessesThe`ps-x'commandwilllistallyourcurrently-runningjobs.Anexampleis:PIDTTSTATTIMECOMMAND6799coIW0:01-csh[rich](csh)6823coIW0:00/bin/sh/usr/bin/X11/startx6829coIW0:00xinit/usr/lib/X11/xinit/xinitrc--6830coS0:12X:06836coI0:01twm6837coI0:01xclock-geometry50x50-1+16841p0I0:01-sh[richonxterm](csh)6840p1I0:01-sh[richonxterm](csh)6842p2S0:01-sh[richonlogin](csh)6847p2R0:00ps-xThemeaningofthecolumntitlesisasfollows:PIDprocessidentificationnumberTTcontrollingterminaloftheprocessSTATstateofthejobTIMEamountofCPUtimetheprocesshasacquiredsofarCOMMANDnameofthecommandthatissuedtheprocessTheTTinformationgivesterminalnames,whichyoucanseebytypingthewhocommand.E.g.weseep2intheTTcolumnabove,whichistheterminallistedasttyp2inthewhocommand.Thestateofthejobisgivenbyasequenceoffourletters,forexample,`RWNA'.Therstofthesefouristypicallyoneofthefollowing:rstletterrunnabilityoftheprocessRrunnableprocessTstoppedprocessSprocesssleepingforlessthanabout20secondsIprocessesthatareidle(sleepinglongerthanabout20seconds)Astate-Rprocessisrunnable,i.e.itisbeabletomakeuseofaturngiventoit,andiswaitingforone.WecanputaprocessinstateT,i.e.stoptheprocess,bytypingcontrol-z.Suppose,forexample,thatIamusingftptogetsomelesfromsomearchivesite,andInoticealetherecalledREADME.Icanusetheftp`get'commandtogettheREADMEle,andthentypeC-z.Thiswillstop(suspend)theftpprocess,andgetmebacktotheC-shell.AtthatpointIcanreadtheREADMEle,sayusingmore,andthenreactivatetheftpprocess,bytyping`fg'totheshell.AtypicalexampleofanS/Iprocessisonethatiswaitingforuserinput.IfIamusingtheemacseditor,forexample,theprocesswillgotostateSwhenitiswaitingformetotypesomething;ifItakemorethan20secondstodecidewhattotype,theprocesswillbeinstateI. signalstotheCPUatperiodicintervals.ThesesignalsforcetheCPUtostoptheprogramitisrunning,andjumptoanotherprogram,whichwillbetheoperatingsystemprogram(OS).TheOScanthendeterminewhetherthecurrentprogram'stimesliceisnished,andifso,thengiveaturntoanotherprogram,byjumpingtothatprogram.Notetheinteractionofhardware(theelectricalsignals,andtheCPU'sreactiontothem)andsoftware(theOS)here.2 [1]Doneccbigprog.cBytheway,ifyoulogout,whateverbackgroundprocessesyouhaverunningatthetimewillnot bekilled;theywillcontinuetorun.4TerminatingaProcessWecanterminateaprocessbyusingthekillcommand.Wesimplynditspid(saybyusingps),andthentypekill-9pidIftheprocessisintheforeground,though,theeasiestwaytokillitistosimplytypecontrol-C.4