Top Banner

of 32

OS-I

Jun 02, 2018

Download

Documents

Naman Verma
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/10/2019 OS-I

    1/32

  • 8/10/2019 OS-I

    2/32

    A program that acts as an intermediary between a user of a

    computer and the computer hardware.

    uses the computer hardware in an efficient manner.

    Operating system goals:

    Execute user programs and make user problemsolving easier.

    Make the computer system convenient to use.

    12/7/2014OS_CHAP_I_S R Roy 2

  • 8/10/2019 OS-I

    3/32

    Computer system consists of four components Hardware computing resources

    CPU, memory, I/O devices

    Operating system

    Controls and coordinates use of hardwareamong various applications and users

    Application programs define the ways in whichthe system resources are used to solve the

    computing problems of the users Word processors, compilers, web browsers,

    database systems, video games

    Users

    People, machines, other computers12/7/2014OS_CHAP_I_S R Roy 3

  • 8/10/2019 OS-I

    4/32

    12/7/2014OS_CHAP_I_S R Roy 4

  • 8/10/2019 OS-I

    5/32

    OS is a resource allocator Manages all resources Decides between conflicting requests for

    efficient and fair use of resources

    OS is a control program Controls execution of programs to prevent

    errors and improper use of the computer

    The program that runs at all times on thecomputer is the kernel. Everything else iseither a system program or an applicationprogram

    12/7/2014OS_CHAP_I_S R Roy 5

  • 8/10/2019 OS-I

    6/32

    Bootstrap program is loaded during power-up orreboot process

    Typically stored in ROM or EPROM, generallyknown as firmware

    Initializes all aspects of system

    Loads operating system kernel and startsexecution

    12/7/2014OS_CHAP_I_S R Roy 6

  • 8/10/2019 OS-I

    7/32

    Computer-system operation One or more CPUs, device controllers connect through

    common bus providing access to shared memory Concurrent execution of CPUs and devices compete for

    memory cycles

    12/7/2014OS_CHAP_I_S R Roy 7

  • 8/10/2019 OS-I

    8/32

    I/O devices and the CPU can executeconcurrently.

    Each device controller is in charge of aparticular 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 the

    controller. Device controllerinforms CPU that it has

    finished its operation by causing an interrupt.

    12/7/2014OS_CHAP_I_S R Roy 8

  • 8/10/2019 OS-I

    9/32

    An OS necessarily accomplishes the

    following tasks:

    Keeps track of the status of each resource Enforces policies to determine resource

    allocation mechanism

    Allocates resources and

    Reclaim back a resource when a program nolonger needs that resource.

    12/7/2014OS_CHAP_I_S R Roy 9

  • 8/10/2019 OS-I

    10/32

    Depending on the type of resource, the OS

    handles, OS functions are classified as

    Processor Management functions Memory Management functions

    Device Management functions

    Information( File) Management functions

    12/7/2014OS_CHAP_I_S R Roy 10

  • 8/10/2019 OS-I

    11/32

    1 Batch Processing OS:

    necessarily a single user OS

    developed with the objective of increasingoverall efficiency

    reduces resource idle time

    12/7/2014OS_CHAP_I_S R Roy 11

  • 8/10/2019 OS-I

    12/32

    12/7/2014OS_CHAP_I_S R Roy 12

    PROGRAM COMPILATION

    LINKINGEXECUTION

    Compiler & loader require to be loaded

  • 8/10/2019 OS-I

    13/32

    A group (Known as a batch) of all programs

    that require the same compiler and library

    routines is made. This reduces the load time

    for compiler & Linkers.

    A batch of programs can thus execute

    without any human intervention.

    12/7/2014OS_CHAP_I_S R Roy 13

  • 8/10/2019 OS-I

    14/32

    Demerits:

    Long waits in queue

    Debugging and I/O done off-line The speed disparity between the CPU and

    I/O devices not taken care ofCan be achieved using a number of

    techniques.

    12/7/2014OS_CHAP_I_S R Roy 14

  • 8/10/2019 OS-I

    15/32

    BUFFERINGA buffer is a segment of memory that holds data

    temporarily on their way to CPU from I/O devices

    and vice-versa

    12/7/2014OS_CHAP_I_S R Roy 15

    Input Device Input Buffer Processor

    Output BufferOutput Device

  • 8/10/2019 OS-I

    16/32

    How done ?During the execution of one job (Pi) the inputbuffer reads-in input information for the next

    job (Pi+1) in the batch.

    when Pi+1th job is scheduled for execution theCPU reads-in input data from the input buffer.In similar way the outputs are also managed,thereby the speed disparity between the CPU& I/O devices is minimised to some extent.Major problem: Size of buffers

    12/7/2014OS_CHAP_I_S R Roy 16

  • 8/10/2019 OS-I

    17/32

    SPOOLING

    Simultaneous Peripheral Operation On Line

    Spooling uses disks as large buffers for storing Input /Output information temporarily.

    Since disks are used as buffers hence a I / O informationrelated to a larger no. of jobs can be held, that increases

    the efficiency further.

    12/7/2014OS_CHAP_I_S R Roy 17

  • 8/10/2019 OS-I

    18/32

    2 MULTIPROGRAMING OS

    Batch processing, buffering, SPOOLing etc.

    dedicate all systems resources to a singlejob/ process at a time. However a singleprocess can not keep either the CPU or theI/ O devices busy at all times.

    12/7/2014OS_CHAP_I_S R Roy 18

  • 8/10/2019 OS-I

    19/32

    Let there betwo processes P1 and P2 in a sequential order.Assume that P1 & P2 use Processor & I/O for the sameamount of time( t s)

    P1 P2

    P I P I P

    12/7/2014OS_CHAP_I_S R Roy 19

    0t 1t 2t 3t 4t 5t 6t 7t 8t 9t 10t

    P I P I PP I P I P

  • 8/10/2019 OS-I

    20/32

    Let the processes use alternate sequence ofCPU and I/O bursts.

    The processes would thus complete executionin10 t s.

    It is found that CPU would remain idle for 4 s,Whereas I/O for 6 s.

    So, CPU idle time is 40% and that of I/O is60%.

    12/7/2014OS_CHAP_I_S R Roy 20

  • 8/10/2019 OS-I

    21/32

    A single process in general can not keepeither the CPU or the I/O busy all thetime.

    Multiprogramming is an attempt to increasethe CPU utilisation by always havingsomething for the CPU to execute.

    In multiprogramming two or more user jobsare allowed to reside in the memory

    simultaneously (Partitioned on certaintechniques). These jobs are allowed to useresources in turn.

    12/7/2014OS_CHAP_I_S R Roy 21

  • 8/10/2019 OS-I

    22/32

    The processes P1 & P2 when executedconcurrently in the manner given below, the idletimes for CPU & I/O decrease.

    P I P I P

    12/7/2014OS_CHAP_I_S R Roy 22

    0t 1t 2t 3t 4t 5t 6t

    P I P I P

  • 8/10/2019 OS-I

    23/32

    Total execution time = 6 s CPU utilisation time = 6 s I/O utilisation time = 4 s

    CPU idle time = 0I/O idle time = 2 sor 33%

    So, the policy of allowing jobs to use CPU & I/O

    devices alternately decreases idle timesconsiderably.

    12/7/2014OS_CHAP_I_S R Roy 23

  • 8/10/2019 OS-I

    24/32

    The policy of allocating system resourcesto two or more users such that when one isusing the CPU the others are doing I/O andvice-versa is called multiprogramming.

    It is an Event driven system

    Resource utilisation increases with

    increased no. of users.

    12/7/2014OS_CHAP_I_S R Roy 24

  • 8/10/2019 OS-I

    25/32

    The no. of users that compete for systemresources at any given point of time isknown as degree of multiprogramming.

    Operating systems that multiplex systemresources among a no. of users arecommonly known as multiprogramming or

    multitasking or mutiuser systems (thenomenclature depends on the Technologybeing used ).

    12/7/2014OS_CHAP_I_S R Roy 25

  • 8/10/2019 OS-I

    26/32

    In multitasking both the code & the data of severaluser programs are kept in the memory simultaneously.So, Multitasking systems require certain hardwaresupport for protecting the memory.

    Multiprogramming systems are always multitaskingand in addition provide mechanism for concurrencycontrol.

    Mutiuser systems in addition provide security & per-user-accounting

    12/7/2014OS_CHAP_I_S R Roy 26

  • 8/10/2019 OS-I

    27/32

    Multiprogramming systems perform the followingfunctions-

    Memory management, Processor management,

    Device management, File management .

    Implementation of concurrency control,deadlock handling, and protection mechanisms.

    The main disadvantage of multiprogramming OS is

    that it may cause processes to starve for

    resources.

    12/7/2014OS_CHAP_I_S R Roy 27

  • 8/10/2019 OS-I

    28/32

    3Time-sharing OS- A time sharing system implements

    multiplexing by providing each process a shortburst of time (time-slice) for using the CPU.

    In time sharing system all logged-onprocesses are placed in a queue.

    The CPU is allocated to a process in the queueon the basis of some algorithm.

    12/7/2014OS_CHAP_I_S R Roy 28

  • 8/10/2019 OS-I

    29/32

    The system switches from one user to the othervery rapidly and so each user process is given theimpression that each one has control over theprocessor for the entire logged-on period.

    If an I/O operation is to be done by a processbefore the expiry of its time slice, the processor isallocated to the process next in the queue.

    All modern day systems are time-sharing systems.

    12/7/2014OS_CHAP_I_S R Roy 29

  • 8/10/2019 OS-I

    30/32

    In such systems each user hasdedicated terminals, as a result suchsystems are interactive in nature.

    Since time-sharing systems areinteractive they usually have short

    response times.

    12/7/2014OS_CHAP_I_S R Roy 30

  • 8/10/2019 OS-I

    31/32

    4 Real-time OS:Real-time systems eliminate human interventions in

    I/O.

    Real-time systems are used in special purposecomputers e.g. a cardiac monitoring system, avirtual operation theatre etc.

    Real time systems receive inputs through sensors.

    The response time for any real-time system ispredefined.

    12/7/2014OS_CHAP_I_S R Roy 31

  • 8/10/2019 OS-I

    32/32