http://www.cse.buffalo.edu/~rapaport/howtostudy.htmlWork HabitsOperating System OverviewContentsQuestionInterrupt MechanismLarge Pentium systemA peek into UnixUnix: ApplicationUnix: LibrariesTypical Unix OS StructureSlide 12Process HierarchyCode Layout for ProcessConflicts --- DeadlocksInter-process CommunicationSlide 17Steps in Making a System CallSome System Calls For Process ManagementShellFile System for University DeptFile System LinksMounting File SystemsMount file systems (UNIX)Some System Calls For File ManagementSome System Calls For Directory ManagementSome System Calls For Miscellaneous TasksSystem Calls in WindowsOperating System StructureSlide 30VM Operating System StructureMicrokernel Operating System StructureDistributed Operating System StructureMetric UnitsReading for Next ClassSummary01/14/19CS241 © 2007 KN and LA, All Rights Reserved1http://www.cse.buffalo.edu/~rapaport/howtostudy.html01/14/19CS241 © 2007 KN and LA, All Rights Reserved2Work HabitsAssume education is a full-time job or 40 hours/week. 1 academic credit equals 1 hour. 12 credits is 12 hours in class. 40 – 12 gives you 28 hours that you should be spending studying at home (or in the library).CS 241 Spring 2007System Programming 01/14/19 CS241 © 2007 KN and LA, All Rights Reserved3 Operating System OverviewOperating System OverviewProfessor: Klara Nahrstedt01/14/19CS241 © 2007 KN and LA, All Rights Reserved4ContentsHardware Review S: Ch 1 Operating System ConceptsSystem CallsOperating System StructureUnits01/14/19CS241 © 2007 KN and LA, All Rights Reserved5QuestionInterrupts: are they the basis for:# Question Yes No1 Security A B2 Asynchronous Events A B3 System Calls A B4 Multiprogramming A B5 Libraries A B01/14/19CS241 © 2007 KN and LA, All Rights Reserved6Interrupt Mechanism(a)a) Steps in starting an I/O device and getting interruptb) How the CPU is interrupted(b)01/14/19CS241 © 2007 KN and LA, All Rights Reserved7Large Pentium system01/14/19CS241 © 2007 KN and LA, All Rights Reserved8A peek into UnixApplicationPortableOSLayerLibrariesMachine-dependentlayerUserspace/levelKernelspace/level• User/kernel modes are supported by hardware •Some systems do not have clear user-kernel boundary01/14/19CS241 © 2007 KN and LA, All Rights Reserved9Unix: ApplicationApplication(E.g.,emacs)PortableOSLayerLibrariesMachine-dependentlayerWrittenbyprogrammerCompiledbyprogrammerUsesfunctioncalls01/14/19CS241 © 2007 KN and LA, All Rights Reserved10Unix: LibrariesApplicationPortableOSLayerLibraries(e.g.,stdio.h)Machine-dependentlayerProvidedpre-compiledDefinedinheadersInputtolinker(compiler)InvokedlikefunctionsMaybe“resolved”whenprogramisloaded01/14/19CS241 © 2007 KN and LA, All Rights Reserved11Typical Unix OS StructureApplicationPortableOSLayerLibrariesMachine-dependentlayersystemcalls(read,open..)All“high-level”code01/14/19CS241 © 2007 KN and LA, All Rights Reserved12Typical Unix OS StructureApplicationPortableOSLayerLibrariesMachine-dependentlayerBootstrapSysteminitializationInterruptandexceptionI/OdevicedriverMemorymanagementKernel/usermodeswitchingProcessormanagement01/14/19CS241 © 2007 KN and LA, All Rights Reserved13Process HierarchyA process treeA created two child processes, B and CB created three child processes, D, E, and F01/14/19CS241 © 2007 KN and LA, All Rights Reserved14Code Layout for ProcessProcesses have three segments: text, data, stack01/14/19CS241 © 2007 KN and LA, All Rights Reserved15Conflicts --- Deadlocks(a) A potential deadlock. (b) an actual deadlock.01/14/19CS241 © 2007 KN and LA, All Rights Reserved16Inter-process CommunicationTwo processes connected by a pipe01/14/19CS241 © 2007 KN and LA, All Rights Reserved17QuestionStacks: are needed for:# Question Yes No1 Multiple Interrupts A B2 System Calls A B3 Debugging A B4 C++ A B01/14/19CS241 © 2007 KN and LA, All Rights Reserved18Steps in Making a System Call read (fd, buffer, nbytes)01/14/19CS241 © 2007 KN and LA, All Rights Reserved19Some System Calls For Process Management01/14/19CS241 © 2007 KN and LA, All Rights Reserved20ShellA stripped down shell:while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) { /* fork off child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */} else { /* Child code */ execve (command, parameters, 0); /* execute command */ }}01/14/19CS241 © 2007 KN and LA, All Rights Reserved21File System for University Dept01/14/19CS241 © 2007 KN and LA, All Rights Reserved22File System Links(a) Two directories before linking/usr/jim/memo to ast's directory(b) The same directories after linking01/14/19CS241 © 2007 KN and LA, All Rights Reserved23Mounting File SystemsBefore mounting, files on floppy are inaccessibleAfter mounting floppy on b,–files on floppy are part of file hierarchy01/14/19CS241 © 2007 KN and LA, All Rights Reserved24Mount file systems (UNIX)(a) File system before the mount(b) File system after the mount01/14/19CS241 © 2007 KN and LA, All Rights Reserved25Some System Calls For File Management01/14/19CS241 © 2007 KN and LA, All Rights Reserved26Some System Calls For Directory Management01/14/19CS241 © 2007 KN and LA, All Rights Reserved27Some System Calls For Miscellaneous Tasks01/14/19CS241 © 2007 KN and LA, All Rights Reserved28System Calls in Windows01/14/19CS241 © 2007 KN and LA, All Rights Reserved29Operating System StructureSimple structuring model for a monolithic system01/14/19CS241 © 2007 KN and LA, All Rights Reserved30Operating System StructureStructure of the THE operating system01/14/19CS241 © 2007 KN and LA, All Rights Reserved31VM Operating System StructureStructure of VM/370 with CMS01/14/19CS241 © 2007 KN and LA, All Rights Reserved32Microkernel Operating System StructureThe client-server model01/14/19CS241 © 2007 KN and LA, All Rights Reserved33Distributed Operating System StructureThe client-server model in a distributed system01/14/19CS241 © 2007 KN and LA, All Rights Reserved34Metric UnitsThemetricprefixes01/14/19CS241 © 2007 KN and LA, All Rights Reserved35Reading for Next ClassS: Ch 2 pp 1-80+ R: Ch 1, 2 pp 1-48Revise your CRead
View Full Document