Subject Name:Operating system Subject Code:10EC35 Prepared By:Remya Ramesan and Kala H.S. Department:ECE Date:24-02-2015
UNIT 1 INTRODUCTION AND OVERVIEW OF OPERATING SYSTEM
Operating system, Goals of an O.S Operation of an O.S Resource allocation and related functions User interface related functions Classes of operating systems O.S and the computer system Batch processing system Multi programming systems Time sharing systems CONTENTS Real time operating systems, distributed operating systems
What is an operating system? An operating system (OS) is a collection of programs that achieve effective utilization of a computer system by providing Convenient methods of using a computer Saves users time and boosts their productivity Efficient use of the computer An OS has several kinds of users The OS meets diverse requirements of different kinds of users Each user has a different view of what an OS is, and what it does. Each of these views is called an abstract view
Abstract views An abstract view focuses on the essential characteristics of a system It contains some selected characteristics, and ignores others It helps to control complexity in designing and understanding a system, by hiding unnecessary detail For example, two abstract views of a car: The driver s view contains the rear-view mirror, steering, gear shift, and speedometer but ignores engine details The mechanic s view contains fluid levels, electrical system, Q: Give examples of abstract views A: View of an abstract data type, object,..
Abstract views Abstract views are used in Software requirements specification Specify what functions a system should perform The abstract view of a specific function helps in understanding the system data and fundamental operations on them Software design and implementation Hiding the details of functions and subsystems while designing or implementing other functions and subsystems helps to control complexity
A designer s abstract view of an OS User interface: Accepts commands from users: GUI, command line interface Non-kernel programs: Implement user commands Kernel: Core of the OS controls the computer, provides functions & services
A designer s abstract view of an OS The abstract view consists of three components The kernel programs interact with the computer s hardware and implement the intended operation The non-kernel programs implement creation of programs and use of system resources by them. These programs use kernel programs to control operation of the computer The user interface interprets the commands of a user and activates non-kernel programs to implement them
Goals of an OS Two primary goals of an OS are Efficient use of the computer s resources To ensure cost-effectiveness of the computer User convenience A user should find it easy to use the computer These two goals sometimes conflict Prompt service can be provided through exclusive use of a computer; however, efficient use requires sharing of a computer s resources among many users An OS designer decides which of the two goals is more important under what conditions That is why we have so many operating systems!
User convenience The computing environment influences the notion of user convenience The computing environment is comprised of The computer system Its interfaces with other systems Nature of computations performed by its users Computing environments change with the architecture and use of a computer, e.g. personal computing, online applications, embedded applications Hence the notion of user convenience has several facets that depend on the computing environment
User convenience User convenience has several facets Fulfillment of a necessity Use of programs and files Good service Speedy response Ease of Use User friendliness New programming model e.g., Concurrent programming Web-oriented features e.g., Web-enabled servers Evolution Addition of new features, use of new computers
Operation of an OS During operation, an OS performs two primary functions Program management Perform program initiation/termination Provide means through which many programs can work toward a common goal Helps in more convenient or faster fulfillment of user requirements Resource management Ensure efficient use of resources Use of CPU, I/O devices
Operation of an OS Program management and resource management require three fundamental tasks Scheduling Deciding which program should be serviced by the CPU and for how long Resource allocation Sharing of resources among user programs Security and protection Ensuring non-interference between programs Security: guarding against interference by external entities Protection: guarding against interference by internal entities
Operation of an OS To facilitate scheduling, resource management, and security and protection OS maintains various kinds of information to facilitate operation Names of registered users identity of a user who is executing a specific program status of a program status of a resource which users can access a resource OS performs several tasks repeatedly to implement scheduling, resource management, and security and protection
Common tasks performed by operating systems
Program management A computational structure is a configuration of several programs. Three typical computational structures are: A single program Execution of a program on a given set of data A sequence of single programs A program should be executed only if previous programs in the sequence executed successfully Programs should pass their results to other programs through files Co-executing programs The OS must execute these programs at the same time The OS must provide an interface between co-executing programs so that their results are available to one another
A schematic of scheduling Programs waiting for CPU attention are entered in a pool The scheduler picks one program from the pool for execution on the CPU The CPU may be forcibly taken away from a program. This action is called pre-emption A pre-empted program is again entered into the pool
Resource management Criteria and techniques of resource management Criterion: Resource utilization efficiency Share the resources wherever possible Avoid idling of resources Speedy resource allocation and de-allocation is desirable Technique 1: Partitioning of resources A resource partition is a collection of resources A resource partition is allocated to a process Simplifies resources allocation and also speeds it up Technique 2: Allocation from a pool Resources are allocated individually when needed Q: Pros & cons of the two techniques?
Virtual resources A virtual resource is an illusion presented to a program A virtual resource is an abstraction; its implementation is hidden from a program Use of virtual resources simplifies resource allocation Virtual resources may be created if several programs need a resource. It permits more programs to execute at the same time A virtual I/O device is a virtual resource The OS implements a virtual device as follows: When a program performs an operation on a virtual device, the operation may be actually performed on some real resource Example: virtual printer When a program prints on a virtual printer, the data is actually stored in memory; printing takes place sometime later
Security and Protection An OS must ensure non-interference with users programs and data Aspects of non-interference Resources must not be used by un-authorized persons There should be no interference with use of resources by authorized persons and their programs Terminology An intruder is a person or program that causes interference Security measures avoid interference by non-users and their programs Protection measures avoid interference by users and their programs
Security and protection techniques Two key techniques of security and protection Authentication Verification of a user s identity Performed when a person logs in (typically through passwords) Authorization: has two aspects The owner of a resource selectively permits other users to access them When a user/program tries to access a resource, the OS verifies whether the user has the permission to perform the access
Overview of security and protection threats Authentication checks whether a person is a registered user Threats posed by non-users are security threats Threats posed by a user are protection threats
OS and the Computer System In this module, we study - Fundamental features of computer systems that are important to an OS * Memory hierarchy * Interrupt structure * I/O organization - Fundamentals of how a program interacts with an OS
Memory utilization during operation of an OS
Model of a Computer System
Fields of Program Status Word (PSW)
(a) Program (b) State of CPU after executing COMPARE instruction
Memory hierarchy containing cache, main memory and disk
Memory hierarchy Cache memory * Organization Cache block or cache line -- Inclusive or exclusive -- Direct, fully associative, set associative * Different levels of caches Why? How many levels? * Cache hit ratio What factors influence it? Main memory * Memory protection * Virtual memory?
Memory protection using bound registers
A schematic of virtual memory operation
Input/Output organization Involvement of the CPU in I/O operations -- Should be the minimum possible due to imbalance between CPU and I/O speeds -- CPU should be free to execute instructions while I/O operations are in progress Different I/O modes -- Programmed I/O -- Interrupt I/O -- Direct memory access (DMA)
Input Output Modes
Interrupts An interrupt signals the occurrence of an event to the CPU The CPU is diverted to execution of an OS routine Different classes of interrupts convey occurrence of different kinds of events
Classes of Interrupts
The interrupt action
Steps in interrupt action
An operating system in its computing environment
Interrupt driven operation of a kernel
System Call A system call is a request made by a program through a special instruction called a `software interrupt instruction The software interrupt is a program interrupt When a software interrupt occurs, the interrupt hardware transfers control to a routine of the OS The operand of the software interrupt instruction indicates what kind of request is being made by a program
System Calls
Interrupt processing and scheduling
Simple and nested interrupt processing
Classes of Operating Systems
Efficiency, System Performance, and User Service Two of the fundamental goals of an OS: Efficiency of use Of a resource User convenience Measurable aspect: User service Turnaround time Response time To a system administrator, performance of a system in its environment is more important Typically measured as throughput
Efficiency, System Performance, and User Service (continued)
Batch Processing Systems Batch: sequence of user jobs formed for processing by the OS Batching kernel initiates processing of jobs without requiring computer operator s intervention Card readers and printers were a performance bottleneck in the 1960s Virtual card readers and printers implemented through magnetic tapes were used to solve this problem Control statements used to protect against interference between jobs Command interpreter read a card when currently executing program in job wanted the next card
Multiprogramming Systems Provide efficient resource utilization in a noninteractive environment Uses DMA mode of I/O Can perform I/O operations of some program(s) while using the CPU to execute some other program Makes efficient use of both the CPU and I/O devices Turnaround time of a program is the appropriate measure of user service in these systems
Multiprogramming Systems (continued)
Multiprogramming Systems (continued)
Multiprogramming Systems (continued) An appropriate measure of performance of a multiprogramming OS is throughput Ratio of the number of programs processed and the total time taken to process them OS keeps enough programs in memory at all times, so that CPU and I/O devices are not idle Degree of multiprogramming: number of programs Uses an appropriate program mix of CPU-bound programs and I/O-bound programs Assigns appropriate priorities to CPU-bound and I/Obound programs
Priority of Programs
Priority of Programs (continued) In multiprogramming environments, an I/O-bound program should have a higher priority than a CPU-bound program.
Performance of Multiprogramming systems How to improve performance?
Performance of Multiprogramming systems (continued) When an appropriate program mix is maintained, an increase in the degree of multiprogramming would result in an increase in throughput.
Time-Sharing Systems Provide a quick response to user subrequests Round-robin scheduling with time-slicing Kernel maintains a scheduling queue If time slice (δ) elapses before process completes servicing of a subrequest, kernel preempts it, moves it to end of queue, and schedules another process Implemented through a timer interrupt
Time-Sharing Systems (continued)
Time-Sharing Systems (continued) Response time (rt): measure of user service If processing of a subrequest requires δ CPU seconds rt = n (δ + σ) η = δ / (δ + σ) where η: CPU efficiency, σ: scheduling overhead, n: number of users using system, δ: time required to complete a subrequest Actual response time would be different because Some users may be inactive Some programs may require > δ CPU seconds
Time-Sharing Systems (continued)
Swapping of Programs Kernel performs swap-out and swap-in operations
Real-Time Operating Systems In real-time applications, users need computer to perform some actions in a timely manner To control activities in an external system, or to participate in them Timeliness depends on time constraints If application takes too long to respond to an activity, a failure can occur in the external system Response requirement Deadline: time by which action should be performed
Hard and Soft Real-Time Systems A hard real-time system meets response requirements under all conditions It is typically dedicated to processing real-time applications A soft real-time system makes best effort to meet response requirement of a real-time application Cannot guarantee that it will be able to meet it Meets requirements in a probabilistic manner E.g., multimedia applications
Features of a Real-Time Operating System
Distributed Operating Systems A distributed computer system consists of several individual computer systems connected through a network Each computer system could be a PC, a multiprocessor system, or a cluster Many resources of a kind exist in system This feature is used to provide the benefits summarized in Table 3.8 Handling network or individual computers failure requires special techniques Users must use special techniques to access resources over the network
Distributed Operating Systems (continued)
Special Techniques of Distributed Operating Systems
Modern Operating Systems
Summary A computing environment consists of a computer system, its interfaces with other systems, and the services provided by its OS to users and programs Evolved with advances in computer technology: Batch processing systems Multiprogramming operating system Priority-based scheduling Time-sharing operating systems Round-robin scheduling with time-slicing
Summary (continued) Evolution (continued) Real-time operating systems Priority-based scheduling and deadline-aware scheduling Distributed operating system Lets programs share resources across network Modern operating system Modern computing environment has elements of all the classic computing environments Uses different techniques for different applications