Linux操作系统1.pdf

上传人:asd****56 文档编号:70340623 上传时间:2023-01-19 格式:PDF 页数:15 大小:155.02KB
返回 下载 相关 举报
Linux操作系统1.pdf_第1页
第1页 / 共15页
Linux操作系统1.pdf_第2页
第2页 / 共15页
点击查看更多>>
资源描述

《Linux操作系统1.pdf》由会员分享,可在线阅读,更多相关《Linux操作系统1.pdf(15页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、Linux操作系统课程信息 Instructor:刘晋 email: office:信息楼214217 office:信息楼214,217 Classtime:Tue3:05pm4:40pm;Classroom:教3A205 Labtime:Wed,week6,9,11 PREQUISITES:BasicknowledgeandworkingexperienceinUnixggpcommands.AbilitytoprograminCorC+.ReferenceBookAdvanced Programming in the UNIX Environment(2ndEdition)Advance

2、dProgrammingintheUNIXEnvironment(2ndEdition)W.RichardStevens,AddisonWesleyCOMPUTERSYSTEMS:PCs running Linux Virtual PCs running LinuxPCsrunningLinux,VirtualPCsrunningLinuxGRADING t b d tidGRADING:tobedeterminedAssignments:%Programming Projects:%ProgrammingProjects:%COURSECONTENTS:IntroductiontotheUn

3、ixOperatingSystem:Files,directories,specialfiles,logicalorganizationofUnixfilesystem;useraccount,loginprocessandcommandexecution.ProgramdevelopmentSourcefiles;compiler,assemblerandobjectfiles;linker,libraryandexecutablefiles;loaderandexecutionimages.Symbolicdebuggerandruntimesupport.Executionimageof

4、Cprograms:Code,dataandstacksegments;functioncallingconvention,stackframesandparameterpassing;FileI/O:SystemcallsandlowlevelfileI/O;open,close,read,write,lseek,filedescriptorsandfilesharing.Execution of User mode and Kernel mode images implementation and implications of systemExecutionofUsermodeandKe

5、rnelmodeimages,implementationandimplicationsofsystemcalls.FileControl:Permissions and access control fcntl chown chmod hard and soft links file status and statisticsPermissionsandaccesscontrol,fcntl,chown,chmod,hardandsoftlinks,filestatusandstatistics.I/Oredirection,pipes,filtersandapplications.Stan

6、dardI/OLibraryStreamsandhighlevelfileI/O;userspacebuffering,g/;pg,relationshipwithlowlevelI/O,charandlinemodeI/O,FormattedI/O.File system implementation:Filesystemimplementation:Inodes andfilerepresentation;mkfs andphysicalfilesystemlayout;traversalofthefilesystemtree;bootingsystemimages.Processes:C

7、onceptandimplementationofprocesses,processexecutionenvironment,usermodeandkernelmode imagesmodeimages,processstatestransitions.ProcessesintheUnixsystem;init,loginanduserprocesses.ProcessControl:fork,vfork,wait,exit,kill,execoperations.trapsandsignal handlingsignalhandling.ProcessSynchronizationandCo

8、mmunication:Signals,pipes,semaphores,messagesandsharedmemorysegments.Sockets.Networking:Networking:IntroductiontoInternet;host,addressresolution,routing;protocols,clientandserver;ftp,rlogin,nfs,andnis,SocketProgramming.MiscTopics:sh andPerlprogrammingandotherrelated.Introduction toUnix1.TheUnixFileS

9、ystemTree:TheUnixfilesystemisorganizedasatree,asshownbelow.EachNODEofthetreeisaFILE.2.Unixfiletypes:I.Directoryfiles:Thesearedirectories.Adirectorymaycontainotherdirectoriesand(nondirectory)files.II.Nondirectoryfiles:Nondirectory files are either REGULAR or SPECIAL files(SEE BELOW).Note thatNon dire

10、ctoryfilesareeitherREGULARorSPECIALfiles(SEEBELOW).NotethatNondirectoryfilescanonlyappearasleafnodesinthetree.1.REGULARfiles:Regular files are also called ORDINARY files They contain either ordinary textRegularfilesarealsocalledORDINARYfiles.Theycontaineitherordinarytextorexecutablebinarycodes.2.SPE

11、CIALfiles:l f lh/ddh/ddSpecialfilesareentriesinthe/devdirectory.TheyrepresentI/Odevices,andarefurtherclassifiedas:CHARspecialfiles,e.g./dev/tty0,/dev/modem.BLOCKspecialfiles,e.g./dev/fd0,/dev/hda.OthertypessuchasNetworkspecialfiles.III.SoftLINKfiles:TheseareRegularfileswhosecontentsarepathnamesofoth

12、erfiles.Assuchtheyareusedtoreferenceotherfiles.Example:theUnixcommandln s aVeryLongFileName myLinklnsaVeryLongFileName myLinksetsupmyLink asasoftlinktoaVeryLongFileName.AccesstomyLink willberedirectedtotheactualfileaVeryLongFileName.3.Pathname:TheROOTnodeofaUnixfilesystemtree,symbolizedby/,iscalledt

13、herootdirectory.EachnodeofthetreeisrepresentedbyaPATHNAMEoftheform/a/b/c/dORa/b/c/dEachUnixfileisspecifiedbyapathname.*ApathnameisABSOLUTEifitbeginswitha/.pg/*ApathnameisRELATIVEifitdoesnotbeginwitha/.A relative pathname starts from the Current Working Directory(CWD).ArelativepathnamestartsfromtheCu

14、rrentWorkingDirectory(CWD).WhenauserlogintoUnix,theCWDisusuallysettohis/hersHOMEdirectory.TheCWDcanbechangedbyusingthecd command.Thepwd commandprintstheabsolutepathnameoftheCWD.4.ContentsofDirectoriesUnder/:/bin:commonlyusedsystemcommands,e.g ls,date,./dev:Specialfiles./etc:Unixsystemmaintenancefile

15、s./lib:Unixsystemlibraries./sbin:Unix system administration commands/sbin:Unixsystemadministrationcommands./tmp:temporaryfiles./usr:/usr/bin:moreexecutablefilessuchascc,gzip./usr/include:.hfiles/usr/lib:specificlibraryfiles./usr/man:onlinemanualdirectory./y/usr/X11:XWindowsystem./hditi/user:userhome

16、directories./vmunix:bootableUnixsystemimagefile.5.LoginProcess:(1).UserAccount:Eachuserisassignedanaccountbythesystemadministrator.Inastand aloneUnixgyysystem,useraccountsaremaintainedinafilenamed/etc/passwd.In a network system composed of many Unix machines such information is usuallyInanetworksyst

17、emcomposedofmanyUnixmachines,suchinformationisusuallymaintainedonaServermachine,whichprovidesotherUnixmachineswithasinglecopyoftheuseraccountinformation.Auseraccounttypicallycontainsthefollowingfields,separatedby“:”root:aXuoPkB4hz:0:0:root:/root:/bin/bashjliu:Pir2NYB4Bqi9I:501:100:JinLiu,cs faculty:

18、/home/jliu:/bin/bash username:password:gid:uid:full name:HOME dir:programToExecuteusername:password:gid:uid:fullname:HOMEdir:programToExecute(2).LoginProcess:()ogocessAPROCESSisasequenceofexecutionsregardedasasingleentiry bythesystem.InUnix,everyactivityiscarriedoutbyaprocess.WhenUnixstarts,itgenera

19、tesaspecial process P1 which executes the file/etc/init For this reason P1 is also calledspecialprocess,P1,whichexecutesthefile/etc/init.Forthisreason,P1isalsocalledtheINITprocess.Itistheparentofalluserprocessesinthefollowingmanner:P1 reads some s stem onfiration files to find o t the terminals s pp

20、orted b theP1readssomesystemconfigurationfilestofindouttheterminalssupportedbythesystem.Foreachterminal,itgeneratesachildprocessonthatterminal.Then,itwaitsforanyoftheterminalprocesstoterminate.Whenaterminalprocessterminates(byuser logout)P1 regenerates another child process on that terminaluserlogou

21、t),P1regeneratesanotherchildprocessonthatterminal.Eachchildprocessopens3(stream)FILEsonitsownterminal.TheseFILEsareknownasstdin:theterminalsKeyboard,forinputs;stdout:theterminalsDisplay,foroutputs;stderr:alsotheDisplay,forerroroutputs;Thenthechildprocessexecutes/etc/getty,whichdisplaysthemessagelogi

22、n:onitsstdout,awaitingausertologin.Atthismoment,theloginprocessisnotyetassociated with any user When a user tries to login the login process validatesassociatedwithanyuser.Whenausertriestologin,theloginprocessvalidateshis/herusernameandpasswordin/etc/passwd.Iftheuserhasavalidaccount,theloginprocesst

23、akesontheusersuid andgid,therebybecomingtheusersprocess.ItthensetstheCWDtotheusersHOMEdirectoryandexecutestheprogramspecifiedypgpintheusersaccount.ThatprogramisusuallyaversionoftheUnixshell,e.g.bash,csh,etc.TheUnixshellisacommandinterpreter.Itdisplaysaprompt%(ORsomeothersymbol,whichcanbesetbytheusr)

24、difhidandwaitsfortheusertoinputcommands.Acommandissimplyanexecutableprogram.Whentheuserentersacommand,thesh process(i.e.theuserprocessthatsexecutingthesh)will(1).generateachildprocesstoperformthecommand;(2)wait for the child process to terminate;(2).waitforthechildprocesstoterminate;(3).prompttheuse

25、rforcommandsagain;Thesh processterminateswhenitseeslogoutorEND_OF_FILE.AcommandisNOTexecutedbysh itselfbutbyachildprocess.Ausercanstartmanyprocesses,eachperformingadifferenttask.Forexample,%ls&date&a.out&C1C2C3NoWaitwill start 3 children processes C1 C2 C3 which execute ls date a out respectivelywil

26、lstart3childrenprocesses,C1,C2,C3,whichexecutels,date,a.out respectively,andcausethesh topromptagainwithoutwaitingforanyofthechildprocessestoterminate.ThisiscalledMULTITASKING.In this example all 4 processes will run CONCURRENTLY Among them the sh runs inInthisexample,all4processeswillrunCONCURRENTL

27、Y.Amongthem,thesh runsintheFOREGROUNDwhileothersrunintheBACKGROUND.Onlytheforegroundprocesscanreceiveinputsfromstdin.Thefg commandcanbeusedtoraiseabackground process to foreground.The ps command displays all the ProcessId(PID)backgroundprocesstoforeground.Theps commanddisplaysalltheProcessId(PID)ofa

28、user.(1).Thels lcommandliststhecontentsofadirectory:Homework:DueonFeb28drwxrxrx3jin jin 40962010090123:28Eclipseworkspacerwrr 1jin jin 1792010083120:57examples.desktopdrwxrxrx19jin jin 40962010090121:22nsallinone2.34drwxrxrx4jin jin 40962010110809:51tempdrwxrxrx2jin jin 40962010083121:06公共的Whatisthe

29、meaningofeachfieldinaboveoutput?(2).Whatarethepermissionbitsofafile,andwhatdotheydo?(3)Each user has a UserId(uid)and a GroupId(gid)how does a user get hid/her uid and gid?What are the uid(3).EachuserhasaUserId(uid)andaGroupId(gid),howdoesausergethid/heruid andgid?Whataretheuidandgid usedfor?(4).The

30、ownerofafilecanusetheUnixcommandchmod 0766fileNametochangethemodeoffileName.Whataretheresultingpermissions?(5).Whatdoesthexbitsofadirectorymean?(6).Unixhasaspecialuser,calledtheSuperUser ortheRoot,whocanaccessanyfile.Whatsthereasonforhavingsuch a Super user?suchaSuperuser?(7).HowdoesauseracquireaUni

31、xprocess?(8).Howmanyprocesseswillbeexecutingwiththesh command?%a&b&c&d&Whichoneistheforegroundprocess?(9).TheUnixcommandls|moresetsup2processes,oneexecutesls andtheotherexecutesmore,insuchawaythattheoutputsofthefirstprocessls arePIPEd tothesecondprocess more How many processes will be executing with the sh command?processmore.Howmanyprocesseswillbeexecutingwiththesh command?%a|b|c|d

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 其他杂项

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com