Download presentation
Presentation is loading. Please wait.
Published byLindsay O'Neil Modified over 9 years ago
1
18 September 2008CIS 340 # 1 Operating System Control program for the execution of application programs An interface between applications and hardware An intermediary between a user of a computer and the computer hardware
2
2 Operating System Objectives Convenience –Makes the computer more convenient to use Efficiency –Allows computer system resources to be used in an efficient manner Ability to evolve –Permit effective development, testing, and introduction of new system functions without interfering with service
3
18 September 2008CIS 340 # 3 Layers of Computer System
4
4 Services Provided by the Operating System Program development –Editors and debuggers Program execution Access to I/O devices Controlled access to files System access
5
5 Services Provided by the Operating System Error detection and response –Internal and external hardware errors Memory error Device failure –Software errors Arithmetic overflow Access forbidden memory locations –Operating system cannot grant request of application
6
6 Services Provided by the Operating System Accounting –Collect usage statistics –Monitor performance –Used to anticipate future enhancements –Used for billing purposes
7
18 September 2008CIS 340 # 7 Operating System: Other Services Allows multiple, concurrent computations –Allows through enabling resources allocation Controls interactions between concurrent computations –Enforces rules to securely execute the computations without losing integrity Supports interactions of computations among different computer systems –Handles networking interactions
8
18 September 2008CIS 340 # 8 Operating System Definitions Resource allocator –Manages and allocates resources Control program –Controls the execution of user programs –Controls operations of I/O devices Kernel –Portion of operating system running at all times in main memory –All and anything else being application programs –Contains most frequently used functions –Also called the nucleus
9
9
10
18 September 2008CIS 340 # 10 Migration of OS Concepts and Features through Platforms Batch TIME SHARE
11
18 September 2008CIS 340 # 11 Computer-System Architecture 1.Control Unit 2.Arithmetic / Logic Unit 3.Memory
12
18 September 2008CIS 340 # 12 Hardware Features HW realization supporting OS services Memory protection –Do not allow the memory area containing the monitor to be altered –User program executes in user mode Certain instructions may not be executed –Monitor executes in system mode Kernel mode Privileged instructions are executed Protected areas of memory may be accessed
13
18 September 2008CIS 340 # 13 Hardware Features HW realization supporting OS services Timer –Prevents a job from monopolizing the system Privileged instructions –Certain machine level instructions to be executed only by the monitor Interrupts –Early computer models did not have this capability
14
18 September 2008CIS 340 # 14 Computer-System Operation: Premises I/O devices and the CPU can execute concurrently Each device controller handles a particular device type Each device controller has a local buffer CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller InterruptInterrupt generated by device controller informs CPU about end of controller’s task
15
18 September 2008CIS 340 # 15 Interrupts: Expectations interrupt service routineTransfers control to the interrupt service routine Interrupt vectorInterrupt vector contains the addresses of all the service routines Interrupt architectureInterrupt architecture saves the address of the interrupted instruction A trap is a software-generated interrupt caused either by an error or a user request. interrupt drivenAn operating system is interrupt drivenDef:
16
Interrupt service routine (ISR) An interrupt handler, – also known as an interrupt service routine (ISR), –is a callback subroutine in an operating system or device driver callbackoperating systemdevice driver –whose execution is triggered by the reception of an interrupt.interrupt –have a multitude of functions, which vary based on the reason the interrupt was generated and the speed at which the interrupt handler completes its task. An interrupt handler is a low-level counterpart of event handlers.event handlers –These handlers are initiated by either hardware interrupts or interrupt instructions in software, –used for servicing hardware devices and transitions between protected modes of operation such as system calls. 18 September 2008CIS 340 # 16
17
Interrupt vector In computing, an interrupt vector iscomputing –the memory address of an interrupt handler,memory addressinterrupt handler –or an index into an array called an interrupt vector table or dispatch table containing the memory addresses of interrupt handlers.indexarrayinterrupt vector table When an interrupt is generated,interrupt – the processor saves its execution state via a context switch, andprocessorexecution statecontext switch –begins execution of the interrupt handler at the interrupt vector. 18 September 2008CIS 340 # 17
18
18 September 2008CIS 340 # 18 I/O Devices Sloooooooooooow EX: System Utilization:
19
18 September 2008CIS 340 # 19 EX:Uniprogramming Processor must wait for I/O instruction to complete before preceding
20
18 September 2008CIS 340 # 20 EX: Multiprogramming with Three Programs Processor experiences less lapses
21
18 September 2008CIS 340 # 21 CONSIDER:Utilization Histograms
22
18 September 2008CIS 340 # 22 EX: Sample Program Execution Attributes
23
18 September 2008CIS 340 # 23 EX: Typical I/O Rates for Devices
24
24 Process Consists of three components –An executable program –Associated data needed by the program –Execution context of the program All information the operating system needs to manage the process
25
25 Process
26
26 Memory Management Process isolation Automatic allocation and management Support of modular programming Protection and access control Long-term storage
27
27 Virtual Memory Allows programmers to address memory from a logical point of view No hiatus between the execution of successive processes while one process was written out to secondary store and the successor proceess was read in
28
28 Virtual Memory and File System Implements long-term store Information stored in named objects called files
29
29 Paging Allows process to be comprised of a number of fixed-size blocks, called pages Virtual address is a page number and an offset within the page Each page may be located any where in main memory Real address or physical address in main memory
30
30 Virtual Memory
31
31 Virtual Memory Addressing
32
18 September 2008CIS 340 # 32
33
18 September 2008CIS 340 # 33 OS Key Elements
34
18 September 2008CIS 340 # 34 Problems Arising with System Software 1.Improper synchronization –Ensure a process waiting for an I/O device receives the signal 2.Failed mutual exclusion –Memory overwrites 3.Nondeterminate program operation – Program A should only depend on input to it –Activities of other programs should not influence Program A ’s outcome 4.Deadlocks
35
18 September 2008CIS 340 # 35 System Structure A series of levels –Each level performs a related subset of functions more primitive –Each level relies on the next lower level to perform more primitive functions LEVELS (1-4) Process Hardware LevelsProcess Hardware Levels (5-7) Concepts with MultiprogrammingConcepts with Multiprogramming (8-13) Deal with External ObjectsDeal with External Objects
36
18 September 2008CIS 340 # 36 Process Hardware Levels Level 1 –Electronic circuits –Objects are registers, memory cells, and logic gates –Operations are clearing a register or reading a memory location Level 2 –Processor’s instruction set –Operations such as add, subtract, load, and store Level 3 –Adds the concept of a procedure or subroutine, plus call/return operations Level 4 –Interrupts
37
18 September 2008CIS 340 # 37 Concepts with Multiprogramming Level 5 –Process as a program in execution –Suspend and resume processes Level 6 –Secondary storage devices –Transfer of blocks of data Level 7 –Creates logical address space for processes –Organizes virtual address space into blocks
38
18 September 2008CIS 340 # 38 Deal with External Objects (p 1 / 2) Level 8 –Communication of information and messages between processes Level 9 –Supports long-term storage of named files Level 10 –Provides access to external devices using standardized interfaces
39
18 September 2008CIS 340 # 39 Deal with External Objects (p 2 / 2) Level 11 –Maintains the association between the external and internal identifiers Level 12 –Provides full-featured facility for the support of processes Level 13 –Provides an interface to the operating system for the user
40
18 September 2008CIS 340 # 40 Modern Operating Systems: Concepts Microkernel architecture Multithreading Symmetric multiprocessing (SMP)
41
41 Modern Operating Systems Distributed operating systems –Provides the illusion of a single main memory space and single secondary memory space
42
42 Modern Operating Systems Object-oriented design –Used for adding modular extensions to a small kernel –Enables programmers to customize an operating system without disrupting system integrity
43
43 Windows Architecture Modular structure for flexibility Executes on a variety of hardware platforms Supports application written for other operating system
44
44
45
45 Operating System Organization Modified microkernel architecture –Not a pure microkernel –Many system functions outside of the microkernel run in kernel mode Any module can be removed, upgraded, or replaced without rewriting the entire system
46
46 Kernel-Mode Components Executive –Contains base operating system services Memory management Process and thread management Security I/O Interprocess communication Kernel –Consists of the most used components
47
47 Kernel-Mode Components Hardware abstraction layer (HAL) –Isolates the operating system from platform- specific hardware differences Device drivers –Translate user I/O function calls into specific hardware device I/O requests Windowing and graphics systems –Implements the graphical user interface (GUI)
48
48 Windows Executive I/O manager Cache manager Object manager Plug and play manager Power manager Security reference monitor Virtual memory manager Process/thread manager Configuration manager Local procedure call (LPC) facility
49
49 User-Mode Processes Special system support processes –Ex: logon process and the session manager Service processes Environment subsystems User applications
50
50 Client/Server Model Simplifies the Executive –Possible to construct a variety of APIs Improves reliability –Each service runs on a separate process with its own partition of memory –Clients cannot not directly access hardware Provides a uniform means for applications to communicate via LPC Provides base for distributed computing
51
51 Threads and SMP Operating system routines can run on any available processor Different routines can execute simultaneously on different processors Multiple threads of execution within a single process may execute on different processors simultaneously Server processes may use multiple threads Share data and resources between process
52
52 Windows Objects Encapsulation –Object consists of one or more data items and one or more procedures Object class or instance –Create specified instances of an object Inheritance –Support to some extent in the Executive Polymorphism
53
53 UNIX Hardware is surrounded by the operating system software Operating system is called the system kernel Comes with a number of user services and interfaces –Shell –Components of the C compiler
54
54 UNIX
55
System call Is how a program requests a service from an operating system's kernel that it does not normally have permission to run.operating systemkernel Provide the interface between a process and the operating system. Most operations interacting with the system require permissions not available to a user level process requires the use of system calls. –e.g. I/O performed with a device present on the system, –or any form of communication with other processes On Unix, Unix-like and other POSIX-compatible operating systems, popular system callsUnixUnix-likePOSIX –open, read, write, close,wait, execve, fork, exit, and kill.openreadwriteclosewaitexecveforkexitkill Many of today's operating systems have hundreds of system calls. –For example,Linux has over 300 different calls, FreeBSD has over 500 [1], while Plan 9 has 51.LinuxFreeBSD [1]Plan 9 18 September 2008CIS 340 # 55
56
System calls 5 categories Process Control. –load –executeexecute –create processcreate process –terminate processterminate process –get/set process attributesprocess –wait for time, wait event, signal eventwaitsignal –allocate, free memoryallocatefree File management. –create file, delete file –open, close –read, write, reposition –get/set file attributes Device Management. –request device, release device –read, write, reposition –get/set device attributes –logically attach or detach devices Information Maintenance. –get/set time or date –get/set system data –get/set process, file, or device attributes Communication. –create, delete communication connection –send, receive messages –transfer status information –attach or detach remote devices 18 September 2008CIS 340 # 56
57
57 UNIX Kernel
58
58 Modern UNIX Kernel
59
59 Modern UNIX Systems System V Release 4 (SVR4) Solaris 9 4.4BSD Linux
61
18 September 2008CIS 340 # 61 Transactional Properties: ACID Test A A tomicity: atomic If several components must come together for a process, then each atomic process operates correctly or entire combination aborts C C onsistency: false or incorrect data is not introduced A service is correct when executed in its entirety and false or incorrect data is not introduced into the component databases I I solation: – isolated -- If several clients request the same service at the same time and access the same data, the overall result will be as if they were alone – isolated -- in the system D D urability: are complete and durable (have duration?) Completed transactions are complete and durable (have duration?) If necessary, redoing and undoing of changes in case of failures can occur TP-Monitor transactional coordination CLIENT services Application 1Application 3Application 2 user program CLIENT SERVER
62
18 September 2008CIS 340 # 62 Simple Batch Systems “Monitors” Software Controlled sequence of events Program branches back to monitor when finished Job Control Language (JCL) Special type of programming language Provides instruction to the monitor –What compiler to use? –What data to use?
63
18 September 2008CIS 340 # 63 Time Sharing Uses multiprogramming to handle multiple interactive jobs Processor’s time is shared among multiple users Multiple users simultaneously access the system through terminals
64
18 September 2008CIS 340 # 64 EX: Multiprogramming and Multiprocessing
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.