Operating System Overview Chapter 2 1 Operating System

  • Slides: 69
Download presentation
Operating System Overview Chapter 2 1

Operating System Overview Chapter 2 1

Operating System A program that controls the execution of application programs n An interface

Operating System A program that controls the execution of application programs n An interface between applications and hardware n 2

Operating System Objectives n Convenience ¨ Makes the computer more convenient to use. n

Operating System Objectives n Convenience ¨ Makes the computer more convenient to use. n n n Windows is an OS but X-windows is an app Efficiency ¨ Allows computer system resources to be used in an efficient manner. (EG. Early graphic/printer designs bypassed DOS) Ability to evolve ¨ Permit effective development, testing, and introduction of new system functions without interfering with service. (EG install new device drivers without re-compiling OS, Install new apps without re-boot, Uninstall. ) 3

Layers of Computer System Is this a CS viewpoint? Is there a different IT

Layers of Computer System Is this a CS viewpoint? Is there a different IT viewpoint? 4

Services Provided by the Operating System n Program development ¨ Editors, compilers and debuggers

Services Provided by the Operating System n Program development ¨ Editors, compilers and debuggers etc. Program execution (load, initialize resources, schedule) n Access to I/O devices (Uniform programmers’ (and users) n interface E. G UNIX files) Controlled access to files n System access (also controlled in several ways) n 5

Services Provided by the Operating System n Error detection and response ¨ Internal and

Services Provided by the Operating System n Error detection and response ¨ Internal and external hardware errors Memory error n Device failure n ¨ Software errors Arithmetic overflow n Access forbidden memory locations n ¨ Operating system cannot grant request of application 6

Services Provided by the Operating System n Accounting ¨ Collect usage statistics ¨ Monitor

Services Provided by the Operating System n Accounting ¨ Collect usage statistics ¨ Monitor performance ¨ Used to anticipate future enhancements ¨ Used for billing purposes (a mainframe concept) 7

Operating System n n Responsible for managing resources Functions same way as ordinary computer

Operating System n n Responsible for managing resources Functions same way as ordinary computer software ¨ It n is a program that is executed Operating system relinquishes control of the processor n n Relinquishes control to perform “useful” work and must be given control again to supervise system. (Analogy: management vs. engineering) Can you run a computer without an OS? Discuss 8

9

9

Kernel Portion of operating system that is in main memory n Contains most frequently

Kernel Portion of operating system that is in main memory n Contains most frequently used functions n Also called the nucleus n 10

Evolution of an Operating System n n n Hardware upgrades plus new types of

Evolution of an Operating System n n n Hardware upgrades plus new types of hardware New services Fixes ¨ Design should be modular. Can fixes be installed while system is running? (esp. servers) n For History see “Hackers”, Steven Levy and “Accidental Empires”, Bob Cringely 11

Evolution of Operating Systems n Serial Processing ¨ No operating system ¨ Machines run

Evolution of Operating Systems n Serial Processing ¨ No operating system ¨ Machines run from a console with display lights, toggle switches, input device, and printer ¨ Schedule time ¨ Setup included loading the compiler, source program, saving compiled program, and loading and linking 12

Evolution of Operating Systems n Simple Batch Systems ¨ Monitors n Software that controls

Evolution of Operating Systems n Simple Batch Systems ¨ Monitors n Software that controls the sequence of events n Batch jobs together n Program branches back to monitor when finished n Resident monitor is in main memory and available for execution ¨ MS-DOS system is a descendant of this type of 13

Job Control Language (JCL) n Special type of programming language ¨ Modern variant is

Job Control Language (JCL) n Special type of programming language ¨ Modern variant is scripts (Perl/Python/Ruby etc. ) n Provides instruction to the monitor ¨ What compiler to use ¨ What data to use 14

Hardware Features n Memory protection ¨ Do not allow the memory area containing the

Hardware Features n Memory protection ¨ Do not allow the memory area containing the ‘monitor’ to be altered n Timer (Interrupt) ¨ Prevents a job from monopolizing the system 15

Hardware Features n Privileged instructions ¨ Certain machine level instructions can only be executed

Hardware Features n Privileged instructions ¨ Certain machine level instructions can only be executed by the monitor ¨ Early computer models did not have this capability (error in text p 60? ) n Interrupts ¨ Allows ways to regain control from user programs 16

Memory Protection n User program executes in user mode ¨ Certain n instructions may

Memory Protection n User program executes in user mode ¨ Certain n instructions may not be executed Monitor executes in system mode ¨ Kernel mode ¨ Privileged instructions are executed ¨ Protected areas of memory may be accessed 17

I/O Devices Slow 18

I/O Devices Slow 18

Uniprogramming n Processor must wait for I/O instruction to complete before preceding 19

Uniprogramming n Processor must wait for I/O instruction to complete before preceding 19

Multiprogramming n When one job needs to wait for I/O, the processor can switch

Multiprogramming n When one job needs to wait for I/O, the processor can switch to the other job 20

Multiprogramming 21

Multiprogramming 21

Utilization Histograms 22

Utilization Histograms 22

Example 23

Example 23

Time Sharing Using multiprogramming to handle multiple interactive jobs n Processor’s time is shared

Time Sharing Using multiprogramming to handle multiple interactive jobs n Processor’s time is shared among multiple users n Multiple users simultaneously access the system through terminals n n What is the difference between batch and time-sharing multiprogramming? 24

Batch Multiprogramming versus Time Sharing Batch Multiprogramming Time Sharing Principal objective Maximize processor use

Batch Multiprogramming versus Time Sharing Batch Multiprogramming Time Sharing Principal objective Maximize processor use Minimize response time Source of directives to operating system Job control language commands provided with the job Commands entered at the terminal 25

Compatible Time-Sharing System (CTSS) n First time-sharing system developed at MIT 26

Compatible Time-Sharing System (CTSS) n First time-sharing system developed at MIT 26

Major Theoretical Achievements Processes n Memory Management n Information protection and security n Scheduling

Major Theoretical Achievements Processes n Memory Management n Information protection and security n Scheduling and resource management n System structure n 27

Processes A program in execution n An instance of a program running on a

Processes A program in execution n An instance of a program running on a computer n The entity that can be assigned to and executed on a processor n A unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources n 28

Difficulties with Designing System Software n Improper synchronization ¨ Ensure a process waiting for

Difficulties with Designing System Software n Improper synchronization ¨ Ensure a process waiting for an I/O device receives the signal Failed mutual exclusion (ticket sales for cultural event) n Nondeterminate program operation n ¨ Program should only depend on input to it, not on the activities of other programs n Deadlocks (Multiple resources) 29

Process n Consists of three components ¨ An executable program ¨ Associated data needed

Process n Consists of three components ¨ An executable program ¨ Associated data needed by the program ¨ Execution context of the program n All information the operating system needs to manage the process 30

Process 31

Process 31

Memory Management Process isolation n Automatic allocation and management n Support of modular programming

Memory Management Process isolation n Automatic allocation and management n Support of modular programming n Protection and access control n Long-term storage n 32

Virtual Memory Allows programmers to address memory from a logical point of view n

Virtual Memory Allows programmers to address memory from a logical point of view n No hiatus between the execution of successive processes while one process was written out to secondary store and the successor process was read in n 33

Virtual Memory and File System Implements long-term store n Information stored in named objects

Virtual Memory and File System Implements long-term store n Information stored in named objects called files n 34

Paging Allows process to be comprised of a number of fixed-size blocks, called pages

Paging Allows process to be comprised of a number of fixed-size blocks, called pages n Virtual address is a page number and an offset within the page n Each page may be located any where in main memory n Real address or physical address in main memory n 35

Virtual Memory 36

Virtual Memory 36

Virtual Memory Addressing 37

Virtual Memory Addressing 37

Information Protection and Security n Availability ¨ Concerned with protecting the system against interruption

Information Protection and Security n Availability ¨ Concerned with protecting the system against interruption n Confidentiality ¨ Assuring that users cannot read data for which access is unauthorized 38

Information Protection and Security n Data integrity ¨ Protection of data from unauthorized modification

Information Protection and Security n Data integrity ¨ Protection of data from unauthorized modification n Authenticity ¨ Concerned with the proper verification of the identity of users and the validity of messages or data 39

IAS Availability n Confidentiality n Data Integrity n Authenticity n 40

IAS Availability n Confidentiality n Data Integrity n Authenticity n 40

Scheduling and Resource Management n Fairness ¨ Give n equal and fair access to

Scheduling and Resource Management n Fairness ¨ Give n equal and fair access to resources Differential responsiveness ¨ Discriminate among different classes of jobs n Efficiency ¨ Maximize throughput, minimize response time, and accommodate as many uses as possible 41

Key Elements of Operating System 42

Key Elements of Operating System 42

System Structure View the system as a series of levels n Each level performs

System Structure View the system as a series of levels n Each level performs a related subset of functions n Each level relies on the next lower level to perform more primitive functions n This decomposes a problem into a number of more manageable subproblems n 43

Process Hardware Levels (table 2. 4) n Level 1 ¨ Electronic circuits ¨ Objects

Process Hardware Levels (table 2. 4) n Level 1 ¨ Electronic circuits ¨ Objects are registers, memory cells, and logic gates ¨ Operations are clearing a register or reading a memory location n Level 2 ¨ Processor’s instruction set ¨ Operations such as add, subtract, load, and store 44

Process Hardware Levels n Level 3 ¨ Adds the concept of a procedure or

Process Hardware Levels n Level 3 ¨ Adds the concept of a procedure or subroutine, plus call/return operations n Level 4 ¨ Interrupts 45

Concepts with Multiprogramming n Level 5 ¨ Process as a program in execution ¨

Concepts with Multiprogramming n Level 5 ¨ Process as a program in execution ¨ Suspend and resume processes n Level 6 ¨ Secondary storage devices ¨ Transfer of blocks of data n Level 7 ¨ Creates logical address space for processes ¨ Organizes virtual address space into blocks 46

Deal with External Objects n Level 8 ¨ Communication of information and messages between

Deal with External Objects n Level 8 ¨ Communication of information and messages between processes n Level 9 ¨ Supports n long-term storage of named files Level 10 ¨ Provides access to external devices using standardized interfaces 47

Deal with External Objects n Level 11 ¨ Responsible for maintaining the association between

Deal with External Objects n Level 11 ¨ Responsible for maintaining the association between the external and internal identifiers n Level 12 ¨ Provides full-featured facility for the support of processes n Level 13 ¨ Provides an interface to the operating system for the user 48

Modern Operating Systems n Microkernel architecture ¨ Assigns only a few essential functions to

Modern Operating Systems n Microkernel architecture ¨ Assigns only a few essential functions to the kernel Address spaces n Interprocess communication (IPC) n Basic scheduling n 49

Modern Operating Systems n Multithreading ¨ Process is divided into threads that can run

Modern Operating Systems n Multithreading ¨ Process is divided into threads that can run concurrently n Thread Dispatchable unit of work ¨ executes sequentially and is interruptable ¨ n Process is a collection of one or more threads 50

Modern Operating Systems n Symmetric multiprocessing (SMP) ¨ There are multiple processors ¨ These

Modern Operating Systems n Symmetric multiprocessing (SMP) ¨ There are multiple processors ¨ These processors share same main memory and I/O facilities ¨ All processors can perform the same functions 51

Multiprogramming and Multiprocessing 52

Multiprogramming and Multiprocessing 52

Modern Operating Systems n Distributed operating systems ¨ Provides the illusion of a single

Modern Operating Systems n Distributed operating systems ¨ Provides the illusion of a single main memory space and single secondary memory space 53

Modern Operating Systems n Object-oriented design ¨ Used for adding modular extensions to a

Modern Operating Systems n Object-oriented design ¨ Used for adding modular extensions to a small kernel ¨ Enables programmers to customize an operating system without disrupting system integrity 54

Windows Architecture Modular structure for flexibility n Executes on a variety of hardware platforms

Windows Architecture Modular structure for flexibility n Executes on a variety of hardware platforms n Supports application written for other operating system n 55

56

56

Operating System Organization n Modified microkernel architecture ¨ Not a pure microkernel ¨ Many

Operating System Organization n Modified microkernel architecture ¨ Not a pure microkernel ¨ Many system functions outside of the microkernel run in kernel mode n Any module can be removed, upgraded, or replaced without rewriting the entire system 57

Kernel-Mode Components n Executive ¨ Contains base operating system services Memory management n Process

Kernel-Mode Components n Executive ¨ Contains base operating system services Memory management n Process and thread management n Security n I/O n Interprocess communication n n Kernel ¨ Consists of the most used components 58

Kernel-Mode Components n Hardware abstraction layer (HAL) ¨ Isolates the operating system from platformspecific

Kernel-Mode Components n Hardware abstraction layer (HAL) ¨ Isolates the operating system from platformspecific hardware differences n Device drivers ¨ Translate user I/O function calls into specific hardware device I/O requests n Windowing and graphics systems ¨ Implements the graphical user interface (GUI) 59

Windows Executive n n n n n I/O manager Cache manager Object manager Plug

Windows Executive n n n n n 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 60

User-Mode Processes n Special system support processes ¨ Ex: logon process and the session

User-Mode Processes n Special system support processes ¨ Ex: logon process and the session manager Service processes n Environment subsystems n User applications n 61

Client/Server Model n Simplifies the Executive ¨ Possible n to construct a variety of

Client/Server Model n Simplifies the Executive ¨ Possible n to construct a variety of APIs Improves reliability ¨ Each service runs on a separate process with its own partition of memory ¨ Clients cannot directly access hardware Provides a uniform means for applications to communicate via LPC n Provides base for distributed computing n 62

Threads and SMP n n n Operating system routines can run on any available

Threads and SMP n n n 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 63

Windows Objects n Encapsulation ¨ Object consists of one or more data items and

Windows Objects n Encapsulation ¨ Object consists of one or more data items and one or more procedures n Object class or instance ¨ Create n specified instances of an object Inheritance ¨ Support n to some extent in the Executive Polymorphism 64

UNIX Hardware is surrounded by the operating system software n Operating system is called

UNIX Hardware is surrounded by the operating system software n Operating system is called the system kernel n Comes with a number of user services and interfaces n ¨ Shell ¨ Components of the C compiler 65

UNIX 66

UNIX 66

UNIX Kernel 67

UNIX Kernel 67

Modern UNIX Kernel 68

Modern UNIX Kernel 68

Modern UNIX Systems System V Release 4 (SVR 4) n Solaris 9 n 4.

Modern UNIX Systems System V Release 4 (SVR 4) n Solaris 9 n 4. 4 BSD n Linux n 69