Operating System Services

2y ago
5 Views
3 Downloads
547.02 KB
29 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Elise Ammons
Transcription

CSE325 Principles of Operating SystemsOperating System ServicesDavid Duggandduggan@sandia.govJanuary 22, 2013

Reading Assignment 3n Chapter 3, due 01/291/23/13CSE325 - OS Services2

What Categories of Services Might beProvided?n Program executionn Protectionn Process managementn Memory managementn Storage managementn Communicationn Security1/23/13CSE325 - OS Services3

OSes: Program Executionn Multiprogramming needed for efficiency of utilizationn n Multiprogramming organizes jobs (code and data) so CPU always has oneto executen A subset of total jobs in system is kept in memoryn One job selected and run via job schedulingn When it has to wait (for I/O for example), OS switches to another jobTimesharing (multitasking) is logical extension in which the CPUswitches jobs so frequently that users can interact with each job whileit is running, creating interactive computingn Response time should be 1 secondn Each user has at least one program executing in memory [ processn If several jobs ready to run at the same time [ CPU schedulingn If processes don’t fit in memory, swapping moves them in and out to runn Virtual memory allows execution of processes not completely in memory

OS Operationsn Interrupt driven by hardwaren Software error or request creates exception or trapn n n Division by zero, request for operating system serviceOther process problems include infinite loop, processesmodifying each other or the operating systemDual-mode operation allows OS to protect itself and othersystem componentsn n User mode and kernel modeMode bit provided by hardwaren n n Provides ability to distinguish when system is running user code orkernel codeSome instructions designated as privileged, only executable in kernelmodeSystem call changes mode to kernel, return from call resets it to user

Transition from User to Kernel Moden Timer to prevent infinite loop / process hogging resourcesn Set interrupt after specific periodn Operating system decrements countern When counter reaches zero, generate an interruptn Set up before scheduling process to regain control orterminate program that exceeds allotted time

Process Managementn n A process is a program in execution. It is a unit of work within thesystem. Program is a passive entity, process is an active entity.Process needs resources to accomplish its taskn n n n Process termination requires reclaiming of any reusable resourcesSingle-threaded process has one program counter specifying thelocation of the next instruction to executen n n CPU, memory, I/O, filesInitialization dataProcess executes instructions sequentially, one at a time, untilcompletionMulti-threaded process has one program counter per threadTypically system has many processes, some user, some operatingsystem, running concurrently on one or more CPUsn Concurrency by multiplexing the CPUs among the processes / threads1/23/13CSE325 - OS Services7

Process Management ActivitiesThe operating system is responsible for the followingactivities in connection with process management:n Creating and deleting both user and system processesn Suspending and resuming processesn Providing mechanisms for process communicationn Providing mechanisms for process synchronizationn Providing mechanisms for deadlock handling1/23/13CSE325 - OS Services8

Memory Managementn Memory management activitiesn n n Keeping track of which parts of memory are currentlybeing used and by whomDeciding which processes (or parts thereof) and data tomove into and out of memoryAllocating and deallocating memory space as neededn All data in memory before and after processingn All instructions in memory to allow executionn Memory management determines what is in memoryn Optimizing CPU utilization & computer response to users1/23/13CSE325 - OS Services9

Storage Managementn File-System managementn n n Files usually organized in directoriesAccess control on most systems to determine who can accesswhatOS activities includen n n n n Creating and deleting files and directoriesPrimitives to manipulate files and directoriesMapping files onto secondary storageBackup files onto stable (non-volatile) storage mediaOS provides uniform, logical view of information storagen n Abstracts physical properties to logical storage unit - fileEach medium is controlled by device (i.e., disk drive, tape drive)n Varying properties include access speed, capacity, data-transfer rate,access method (sequential or random)10

I/O Subsystemn I/O subsystem responsible forn Memory management of I/O includingn n n n Buffering: storing data temporarily while it is beingtransferredCaching: storing parts of data in faster storage forperformanceSpooling: the overlapping of output of one job with input ofother jobsn General device-driver interfacen Drivers for specific hardware devicesOne purpose of OS is to hide peculiarities of hardwaredevices from the user1/23/13CSE325 - OS Services11

Protection and Securityn n Protection – any mechanism for controlling access ofprocesses or users to resources defined by the OSSecurity – defense of the system against internal andexternal attacksn n Huge range, including denial-of-service, worms, viruses, identitytheft, theft of serviceSystems generally first distinguish among users, to determinewho can do whatn n n n User identities (user IDs, security IDs) include name andassociated number, one per userUser ID then associated with all files, processes of that user todetermine access controlGroup identifier (group ID) allows set of users to be defined andcontrols managed, then also associated with each process, filePrivilege escalation allows user to change to an effective ID12with more rights

A View of Operating System Services1/23/13CSE325 - OS Services13

Operating System Servicesn Some services provide functions helpful to the user:n User interface - Almost all operating systems have a userinterface (UI)n n n n Command-Line (CLI), Graphics User Interface (GUI), BatchProgram execution - The system must be able to load a programinto memory and to run that program, end execution, eithernormally or abnormally (indicating error)I/O operations - A running program may require I/O, which mayinvolve a file or an I/O device.File-system manipulation - The file system is of particularinterest. Obviously, programs need to read and write files anddirectories, create and delete them, change them, search them,list file information, perform permission management.14

Operating System Services (Cont.)n Communications – Processes may exchange information, on thesame computer or between computers over a networkn n Communications may be via shared memory or through messagepassing (packets moved by the OS)Error detection – OS needs to be constantly aware of possibleerrorsn n n May occur in the CPU and memory hardware, in I/O devices, in userprogramFor each type of error, OS should take the appropriate action toensure correct and consistent computingDebugging facilities can greatly enhance the user’s andprogrammer’s abilities to efficiently use the system1/23/13CSE325 - OS Services15

Operating System Services (Cont.)n For efficient operation of system via resource sharingn n n Resource allocation - When multiple users / jobsrunning concurrently, resources must be allocated toeach of themAccounting - To keep track of which users use, howmuch, and what kinds of computer resourcesProtection and securityn n n Protection involves ensuring that all access to systemresources is controlledSecurity of the system from outsiders requires userauthentication, extends to defending external I/O devicesfrom invalid access attemptsIf a system is to be protected and secure, precautionsmust be instituted throughout it. A chain is only as strongas its weakest link.16

Bourne Shell Command Interpreter1/23/13CSE325 - OS Services17

User Operating System Interface - CLICommand-Line Interface (CLI) allows direct commandentryn Sometimes implemented in kernel, sometimes bysystems programn Sometimes multiple flavors implemented – shellsn Primarily receives command from user and executes itn Sometimes commands built-in, sometimes just names ofprograms, sometimes a combinationn 1/23/13If the latter, adding new features doesn’t require CLImodificationCSE325 - OS Services18

User Operating System Interface - GUIn User-friendly desktop metaphor interfacen Usually mouse, keyboard, and monitorn Icons represent files, programs, actions, etcn n n Various 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 interfacesn n n Microsoft Windows is GUI; CLI is “command” shellApple Mac OS X has “Aqua” GUI; UNIX kernel underneath andmultiple shells availableSolaris has multiple GUIs; CLI is multiple shells1/23/13CSE325 - OS Services19

System Callsn Programming interface to the services provided by OSn Typically written in a high-level language (C or C )n n n Mostly accessed by programs via a high-level ApplicationProgram Interface (API) rather than direct system calluseThree most common APIs are Win32 API for Windows,POSIX API for POSIX-based systems (including virtuallyall versions of UNIX, Linux, and Mac OS X), and JavaAPI for the Java virtual machine (JVM)Why use APIs rather than system calls?1/23/13CSE325 - OS Services20

Example of System Callsn System call sequence to copy the contents of one fileto another file21

Example of Standard APIReadFile(): Win32 API—a function for reading from a filen A description of the parameters passed to ReadFile()n n n n n HANDLE file—the internal handle of the file to be readLPVOID buffer—a buffer where the data will be read into and writtenfromDWORD bytesToRead—the number of bytes to be read into thebufferLPDWORD bytesRead—the number of bytes read during the last readLPOVERLAPPED ovl—indicates if overlapped I/O is being used22

API – System Call – OS Relationship1/23/13CSE325 - OS Services23

System Call Implementationn Typically, a number associated with each system calln n n System-call interface maintains a table indexed according tothese numbersThe system call interface invokes intended system call in OSkernel and returns status of the system call and any returnvaluesThe caller need know nothing about how the system call isimplementedn n Just needs to obey API and understand what OS will do as aresult of the callMost details of OS interface hidden from programmer by APIn Managed by run-time support library (set of functions built intolibraries included with compiler)24

Standard C Library Examplen C program invokingprintf() library call,which calls write()system call1/23/13CSE325 - OS Services25

System Call Parameter Passingn Often, more information is required than simplyidentity of desired system calln n Exact type and amount of information vary according toOS and callMethods used to pass parameters to OSn Simplest: pass the parameters in registersn n Parameters stored in a block, or table, in memory, andaddress of block passed as a parameter in a registern n n In some cases, may be more parameters than registersThis approach taken by Linux and SolarisParameters placed, or pushed, onto the stack by the programand popped off the stack by the operating systemBlock and stack methods do not limit the number or length ofparameters being passed26

Parameter Passing via Table1/23/13CSE325 - OS Services27

Types of System Callsn Process controln File managementn Device managementn Information maintenancen Communications1/23/13CSE325 - OS Services28

System Programsn n System programs provide a convenient environment forprogram development and execution. Including:n File manipulationn Status informationn Programming language supportn Program loading and executionn Communicationsn Application programsMost users’ view of the operating system is defined bysystem programs, not the actual system calls29

Operating System Services ! Some services provide functions helpful to the user: ! User interface - Almost all operating systems have a user interface (UI) ! Command-Line (CLI), Graphics User Interface (GUI), Batch ! Program execution - The system must be able to load a program i

Related Documents:

1.1 Operating System Functionality The operating system controls the machine It is common to draw the following picture to show the place of the operating system: application operating system hardware user This is a misleading picture, because applications mostly execute machine instruc-tions that do not go through the operating system.

An operating system is a control program. It controls the execution of user programs to prevent errors and improper use of the computer. The Primary goal of operating system is convenience for the user. The operating system makes the use of system easier. The secondary goal of operating system is efficient operation of the computer system.

Key words and phrases: operating system design, real time operating system, layered operating system, software architecture, and process communication. CR Categories: 3.80, 3.83, 4.35. i. INTRODUCTION The Modular Operating System for SUMC (MOSS) is a general purpose real time operating

An Operating System performs all the basic tasks like managing file, process, and memory. Thus operating system acts as manager of all the resources, i.e. resource manager. Thus operating system becomes an interface between user and machine. Types of Operating Systems: Some of the widely used operating systems are as follows- 1.

operating system is responsible for providing access to these system resources. The abstract view of the components of a computer system and the positioning of OS is shown in the Figure 1.2. Task “Operating system is a hardware or software”. Discuss. 1.2 History of Computer Operating Systems Early computers lacked any form of operating system.

Multi User Operating System- A Multi-user operating system is a computer operating system which allows multiple users to access the single system with one operating system on it. It is generally used on large mainframe computers. Example: Linux, Unix, Windows 2000, Ubuntu, Mac OS etc.,

An Operating System is an important part of almost every computer system. An amazing aspect of operating system is how varied it is useful in accomplishing the tasks. Mainframe Operating System are designed primarily to optimize utilization of hardware. Personal Operating System Support complex games, business applications and everything in .

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