os chapter i

Upload: jeffrey-abadesa-esmundo

Post on 04-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 OS Chapter I

    1/23

    Chapter 1 Introduction to OS

    What is an Operating System?

    Operating System is a Resource Manager. Handles multiple computer resources: CPU,

    Internal/External memory, Processes, Tasks,Applications, Users, etc

    Manages and allocates resources to multipleusers or multiple jobs running at the same time(e.g., processor time, memory space, I/Odevices)

    Arranges to use the computer hardware in anefficient manner (maximize throughput,minimize response time) and in a fair manner.

    It is a Control Program. Manages all the components of a complex

    computer system in an integrated manner. Controls the execution of user programs and

    I/O devices to prevent errors and improper useof the computer resources.

    Looks over and protects the computer.

    It is an extended/virtual machine

    An interface between the user and hardwarethat hides the details of the hardware (e.g., I/O).

    Constructs higher-level (virtual) resources outof lower-level (physical) resources (e.g., files).

    Definition: Is a collection of softwareenhancements, executed on the barehardware, culminating in a high-level virtual

    machine that serves as an advancedprogramming environment

    Prepared by Dr. Amjad Mahmood 1.1

  • 7/29/2019 OS Chapter I

    2/23

    Why Operating System?

    Computer hardware is developed to execute userprograms and make solving user problems easier.

    An operating system makes a computer moreconvenient to use.

    It acts as an interface between user andcomputer hardware. Therefore, the end-usersare not particularly concerned with thecomputers architecture, and they view thecomputer system in terms of an application.

    To programmers, it provides some basic utilitiesto assist him in creating programs, themanagement of files, and the control of I/Odevices.

    Prepared by Dr. Amjad Mahmood 1.2

  • 7/29/2019 OS Chapter I

    3/23

    Operating System Objectives

    Convenience

    Makes the computer more convenient to use Efficiency

    Allows computer system resources to be usedin an efficient manner

    Ability to evolve

    Permit effective development, testing, andintroduction of new system functions without

    interfering with service

    Services Provided by Operating Systems

    Facilities for program creation Editors, compilers, linkers, debuggers, etc.

    Program execution

    Loading in memory, I/O and file initialization.

    Access to I/O and files Deals with the specifics of I/O and file formats.

    System access

    Resolves conflicts for resource contention.

    Protection in access to resources and data. Error detection and response

    internal and external hardware errors

    memory error

    device failure

    software errors

    arithmetic overflow access forbidden memory locations

    Prepared by Dr. Amjad Mahmood 1.3

  • 7/29/2019 OS Chapter I

    4/23

    operating system cannot grant request ofapplication

    Accounting collect statistics

    monitor performance

    used to anticipate future enhancements

    used for billing users

    Computer System Components

    A computer system can be divided in to fourcomponents.

    The Hardware : Provides basic computingresources (CPU, memory, I/O devices).

    The Operating System : Controls andcoordinates the use of the hardware among thevarious application programs for the varioususers.

    The Application Programs : Define the ways inwhich the system resources are used to solvethe computing problems of the users(compilers, database systems, video games,

    business programs).

    The Users : Users (people, machines, othercomputers).

    Prepared by Dr. Amjad Mahmood 1.4

  • 7/29/2019 OS Chapter I

    5/23

    These components can be viewed as layers, whereeach layer uses the services provided by the layerbeneath it.

    A Static View of System Components

    Dynamic View of System Components

    Prepared by Dr. Amjad Mahmood 1.5

  • 7/29/2019 OS Chapter I

    6/23

    Another view of computer system components

    History of Operating Systems

    Lets see how operating systems evolve over time. This will help us to identify some common features

    of operating systems and how and why thesesystems have been developed as they are.

    Evolution of Operating Systems

    Early Systems (1950) Simple Batch Systems (1960)

    Multiprogrammed Batch Systems (1970)

    Time-Sharing and Real-Time Systems (1970)

    Personal/Desktop Systems (1980)

    Multiprocessor Systems (1980)

    Networked/Distributed Systems (1980)

    Handheld Systems (1990)

    Prepared by Dr. Amjad Mahmood

    End

    User

    Programmer

    Operating-

    System

    Designer

    Computer Hardware

    Operating-System

    Utilities

    Application

    Programs

    1.6

  • 7/29/2019 OS Chapter I

    7/23

    Early Systems

    Structure Single user system. Large machines run from

    console. Programmer/User as operator.

    Paper Tape or Punched cards.

    No tapes/disks in computer.

    Early software: Assemblers, Libraries of commonsubroutines, Device Drivers, Compilers, Linkers.

    Significant amount of setup time.

    Low CPU utilization.

    But very secure.

    Simple Batch Systems

    Mainframe machines. Input devices were cardreaders. Output devices were line printer, tapedrives, and card punch.

    A job (a single program+ associated data + controlinformation) usually on the punch cards submitted to

    the operator. The output consisted of the results of the program

    or memory dump in case of error. The operator used to batch together similar

    programs and run as a group to reduce setup time. No user interaction while the job is executing.

    Current examples include .bat files under Dos

    Windows and shell files under Unix/Linux.

    Prepared by Dr. Amjad Mahmood 1.7

  • 7/29/2019 OS Chapter I

    8/23

    Example of card deck of a job

    The operating systems (called resident monitor)manages the execution of each program in thebatch.

    Monitor utilities are loaded when needed.

    Resident monitor is always in main memoryand available for execution.

    Prepared by Dr. Amjad Mahmood 1.8

  • 7/29/2019 OS Chapter I

    9/23

    The resident monitor usually has the followingpart.

    Control card interpreter responsible for

    reading and carrying out instructions on thecards.

    Loader loads systems programs andapplications programs into memory.

    Device drivers know specialcharacteristics and properties for each ofthe systems I/O devices.

    Prepared by Dr. Amjad Mahmood 1.9

  • 7/29/2019 OS Chapter I

    10/23

    In batch systems: Initial control is in monitor. Load next program and transfer control to it.

    When a job completes, the control transfersback to monitor.

    Automatically transfer control from one job toanother (Automatic job sequencing).

    Problems

    Slow Performance I/O and CPU could not overlap;card reader very slow.

    CPU was often idle.

    Solutions

    1. Off-line Operation

    Speed up computation by loading jobs intomemory from tapes while card reading and lineprinting is done off-line using smaller machines.

    2. Use spooling (Simultaneous Peripheral OperationOn Line).

    Cards are read directly from the card reader

    onto a disk and location of card images arekept in a table by the operating system.

    Prepared by Dr. Amjad Mahmood 1.10

  • 7/29/2019 OS Chapter I

    11/23

    The output is sent to the disk and when the jobis completed then the output was actuallyprinted.

    I/O and computations were overlapped. Whileexecuting one job, the OS:

    Reads next job from card reader into astorage area on the disk (job queue).

    Outputs printout of previous job fromdisk to printer.

    Uniprogramming Until Now

    I/O operations are exceedingly slow (compared toinstruction execution).

    A program containing even a very small number ofI/O operations will spend most of its time waiting for

    them. Hence: poor CPU usage when only one program is

    present in memory.

    Prepared by Dr. Amjad Mahmood 1.11

  • 7/29/2019 OS Chapter I

    12/23

    Memory Layout of Uniprogramming

    Memory layout of a simple batch processing system

    Multiprogrammed Batch Systems

    Several jobs are kept in main memory at the sametime, and the CPU is multiplexed among them.

    If memory can hold several programs, then CPUcan switch to another one whenever a program iswaiting for an I/O to complete This ismultiprogramming.

    Prepared by Dr. Amjad Mahmood 1.12

  • 7/29/2019 OS Chapter I

    13/23

    OS Features Needed for Multiprogramming

    I/O routine supplied by the system.

    Memory management the system must allocatethe memory to several jobs.

    CPU scheduling the system must choose amongseveral jobs ready to run.

    Allocation of devices.

    Time Sharing Systems (Interactive Systems)

    TSS extends Batch multiprogramming to handlemultiple interactive jobs Its InteractiveMultiprogramming.

    Multiple users simultaneously access the systemthrough terminals. Processors time is shared among multiple users,

    that is, the CPU is multiplexed among several jobsthat are kept in memory and on disk (the CPU isallocated to a job only if the job is in memory).

    On-line communication between the user and the

    system is provided; when the operating system

    Prepared by Dr. Amjad Mahmood 1.13

  • 7/29/2019 OS Chapter I

    14/23

    finishes the execution of one command, it seeks thenext control statement from the users keyboard.

    TS system provides each user with her/her own

    virtual machine.

    Multitasking

    TS eventually supports multitasking.

    A time share system that supports multipleprocesses (program in execution) per user is calleda multitasking system.

    Why Does Time Sharing Work?

    Because of slow human reaction time, a typical userneeds 2 seconds of processing time per minute.

    Then many users should be able to share the samesystem without noticeable delay in the computerreaction time.

    Prepared by Dr. Amjad Mahmood 1.14

  • 7/29/2019 OS Chapter I

    15/23

    Batch MultiprogrammingVs. Time Sharing

    Batch Multi-Prog. Time SharingPrinciple obj. Max. Processor use Min. response time

    Source of inst.To OS

    JCL provided withthe job

    Commands enteredat the terminal

    OS Features Needed for Time Sharing Systems

    On-line file system must be available for users to

    access data and code. Should do memory management

    Should do CPU scheduling Should do job synchronization and have

    communication facilities.

    Should ensure that dead lock and indefinite waitingdoes not occur.

    Should allow sharing of computer resources.

    Personal Computer Systems

    Personal computers computer system dedicatedto a single user.

    Have a wide variety of I/O devices keyboards,

    mice, display screens, small printers. User convenience and responsiveness are of prime

    importance. Can adopt technology developed for larger

    operating system. Often individuals have sole use of computer and do

    not need advanced CPU utilization of protection

    features.

    Prepared by Dr. Amjad Mahmood 1.15

  • 7/29/2019 OS Chapter I

    16/23

    May run several different types of operating systems(Windows, MacOS, UNIX, Linux)

    Two Categories of Computer Systems

    Single Instruction Single Data (SISD) Single processor executes a single instruction

    sequence to operate on data stored in a singlememory.

    This is a Uniprocessor.

    Multiple Instruction Multiple Data (MIMD) A set of processors simultaneously execute

    different instruction sequences on different datasets.

    This is a Multiprocessor.

    Multiprocessor Systems

    Multiprocessor systems have more than one CPU inclose communication.

    Tightly coupled system processors sharememory and a clock; communication usuallytakes place through the shared memory.

    Advantages of parallel system: Increased throughput

    Economical Increased reliability

    Graceful degradation

    Prepared by Dr. Amjad Mahmood 1.16

  • 7/29/2019 OS Chapter I

    17/23

    Multiprocessor architecture

    Symmetric Multiprocessing (SMP)

    Each processor runs an identical copy of theoperating system.

    Each processor can perform the same functions andshare same main memory and I/O facilities(symmetric).

    The OS schedules processes/threads across all theprocessors (real parallelism).

    Existence of multiple processors is transparent tothe user.

    Incremental growth: just add another CPU!

    Robustness: a single CPU failure does not halt thesystem, only the performance is reduced.

    Many processes can run at once withoutperformance deterioration.

    Most modern operating systems support SMP

    Asymmetric multiprocessing

    Each processor is assigned a specific task; masterprocessor schedules and allocated work to slaveprocessors.

    More common in extremely large systems

    Prepared by Dr. Amjad Mahmood 1.17

  • 7/29/2019 OS Chapter I

    18/23

    Distributed Systems

    Distribute the computation among several physically

    separated processors. Loosely coupled system each processor has

    its own local memory; processors communicatewith one another through variouscommunications lines, such as high-speedbuses or telephone lines.

    Advantages of distributed systems.

    Resources Sharing

    Computation speed up load sharing

    Reliability and fault tolerance

    Communications

    Requires networking infrastructure - Local areanetworks (LAN) or Wide area networks (WAN)

    May be either client-server or peer-to-peer systems.

    Prepared by Dr. Amjad Mahmood 1.18

  • 7/29/2019 OS Chapter I

    19/23

    General structure of client-server

    Peer-to-peer systems

    Network Operating System

    Provides file sharing Provides communication scheme

    Runs independently from other computers on thenetwork

    Distributed Operating System

    Less autonomy between computers

    Prepared by Dr. Amjad Mahmood 1.19

  • 7/29/2019 OS Chapter I

    20/23

    Gives the impression there is a single operatingsystem controlling the network.

    Clustered Systems

    Clustering allows two or more systems to shareexternal storage and balance CPU load.

    Asymmetric clustering: one server runs theapplication while other servers standby.

    Symmetric clustering: all N hosts are running the

    application.

    Real-Time Systems

    Note that not all Operating Systems are general-purpose systems.

    Real-Time (RT) systems are dedicated systems thatneed to adhere to deadlines, i.e., time constraints.

    Correctness of the computation depends not only onthe logical result but also on the time at which theresults are produced.

    Prepared by Dr. Amjad Mahmood 1.20

  • 7/29/2019 OS Chapter I

    21/23

    Often used as a control device in a dedicatedapplication such as controlling scientificexperiments, medical imaging systems, industrial

    control systems, and some display systems. Real-Time systems may be eitherhardorsoftreal-

    time.

    Prepared by Dr. Amjad Mahmood 1.21

  • 7/29/2019 OS Chapter I

    22/23

    Hard Real-Time System

    Must meet its deadline.

    Conflicts with time-sharing systems, not supportedby general-purpose operating systems. Often used as a control device in a dedicated

    application such as industrial control and robotics

    Secondary storage limited or absent, data stored inshort term memory, or read-only memory (ROM).

    Soft Real-Time System A critical real-time task gets priority over the other

    tasks (Deadline desirable but not mandatory).

    Limited utility in industrial control of robotics

    Useful in applications (multimedia, virtual reality)requiring advanced operating-system features.

    Hand Held Systems

    Personal Digital Assistants (PDAs)

    Cellular telephones

    Issues:

    Limited memory

    Slow processors

    Small display screens.

    Prepared by Dr. Amjad Mahmood 1.22

  • 7/29/2019 OS Chapter I

    23/23

    Migration of Operating-System Concepts andFeatures