opearting system

Upload: lovishsindhwani

Post on 06-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Opearting System

    1/25

    A COMPUTER SYSTEM

    A computer system consists of

    Hardware

    System programs

    Application programs

    Page 1

  • 8/2/2019 Opearting System

    2/25

    INTRODUCTION TO OPERATING SYSTEM

    Some Common Definitions

    An Operating System (OS) is a program that acts as an intermediary

    between a user of a computer and the computer hardware. The purpose of an

    OS is to provide an environment in which a user can execute programs.

    An OS is similar to a government. The component of a computer system are

    its hardware, software and data. The OS provides the means for the proper

    use of these resources in the operation of the computer system. It simply

    provides an environment within which other programs can do useful work.

    A OS is a control program. A control program controls the execution of user

    programs to relevant errors and improper use of the computer.

    The OS is the one program running at all times on the computer (usually

    called theKernel), with all else being application programs.

    An OS is an integrated set of programs that controls the resources (the CPU,

    memory, I/O devices etc.) of a computer system and provides its user with

    an interface or that is more convenient to use than the bare machine.

    Operating systems are programs (fairly complex ones) that act as interface

    between the user and the computer hardware. They sit between the user and

    the hardware of the computer providing an operational environment to the

    Page 2

  • 8/2/2019 Opearting System

    3/25

    users and application programs. For a user, therefore, a computer is nothing

    but the operating system running on it. It is extended machine

    THE TWO PRIMARY OBJECTIVES/ GOALS OF AN OS

    A Computer System Convenient to use

    Managing resources of a Computer System

    A Computer System Convenient to use

    The primary goal of an OS is convenience for the user to operate. Operating

    systems exist because they are supposed to make it easier to compute with

    them than without them. The OS acts as an intermediary between the

    hardware and its users, providing a high level interface to low-level

    hardware resources and making it easier for the programmer and for

    application programs to access and use.

    Managing resources of a Computer System

    The secondary goal of an OS is to manage the various resources of the

    computer system. Without an operating system, the hardware of a computer

    is just an inactive electronic machine, possessing great computational power,

    but doing nothing for the user. Users do not interact with the hardware of a

    computer directly but through the services offered by operating system. This

    is because the language that users employ is different from that of the

    hardware. The operating system speaks users language one hand and

    machine language on the other. It takes instructions in form of commands

    from the user and translates into machine understandable instructions, gets

    these instructions executed by the CPU and translates the result back into

    user-understandable form.

    Page 3

  • 8/2/2019 Opearting System

    4/25

    MAIN FUNCTIONS OF AN OPERATING SYSTEM

    Process Management

    Memory Management

    File Management

    Device Management

    Security

    Command Interpretation

    Process Management: A process (also called job) is a program in

    execution. During execution, a process needs certain resources such as CPU

    Time, memory space, files and I/O devices etc. The process management

    module of an OS takes care of the creation and deletion of the processes,

    scheduling of various system resources to the different processes requesting

    them.

    Memory Management: The memory management module of an OS

    taes care of the allocation and deallocation of the memory space to variousprograms in need of this resource.

    File Management: All computer systems are used for storage,

    retrieval and sharing of information. A computer normally stores such

    Page 4

  • 8/2/2019 Opearting System

    5/25

    information in units called files. This module takes care of file related

    activities such as organization, storing, retrieval, naming, sharing and

    protection of files.

    Device Management: A computer system normally consists of several

    I/O devices. The device management module of an OS takes care of

    controlling all computers I/O devices.

    Security: The security module of an OS is protected resources and

    information of the computer system against destruction and unauthorized

    access.

    Command Interpretation: A user communicates with the OS, for using

    the various system resources via set of commands provided by the OS. The

    Command Interpretation module of an OS takes care of interpreting use

    commands, supplied individually or in the form of command language and

    directing the system resources to handle the request.

    Page 5

  • 8/2/2019 Opearting System

    6/25

    MEASURING SYSTEM PERFORMANCE

    The efficiency of an OS and the overall performance of a computer system is

    usually measured in terms of the following :

    Throughput

    Turnaround Time

    Response Time

    Throughput: Throughput is an amount of work that the system is able

    to do per unit time. It is measured as the number of processes that arecompleted by the system per unit Time.

    For Example : Ifn processes are completed in an interval of tseconds,

    the throughput is taken as n/tprocesses per second during interval.

    Throughput is normally measured inprocesses/hours.

    The value of the Throughput is not depend only on the capability of a

    system but also on the nature of jobs being processed by the system.

    Turnaround Time: turnaround time is the interval from the time

    submission of a job to the system for processing to the time of completion of

    the job.

    Although higher throughput is desirable from the point of view of the

    overall system performance, individual users are more interested in better

    turnaround time for their jobs.

    Response Time: Response Time is the interval from the time of

    submission of a job to the system for processing to the time the first

    response for job is produced by the system. (e.g. Internet).

    Page 6

  • 8/2/2019 Opearting System

    7/25

    OPERATING SYSTEM SERVICES

    An operating system provides an environment for the execution of programs.

    The operating system provides certain services to programs and to the users

    of those programs.

    These operating system services are provided for the convenience of the

    programmer, to make the programming task easier. Some of these services

    are listed below:

    Program Execution Services

    I/O Operation Services

    File System Services

    Communication Services

    Error Detection Services

    Accounting Services

    Protection Services

    Program Execution Services: The system must be able to load a program

    into memory and to run it. The program must be able to end its execution,

    wither normally or abnormally (indication error).

    I/O Operation Services: A running program may require I/O. This

    I/O may involve a file or an I/O device. So the OS must provide some I/O

    services.

    File System Services: The file need to be read, write, create and delete by

    name. therefore, the OS use the file service.

    Page 7

  • 8/2/2019 Opearting System

    8/25

    Communication Services: There are two ways in which

    communication can occur :

    1. Between processes executing on the same computer system.

    2. Between processes executing on different computer system that

    are tied together by a computer network.

    Error Detection Services: Errors may occur in the CPU and memory,

    hardware, in I/O devices, a connection failure of network, in the user

    program etc. For each type of error, the OS should tae the appropriate action

    to ensure correct and consistent computing.

    Accounting Services: Keep track of which users use how much and what

    kinds of computer resources. This record keeping may be for accounting or

    simply for accumulating usage statistics.

    Protection Services: Protection involves ensuring that all access to the

    resources is controlled. Security starts with each user having to authenticate

    himself/herself to the system, usually by means of password to be allowed

    access to the resources.

    Page 8

  • 8/2/2019 Opearting System

    9/25

    HISTORY OF OPERATING SYSTEMS

    First Generation 1945-1955

    Vacuum Tubes, Plug Boards

    Second Generation 1955-1965

    Transistors, Batch Systems

    Third Generation 1965-1980

    ICs, Multiprogramming

    Fourth Generation 1980- Present

    Personal Computers

    Page 9

  • 8/2/2019 Opearting System

    10/25

    CLASSIFICATION OF OPERATING SYSTEM

    Single User Single Processing System

    The simplest of all the computer systems is a single use-single

    processor system. It has a single processor, runs a single program and

    interacts with a single user at a time. The operating system for this system is

    very simple to design and implement. However, the CPU is not utilized to its

    full potential, because it sits idle for most of the time.

    SINGLE USER SINGLE PROCESSOR SYSTEM

    In this configuration, all the computing resources are available to the

    user all the time. Therefore, operating system has very simple responsibility.

    A representative example of this category of operating system is MS-DOS.

    Page 10

    Operating SystemOperating System

    HardwareHardware

    Application

    Program

    Application

    Program UserUser

  • 8/2/2019 Opearting System

    11/25

    Batch Processing Systems

    The main function of a batch processing system is to automatically

    keep executing one job to the next job. The main idea behind a batch

    processing system is to reduce the interference of the operator during the

    processing or execution of jobs by the computer. All functions of a batch

    processing system are carried out by the batch monitor. The batch monitor

    permanently resides in the low end of the main store. a batch monitor is

    responsible for controlling all the environment of the system operation. The

    batch monitor accepts batch initiation commands from the operator,

    processes a job, performs the job of job termination and batch termination.

    In a batch processing system, we generally make use of the term

    Turnaround Time.

    In Batch Processing Systems, jobs were typically executed in the

    following manner:

    Programmers would prepare their programs and data on card decks or

    paper tapes and submitted them at the reception counter of the

    computer centre.

    The operator could periodically collect all the submitted programs and

    would batch them together and then load them all into the input device

    of the system at one time.

    The operator would then give a command to the system to start

    executing the jobs.

    The jobs were then automatically loaded from the input device and

    executed by system one by one without any operator intervention.

    Page 11

  • 8/2/2019 Opearting System

    12/25

    System would read the first job from the input device, execute it, print

    out its result on printer and so on till all the jobs were over.

    When all the jobs in the submitted batch were processed, the operator

    would separate the printed output for each job and keep them at the

    reception counter.

    The Structure of a Sample Dec of Cards submitted for Processing in aBatch Processing System

    Page 12

  • 8/2/2019 Opearting System

    13/25

    Advantages:

    To speed up Processing, jobs with similar needs were batched

    together and run together.

    Reducing the idle time of a computer system to a great extent.

    Automatically keep executing one job to the next job.

    Disadvantage:

    From executing one job to another did not require any operator

    intervention.

    The CPU is often idle. Because the difference in speed between CPU

    and I/O devices.

    Page 13

  • 8/2/2019 Opearting System

    14/25

    MULTIPROGRAMMING

    The objective of a multiprogramming operating system is to increase the

    system utilization efficiency. The batch processing system tries to reduce the

    CPU idle time through operator interaction. However, it cannot reduce the

    idle time due to IO operations.

    The multiprogramming operating system tries to eliminate such idle times

    by providing multiple computational tasks for the CPU to perform. This is

    achieved by keeping multiple jobs in the main store. So, when the job that is

    being currently executed on the CPU needs some IO, the CPU passes its

    requirement over to the IO processor. Till the time the IO operation is beingcarried out, the CPU is free to carry out some other job. The presence of

    independent jobs guarantees that the CPU and IO activities are totally

    independent of each other. The area occupied by each job residing

    simultaneously in the main memory is known as Memory Partition.

    Some of the most popular multiprogramming operating systems are:

    UNIX, Windows NT etc.

    Advantages:

    Job Scheduling is the ability to multiprogramming.

    Multiprogramming increase CPU utilization that the CPU always has

    one job to execute.

    Page 14

    Memory Layout for a Multiprogramming System

  • 8/2/2019 Opearting System

    15/25

    A typical scenario of jobs in a multiprogramming system is shown with

    the help of Diagram

    At a particular time instance :

    Job A is not utilizing the CPU since it is busy writing output data on

    the disk.

    CPU utilized to execute job B, which is also present in the main

    memory.

    Job C also residing in the main memory, is waiting for the CPU

    become to free.

    Page 15

    Execution

    in

    Progress

    CPU

    Operating System

    Job A

    Job B

    Job C

    Job C

    (Waiting for CPU)

    Writing Output Data

    Secondary Disk Storage

    Main Memory

    Three Jobs in a Multiprogramming System

  • 8/2/2019 Opearting System

    16/25

    Three States of jobs residing in the main memory in case of

    Multiprogramming

    1. Running 2. Blocked 3. Ready

    1. Running:It is using by the CPU.

    2. Blocked: It is performing I/O Operations.

    3. Ready: It is waiting for CPU to be assigned to it.

    Although many jobs may be in ready and blocked states, only one job

    can be running at any instant.

    Page 16

    I/O

    Completed

    New Job

    Job Processing

    completed

    Job must wait for

    I/O completion

    Job is allocated CPU for

    execution

    Ready Running

    Blocked

    The three different states in which jobs may be after getting loaded in the main

    memory in a Multiprogramming System.

  • 8/2/2019 Opearting System

    17/25

    REQUIREMENTS OF MULTIPROGRAMMING SYSTEMS

    Large Memory: Large main memory is required to accommodate a good

    number of user programs along with the operating system.

    Memory Protection: Multiprogramming must provide some type of

    memory protection mechanism to prevent a job in one memory partition

    from chaining information or instruction of a job in another memory

    partition.

    Job Status Preservation: For this OS maintains a Process Control

    Block(PCB) for each loaded process. With this arrangement, before taking

    away the CPU from a running process, its status is preserved in its PCB and

    before the process resumes execution when the CPU is given back to it at a

    later time, its status is restored back from its PCB. Thus the process can

    continue execution without any problem.

    Proper Job Mix: For Effectively use the operations of the CPU a proper

    job mix of I/O Bounds (input amount of data, perform very little

    computation) and CPU Bounds (perform numerical calculations, with little

    I/O operation) is required.

    CPU Scheduling: When more than one process is in the ready state when

    the CPU become free, the OS must decide which of the ready jobs should be

    allocated the CPU for execution. The part of the OS concerned with this

    decision is called the CPU Scheduler, and the algorithm it uses is called the

    CPU Scheduling algorithm.

    Page 17

  • 8/2/2019 Opearting System

    18/25

    MULTITASKING

    Multitasking is a logical extension of multiprogramming. Multitasking is the

    systems capability to concurrently work on more than one task.

    Basically, there is no difference between Multitasking and

    Multiprogramming. But Many Authors prefer to use the term,

    Multiprogramming for multi-user systems (Client/Server environment) and

    Multitasking for Single user System (Systems that are used by only one

    user such as PC).

    Multiprogramming is the concurrent execution of multiple jobs (of same or

    different users) in a multi-user system.

    Multitasking is the concurrent execution of multiple jobs (often referred to

    as tasks of same user) in a Single User System.

    Page 18

  • 8/2/2019 Opearting System

    19/25

    TIME SHARING SYSTEM

    Time sharing is a logical extension of multiprogramming.

    Multiple jobs are executed by the CPU switching between them, but the

    switches occur so frequently that the users may interact with each

    program while it is running.

    Time-sharing systems were developed to provide interactive use of a

    computer system at a reasonable cost. A time-shared operating system uses

    CPU scheduling and multiprogramming to provide each user with a small

    portion of a time-shared computer.

    A time-shared operating system allows the many users to share the

    computer simultaneously. Since each action or command in a time-shared

    system tends to be short, only a little CPU time is needed for each user. As

    the system switches rapidly from one user to the next, each user is given the

    impression that she has her own computer, whereas actually one computer is

    being shared among many users.

    Time-sharing operating systems are even more complex than are

    multi-programmed operating systems. As in multiprogramming, several jobs

    must be kept simultaneously in memory, which requires some form of

    memory management and protection. So that a reasonable response time can

    be obtained, jobs may have to be swapped in and out of main memory.

    The special CPU scheduling algorithm used in Time Sharing System

    allocates a very short period of CPU Time one-by-one to each user process,

    beginning from the first user process and proceeding through the last one

    and then again beginning from the first one.

    Page 19

  • 8/2/2019 Opearting System

    20/25

    The short period of time during which a user process gets the

    attention of the CPU is known as Time Slice, Time Slot or Quantum and

    is typically of the order of 10 to 100 milliseconds.

    The Process State diagram of time sharing system is as :

    Advantages:

    Reduce CPU idle time.

    Provides advantages of quick Response Time.

    Offers good computing to Small Users.

    Requirements of Time Sharing System

    Large Memory to support Multiprogramming

    Memory Protection Mechanism

    Job Status Preservation Mechanism

    Special CPU Scheduling Algorithm

    Alarm clock mechanism to send an interrupt signal to the CPU after

    every time slice.

    Page 20

    I/O

    Completed

    New Job

    Job Processing

    completed

    Job must wait for

    I/O completion

    Job is allocated CPU for

    execution

    Ready Running

    Blocked

    The Process State Diagram For a Time Sharing System

    Allotted Time Slice

    is Over

  • 8/2/2019 Opearting System

    21/25

    PARALLEL SYSTEM

    Most systems to date are single-processor systems i.e. they have only one

    main CPU. Parallel system have more than one processor in close

    communication, sharing the computer bus, the clock, and sometimes

    memory and peripheral devices. These systems are also referred to as

    Tightly Coupled Systems.

    Increased Throughput: One advantage is increased throughput. By

    increasing the number of processors, we hope to get more work done in a

    shorter period of time. The speed-up ratio with n processors is not n,

    however, but rather is less than n.

    Save Money: Multiprocessors can also save money compared to multiple

    single systems because the processors can share peripherals, cabinets, and

    power supplies. If several programs are to operate on the same set of data, it

    is cheaper to store those data on one disk and to have all the processors share

    them, rather than to have many computers with local disks and many copies

    of the data.

    Increase Reliability: Another reason for multiprocessor systems is that they

    increase reliability. If functions can be distributed properly among several

    processors, then the failure of one processor will not halt the system, but

    rather will only slow it down. If we have 10 processors and one fails, then

    each of the remaining nine processors must pick up a share of the work of

    the failed processor. Thus, the entire system runs only 10 percent slower,

    rather than failing altogether. Continued operation in the presence of failures

    requires a mechanism to allow the failure to be detected, diagnosed, and

    corrected

    Page 21

  • 8/2/2019 Opearting System

    22/25

    Two Models of Parallel/ Multiprocessing System

    Symmetric Model: In which each processor runs an identical copy of

    the operating system, and these copies communicate with one another as

    needed. Example : Unix for Multimax Computer.

    Asymmetric Model: In which each processor is assigned a specific task.

    A master processor controls the system. The other processors wither look to

    the master for instruction or have predefined tasks. This scheme defines

    Master-Slave relationship. The master processor schedules and allocates

    work to the slave processors. Example: Sun's operating system SunOS

    Version 4.

    Disadvantages:

    Require very Sophisticated OS to Schedule, balance and coordinate

    the input, output and processing activities of multiple processors.

    More expensive to procure and maintain.

    Page 22

  • 8/2/2019 Opearting System

    23/25

    DISTRIBUTED SYSTEMS

    The processors communicate with one another through various

    communication lines, such as high-speed buses or telephone lines. These

    systems are usually referred to as loosely coupled systems, or distributed

    systems.

    The processors in a distributed system may vary in size and function. They

    may include small microprocessors, workstations, minicomputers, and large

    general-purpose computer systems. These processors are referred to by a

    number of different names, such as sites, nodes, computers, and so on,

    depending on the context in which they are mentioned.

    Major reasons for building distributed systems

    Resource Sharing: If a number of different sites (with different

    capabilities) are connected to one another, then a user at one site may be able

    to use the resources available at another.

    For example, a user at site A may be using a laser printer available only at

    site B. Meanwhile, a user at B may access a file that resides at A.

    In general, resource sharing in a distributed system provides mechanisms for

    sharing files at remote sites, processing information in a distributed

    database, printing files at remote sites, using remote specialized hardware

    devices (such as a high-speed array processor), and performing otheroperations.

    Computation Speedup: If a particular computation can be

    partitioned into a number of sub computations that can run concurrently,

    then a distributed system may allow us to distribute the computation among

    Page 23

  • 8/2/2019 Opearting System

    24/25

    the various sites to run that computation concurrently. In addition, if a

    particular site is currently overloaded with jobs, some of them may be

    moved to other, lightly loaded, sites. This movement of jobs is called Load

    Sharing.

    Reliability: If one site fails in a distributed system, the remaining

    sites can potentially continue operating. If the system is composed of a

    number of large autonomous installations (that is, general-purpose

    computers), the failure of one of them should not affect the rest.

    If, on the other hand, the system is composed of a number of small

    machines, each of which is responsible for some crucial system function

    (such as terminal character I/O or the file system), then a single failure may

    effectively halt the operation of the whole system.

    Communication: There are many instances in which programs need to

    exchange data with one another on one system. Window systems are one

    example, since they frequently share data or transfer data between displays.

    When many sites are connected to one another by a communication network,

    the processes at different sites have the opportunity to exchange information.

    Users may initiate file transfers or communicate with one another via

    Electronic Mail. A user can send mail to another user at the same site or at a

    different site.

    Page 24

  • 8/2/2019 Opearting System

    25/25

    REAL TIME SYSTEM

    A special-purpose operating system is the real-time system. A real-

    time system is used when there are rigid time requirements on the operation

    of a processor or the flow of data, and used as a control device in a dedicated

    application.

    A real-time operating system has well-defined, fixed time constraints.

    Processing must be done within the defined constraints, or the system will

    fail. A real-time system is considered to function correctly only if it returns

    the correct result within any time constraints

    Two types of Real Time Systems are:

    A hard real-timeSystem guarantees that critical tasks complete on

    time. This goal requires that all delays in the system be bounded, from the

    retrieval of stored data to the time that it takes the operating system to finish

    any request made of it. Such time constraints dictate the facilities that are

    available in hard real-time systems.

    A less restrictive type of real-time system is a Soft Real Time

    System, where a critical real-time task gets priority over other tasks, and

    retains that priority until it completes.

    P