Chapter 2: Operating-System Structures

3y ago
104 Views
7 Downloads
1.53 MB
37 Pages
Last View : 8d ago
Last Download : 3m ago
Upload by : Adele Mcdaniel
Transcription

Chapter 2: Operating-SystemStructuresOperating System Concepts – 9th EditionSilberschatz, Galvin and Gagne 2013

Chapter 2: Operating-System StructuresOperating System ServicesUser Operating System InterfaceSystem CallsTypes of System CallsSystem ProgramsOperating System Design and ImplementationOperating System StructureOperating System DebuggingOperating System GenerationSystem BootOperating System Concepts – 9th Edition2.2Silberschatz, Galvin and Gagne 2013

ObjectivesTo describe the services an operating system provides tousers, processes, and other systemsTo discuss the various ways of structuring an operatingsystemTo explain how operating systems are installed andcustomized and how they bootOperating System Concepts – 9th Edition2.3Silberschatz, Galvin and Gagne 2013

Operating System ServicesOperating systems provide an environment for execution of programsand services to programs and usersOne set of operating-system services provides functions that arehelpful to the user:User interface - Almost all operating systems have a userinterface (UI). Varies between Command-Line (CLI), Graphics UserInterface (GUI), BatchProgram execution - The system must be able to load aprogram into memory and to run that program, end execution,either normally or abnormally (indicating error)I/O operations - A running program may require I/O, which mayinvolve a file or an I/O deviceOperating System Concepts – 9th Edition2.4Silberschatz, Galvin and Gagne 2013

Operating System Services (Cont.)One set of operating-system services provides functions that are helpful tothe user (Cont.):File-system manipulation - The file system is of particular interest.Programs need to read and write files and directories, create and deletethem, search them, list file Information, permission management.Communications – Processes may exchange information, on the samecomputer or between computers over a network Communications may be via shared memory or through messagepassing (packets moved by the OS)Error detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory hardware, in I/O devices, in userprogram For each type of error, OS should take the appropriate action toensure correct and consistent computing Debugging facilities can greatly enhance the user’s andprogrammer’s abilities to efficiently use the systemOperating System Concepts – 9th Edition2.5Silberschatz, Galvin and Gagne 2013

Operating System Services (Cont.)Another set of OS functions exists for ensuring the efficient operation of thesystem itself via resource sharingResource allocation - When multiple users or multiple jobs runningconcurrently, resources must be allocated to each of them Many types of resources - CPU cycles, main memory, file storage,I/O devices.Accounting - To keep track of which users use how much and whatkinds of computer resourcesProtection and security - The owners of information stored in amultiuser or networked computer system may want to control use ofthat information, concurrent processes should not interfere with eachother Protection involves ensuring that all access to system resources iscontrolled Security of the system from outsiders requires user authentication,extends to defending external I/O devices from invalid accessattemptsOperating System Concepts – 9th Edition2.6Silberschatz, Galvin and Gagne 2013

A View of Operating System ServicesOperating System Concepts – 9th Edition2.7Silberschatz, Galvin and Gagne 2013

User Operating System Interface - CLICLI or command interpreter allows direct command entrySometimes implemented in kernel, sometimes by systemsprogramSometimes multiple flavors implemented – shellsPrimarily fetches a command from user and executes itSometimes commands built-in, sometimes just names ofprograms If the latter, adding new features doesn’t require shellmodificationOperating System Concepts – 9th Edition2.8Silberschatz, Galvin and Gagne 2013

User Operating System Interface - GUIUser-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons represent files, programs, actions, etcVarious mouse buttons over objects in the interface causevarious actions (provide information, options, execute function,open directory (known as a folder)Invented at Xerox PARCMany systems now include both CLI and GUI interfacesMicrosoft Windows is GUI with CLI “command” shellApple Mac OS X is “Aqua” GUI interface with UNIX kernelunderneath and shells availableUnix and Linux have CLI with optional GUI interfaces (CDE,KDE, GNOME)Operating System Concepts – 9th Edition2.9Silberschatz, Galvin and Gagne 2013

Touchscreen InterfacesnlTouchscreen devices require newinterfaceslMouse not possible or not desiredlActions and selection based ongestureslVirtual keyboard for text entryVoice commands.Operating System Concepts – 9th Edition2.10Silberschatz, Galvin and Gagne 2013

System CallsProgramming interface to the services provided by the OSTypically written in a high-level language (C or C )Mostly accessed by programs via a high-levelApplication Programming Interface (API) rather thandirect system call useThree most common APIs are Windows API for Windows,POSIX API for POSIX-based systems (including virtuallyall versions of UNIX, Linux, and Mac OS X), and Java APIfor the Java virtual machine (JVM)Operating System Concepts – 9th Edition2.11Silberschatz, Galvin and Gagne 2013

Example of System CallsSystem call sequence to copy the contents of one file to another fileOperating System Concepts – 9th Edition2.12Silberschatz, Galvin and Gagne 2013

Example of Standard APIOperating System Concepts – 9th Edition2.13Silberschatz, Galvin and Gagne 2013

System Call ImplementationTypically, a number associated with each system callSystem-call interface maintains a table indexed according tothese numbersThe system call interface invokes the intended system call in OSkernel and returns status of the system call and any return valuesThe caller need know nothing about how the system call isimplementedJust needs to obey API and understand what OS will do as aresult callMost details of OS interface hidden from programmer by API Managed by run-time support library (set of functions builtinto libraries included with compiler)Operating System Concepts – 9th Edition2.14Silberschatz, Galvin and Gagne 2013

API – System Call – OS RelationshipOperating System Concepts – 9th Edition2.15Silberschatz, Galvin and Gagne 2013

Types of System CallsProcess controlcreate process, terminate processload, executeget process attributes, set process attributeswait for timewait event, signal eventallocate and free memoryDump memory if errorDebugger for determining bugs, single step executionLocks for managing access to shared data between processesOperating System Concepts – 9th Edition2.16Silberschatz, Galvin and Gagne 2013

Types of System CallsFile managementcreate file, delete fileopen, close fileread, write, repositionget and set file attributesDevice managementrequest device, release deviceread, write, repositionget device attributes, set device attributeslogically attach or detach devicesOperating System Concepts – 9th Edition2.17Silberschatz, Galvin and Gagne 2013

Types of System Calls (Cont.)Information maintenanceget time or date, set time or dateget system data, set system dataget and set process, file, or device attributesCommunicationscreate, delete communication connectionsend, receive messages if message passing model to hostname or process name From client to serverShared-memory model create and gain access to memoryregionstransfer status informationattach and detach remote devicesOperating System Concepts – 9th Edition2.18Silberschatz, Galvin and Gagne 2013

Types of System Calls (Cont.)ProtectionControl access to resourcesGet and set permissionsAllow and deny user accessOperating System Concepts – 9th Edition2.19Silberschatz, Galvin and Gagne 2013

Examples of Windows and Unix System CallsOperating System Concepts – 9th Edition2.20Silberschatz, Galvin and Gagne 2013

Standard C Library ExampleC program invoking printf() library call, which calls write() system callOperating System Concepts – 9th Edition2.21Silberschatz, Galvin and Gagne 2013

Operating System Design and ImplementationDesign and Implementation of OS not “solvable”, but someapproaches have proven successfulInternal structure of different Operating Systems can vary widelyStart the design by defining goals and specificationsHighest level: affected by choice of hardware, type of systemThe requirements can be divided into User and System goalsUser goals – operating system should be convenient to use,easy to learn, reliable, safe, and fastSystem goals – operating system should be easy to design,implement, and maintain, as well as flexible, reliable, error-free,and efficientOperating System Concepts – 9th Edition2.22Silberschatz, Galvin and Gagne 2013

Operating System Design and Implementation (Cont.)Important principle to separatePolicy: What will be done?Mechanism: How to do it?Mechanisms determine how to do something, policies decidewhat will be doneThe separation of policy from mechanism is a very importantprinciple, it allows maximum flexibility if policy decisions are tobe changed later (example – timer)Specifying and designing an OS is highly creative task ofsoftware engineeringOperating System Concepts – 9th Edition2.23Silberschatz, Galvin and Gagne 2013

ImplementationMuch variationEarly OSes in assembly languageThen system programming languages like Algol, PL/1Now C, C Actually usually a mix of languagesLowest levels in assemblyMain body in CSystems programs in C, C , scripting languages like PERL,Python, shell scriptsMore high-level language easier to port to other hardwareBut slowerEmulation can allow an OS to run on non-native hardwareOperating System Concepts – 9th Edition2.24Silberschatz, Galvin and Gagne 2013

Operating System StructureGeneral-purpose OS is very large programVarious ways to structure onesSimple structure – MS-DOSMore complex -- UNIXLayered – an abstrcationMicrokernel -MachOperating System Concepts – 9th Edition2.25Silberschatz, Galvin and Gagne 2013

Simple Structure -- MS-DOSMS-DOS – written to provide themost functionality in the leastspaceNot divided into modulesAlthough MS-DOS has somestructure, its interfaces andlevels of functionality are notwell separatedOperating System Concepts – 9th Edition2.26Silberschatz, Galvin and Gagne 2013

Non Simple Structure -- UNIXUNIX – limited by hardware functionality, the original UNIXoperating system had limited structuring. The UNIX OSconsists of two separable partsSystems programsThe kernel Consists of everything below the system-call interfaceand above the physical hardware Provides the file system, CPU scheduling, memorymanagement, and other operating-system functions; alarge number of functions for one levelOperating System Concepts – 9th Edition2.27Silberschatz, Galvin and Gagne 2013

Traditional UNIX System StructureBeyond simple but not fully layeredOperating System Concepts – 9th Edition2.28Silberschatz, Galvin and Gagne 2013

Layered ApproachThe operating system is dividedinto a number of layers (levels),each built on top of lowerlayers. The bottom layer (layer0), is the hardware; the highest(layer N) is the user interface.With modularity, layers areselected such that each usesfunctions (operations) andservices of only lower-levellayersSimplifies debugging andsystem verificationOperating System Concepts – 9th Edition2.29Silberschatz, Galvin and Gagne 2013

Microkernel System StructureMoves as much from the kernel into user spaceMach example of microkernelMac OS X kernel (Darwin) partly based on MachCommunication takes place between user modules usingmessage passingBenefits:Easier to extend a microkernelEasier to port the operating system to new architecturesMore reliable (less code is running in kernel mode)More secureDetriments:Performance overhead of user space to kernel spacecommunicationOperating System Concepts – 9th Edition2.30Silberschatz, Galvin and Gagne 2013

Microkernel System dwareOperating System Concepts – 9th Edition2.31Silberschatz, Galvin and Gagne 2013

ModulesMany modern operating systems implement loadable kernelmodulesUses object-oriented approachEach core component is separateEach talks to the others over known interfacesEach is loadable as needed within the kernelOverall, similar to layers but with more flexibleLinux, Solaris, etcOperating System Concepts – 9th Edition2.32Silberschatz, Galvin and Gagne 2013

Solaris Modular ApproachOperating System Concepts – 9th Edition2.33Silberschatz, Galvin and Gagne 2013

Hybrid SystemsMost modern operating systems are actually not one pure modelHybrid combines multiple approaches to addressperformance, security, usability needsLinux and Solaris kernels in kernel address space, somonolithic, plus modular for dynamic loading of functionalityWindows mostly monolithic, plus microkernel for differentsubsystemOperating System Concepts – 9th Edition2.34Silberschatz, Galvin and Gagne 2013

Operating System GenerationnOperating systems are designed to run on any of a class ofmachines; the system must be configured for each specificcomputer sitenSYSGEN program obtains information concerning the specificconfiguration of the hardware systemlUsed to build system-specific compiled kernel or systemtunedlCan general more efficient code than one general kernelOperating System Concepts – 9th Edition2.35Silberschatz, Galvin and Gagne 2013

System BootWhen power initialized on system, execution starts at a fixedmemory locationFirmware ROM used to hold initial boot codeOperating system must be made available to hardware so hardwarecan start itSmall piece of code – bootstrap loader, stored in ROM orEEPROM locates the kernel, loads it into memory, and starts itSometimes two-step process where boot block at fixedlocation loaded by ROM code, which loads bootstrap loaderfrom diskCommon bootstrap loader, GRUB, allows selection of kernel frommultiple disks, versions, kernel optionsKernel loads and system is then runningOperating System Concepts – 9th Edition2.36Silberschatz, Galvin and Gagne 2013

End of Chapter 2Operating System Concepts – 9th EditionSilberschatz, Galvin and Gagne 2013

Operating System Concepts –9thEdition 2.3 Silberschatz, Galvin and Gagne 2013 Objectives To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system To explain how operating systems are installed and customized and how they boot

Related Documents:

Part One: Heir of Ash Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 Chapter 28 Chapter 29 Chapter 30 .

TO KILL A MOCKINGBIRD. Contents Dedication Epigraph Part One Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Part Two Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18. Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26

DEDICATION PART ONE Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 PART TWO Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 .

About the husband’s secret. Dedication Epigraph Pandora Monday Chapter One Chapter Two Chapter Three Chapter Four Chapter Five Tuesday Chapter Six Chapter Seven. Chapter Eight Chapter Nine Chapter Ten Chapter Eleven Chapter Twelve Chapter Thirteen Chapter Fourteen Chapter Fifteen Chapter Sixteen Chapter Seventeen Chapter Eighteen

18.4 35 18.5 35 I Solutions to Applying the Concepts Questions II Answers to End-of-chapter Conceptual Questions Chapter 1 37 Chapter 2 38 Chapter 3 39 Chapter 4 40 Chapter 5 43 Chapter 6 45 Chapter 7 46 Chapter 8 47 Chapter 9 50 Chapter 10 52 Chapter 11 55 Chapter 12 56 Chapter 13 57 Chapter 14 61 Chapter 15 62 Chapter 16 63 Chapter 17 65 .

HUNTER. Special thanks to Kate Cary. Contents Cover Title Page Prologue Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter

Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 . Within was a room as familiar to her as her home back in Oparium. A large desk was situated i

The Hunger Games Book 2 Suzanne Collins Table of Contents PART 1 – THE SPARK Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8. Chapter 9 PART 2 – THE QUELL Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapt