OS-03

download OS-03

of 50

Transcript of OS-03

  • 8/7/2019 OS-03

    1/50

    1

    Operating System Structures

    System Components

    Operating System Services

    System Calls

    System Programs

    System Structures

    Virtual Machines

    System Design and Implementation

    System Generation

    Sreedhar Potla

  • 8/7/2019 OS-03

    2/50

    2

    System Components

    Process Management

    MainMemory Management

    File Management

    I/O System Management

    Secondary Storage / Disk Management

    Networking

    Protection System

    Command Interpreter System

    Sreedhar Potla

  • 8/7/2019 OS-03

    3/50

    3

    System Components

    ProcessProgram in execution.

    Active entity.

    Unit work in a system.

    Ex: Time-shared user program

    Word-processing program

    System task

    Sending output to printer.

    Needs certain resources.CPU time

    Memory

    Files

    I/O devices

    Types

    System processes (execute system code).

    User processes (execute user code).

    Program CounterSpecifies the next instruction to execute.

    Sreedhar Potla

  • 8/7/2019 OS-03

    4/50

    4

    System Components

    Process Management

    Activitiesy Create and delete both user and system processes.

    y Suspend and resume processes.

    y Provide mechanisms for process synchronisation.

    y Provide mechanisms for process communication.

    y Provide mechanisms for deadlock handling.

    Sreedhar Potla

  • 8/7/2019 OS-03

    5/50

    5

    System Components

    MainMemory Management

    Activitiesy Keep track of which parts of memory are currently being used and

    by whom.

    y Decide which processes are to be loaded into memory when memory

    space becomes available.

    y Allocate and deallocate memory space as needed.

    Sreedhar Potla

  • 8/7/2019 OS-03

    6/50

    System Components

    File

    Collection of related information.

    Represents programs and data.

    Consists of sequence of bits, bytes, lines or records.

    Organised into directories to ease their use.

    Types

    Free-form (Text files)

    Fixed-form

    Data files

    Numeric

    Alphabetic

    Alphanumeric

    Sreedhar Potla

  • 8/7/2019 OS-03

    7/50

    7

    System Components

    File ManagementOne of the most visible components of operating system.

    Activitiesy Create and delete files.

    y Create and delete directories.

    y Support primitives for manipulating files and directories.

    y Map files onto secondary storage.

    y Back up files on stable (nonvolatile) storage media.

    Sreedhar Potla

  • 8/7/2019 OS-03

    8/50

    8

    System Components

    I/O System Managementy

    Memory management components.Buffering

    Caching

    spooling

    y General device driver interface.

    y Drivers for specific hardware devices.

    Sreedhar Potla

  • 8/7/2019 OS-03

    9/50

    9

    System Components

    Secondary Storage / Disk Management

    Activitiesy Free space management

    y Storage allocation

    y Disk scheduling

    Sreedhar Potla

  • 8/7/2019 OS-03

    10/50

    10

    System Components

    Networking

    Distributed System

    Collection of processors

    do not share

    MemoryPeripheral devices

    Clock.

    Collects physically separate heterogeneous systems into single

    coherent system.

    Provides the user with access to various resources system maintains.

    Sreedhar Potla

  • 8/7/2019 OS-03

    11/50

    11

    System Components

    Protection System

    Mechanism for controlling access of programs, processes or users tothe resources.

    Improve reliability.

    Command Interpreter SystemInterface between user and OS.

    Sreedhar Potla

  • 8/7/2019 OS-03

    12/50

    12

    Operating System ServicesOS provides no. of services.

    Lowest level System calls

    Allow running program to make requests from the OS directly.Higher level Command interpreter or Shell

    User issues request without writing program.

    Categories

    Program Control

    Status requestsI/O requests

    Program execution

    I/O operations

    File system manipulation

    CommunicationsError detection

    Resource allocation

    Accounting

    Protection

    Sreedhar Potla

  • 8/7/2019 OS-03

    13/50

    13

    Operating System Services

    Program execution

    System must be able toload program into memory.

    run that program.

    Programs must be able to end its execution, either normally or

    abnormally (indicating error).

    Sreedhar Potla

  • 8/7/2019 OS-03

    14/50

    14

    Operating System Services

    I/O operations

    OS must provide means to do I/O.

    Sreedhar Potla

  • 8/7/2019 OS-03

    15/50

    15

    Operating System Services

    File system manipulation

    Programs need to read and write files.

    Programs also need to create and delete files by name.

    Sreedhar Potla

  • 8/7/2019 OS-03

    16/50

    16

    Operating System Services

    Communications

    One process needs to exchange information with another process.

    Implemented via shared memory or message passing technique.

    Message passingPackets of information moved between processes by OS.

    Sreedhar Potla

  • 8/7/2019 OS-03

    17/50

    17

    Operating System Services

    Error detection

    Resource allocation

    AccountingRecord keeping may be used.

    ProtectionEnsures that all access to system resources is controlled.

    Sreedhar Potla

  • 8/7/2019 OS-03

    18/50

    18

    System Calls

    Provide interface between process and OS.

    Major categories

    Process control

    File management

    Device management

    Information maintenance

    Communications

    Sreedhar Potla

  • 8/7/2019 OS-03

    19/50

    19

    System Calls

    Process controly

    End, abort

    y Load, execute

    y Create process, terminate process

    y Get process attributes, set process attributes

    y Wait for time

    y Wait event, signal event

    y Allocate and free memory

    Sreedhar Potla

  • 8/7/2019 OS-03

    20/50

    20

    System Calls

    File managementy Create file, delete file

    y Open, close

    y Read, write, reposition

    y Get file attributes, set file attributes

    Sreedhar Potla

  • 8/7/2019 OS-03

    21/50

    21

    System Calls

    Device managementy Request device, release device

    y Read, write, reposition

    y Get device attributes, set device attributes

    y Logically attach or detach devices

    Sreedhar Potla

  • 8/7/2019 OS-03

    22/50

    22

    System Calls

    Information maintenancey Get time or date, set time or date

    y Get system data, set system data

    y Get process, file, or device attributes

    y Set process, file, or device attributes

    Sreedhar Potla

  • 8/7/2019 OS-03

    23/50

    23

    System Calls

    Communicationsy Create, delete communication connection

    y Send, receive messages

    y Transfer status information

    y Attach or detach remote devices

    Sreedhar Potla

  • 8/7/2019 OS-03

    24/50

    24

    System Programs

    Provide convenient environment for program development and execution.

    Categories

    File management

    Status information

    File modification

    Programming language support

    Program loading and executionCommunications

    Sreedhar Potla

  • 8/7/2019 OS-03

    25/50

    25

    System Programs

    File managementCreate

    Delete

    Copy

    Rename

    Print

    Dump

    ListManipulate files and directories.

    Sreedhar Potla

  • 8/7/2019 OS-03

    26/50

    26

    System Programs

    Status informationDate

    Time

    Amount of available memory / disk space

    No. of users

    Sreedhar Potla

  • 8/7/2019 OS-03

    27/50

    27

    System Programs

    File modification

    Text editors

    To create and modify the content of files stored on disk or tape.

    Sreedhar Potla

  • 8/7/2019 OS-03

    28/50

    28

    System Programs

    Programming language supportCompilers

    Assemblers

    Interpreters

    Sreedhar Potla

  • 8/7/2019 OS-03

    29/50

    29

    System Programs

    Program loading and executionAbsolute loaders

    Relocatable loaders

    Linkage editors

    Overlay loaders

    Debugging systems

    Sreedhar Potla

  • 8/7/2019 OS-03

    30/50

    30

    System Programs

    CommunicationsProvide mechanism for creating virtual connections among

    processes, users and different computer systems.

    Allow users to

    Send messages to one anothers screens.

    Browse web pages.

    Send electronic mail messages.Log in remotely.

    Transfer files from one machine to another.

    Sreedhar Potla

  • 8/7/2019 OS-03

    31/50

    31

    System Structures

    Partition the task into small components.

    Types

    Simple Structure

    Layered Approach

    Microkernels

    Sreedhar Potla

  • 8/7/2019 OS-03

    32/50

    32

    System Structures

    MS-DOS Layer Structure

    Sreedhar Potla

  • 8/7/2019 OS-03

    33/50

    33

    System Structures

    UNIX System Structure

    Sreedhar Potla

  • 8/7/2019 OS-03

    34/50

    34

    System Structures

    Layered ApproachOperating system broken up into no. of layers (levels).

    Each built on lower layers.

    Bottom layer (layer 0) Hardware

    Highest layer (layer N) User interface

    Main advantageModularity

    Simplified design and implementation of the system.

    Each layer is implemented only by the lower layer operations.

    Sreedhar Potla

  • 8/7/2019 OS-03

    35/50

    35

    System Structures

    Layered Approach

    Operating System LayerSreedhar Potla

  • 8/7/2019 OS-03

    36/50

    36

    System Structures

    Microkernel approachStructures OS by removing all nonessential components from the

    kernel.

    Implements nonessential components as system-level and user-level

    programs.

    Typically provides minimal process and memory management.

    Main function

    Provides communication facility (message passing) betweenthe client program and the various services running in user

    space.

    Benefits

    Ease of extending OS.

    Provides more security and reliability.

    Examples

    Tru64 UNIX

    QNX (RTOS)

    Sreedhar Potla

  • 8/7/2019 OS-03

    37/50

    37

    Virtual Machines

    Provides interface.

    Each process is provided with (virtual) copy of the underlying computer.

    Major difficulty

    Cannot allocate disk drive to each virtual machine.

    Provides virtual disks (minidisks).

    Sreedhar Potla

  • 8/7/2019 OS-03

    38/50

    38

    Virtual Machines

    Sreedhar Potla

  • 8/7/2019 OS-03

    39/50

    39

    Virtual Machines

    ImplementationDifficult to implement.

    Modes

    Virtual user mode.

    Virtual monitor mode.

    Sreedhar Potla

  • 8/7/2019 OS-03

    40/50

    40

    Virtual Machines

    BenefitsProvides robust level of security.

    Allows system development.

    Each virtual machine is completely isolated from all other virtual

    machines.

    Sreedhar Potla

  • 8/7/2019 OS-03

    41/50

    41

    Virtual Machines

    JavaVery popular object oriented language.

    Introduced by Sun Microsystems in late 1995.

    Provides specification for Java Virtual Machine (JVM).

    Sreedhar Potla

  • 8/7/2019 OS-03

    42/50

    42

    Virtual Machines

    Java Virtual Machine (JVM)

    Automatically manages memory by performing garbage collection.

    Its design provides

    Secure

    Efficient

    Object oriented

    PortableArchitecture-neutral platform.

    Sreedhar Potla

  • 8/7/2019 OS-03

    43/50

    43

    Virtual Machines

    Java Virtual Machine (JVM)

    Sreedhar Potla

  • 8/7/2019 OS-03

    44/50

    44

    Virtual Machines

    Java Virtual Machine (JVM)Consists of

    Class loader

    Class verifier

    Java interpreter

    Class loader

    Loads .class files.

    Class verifier

    Checks

    the class file is valid Java bytecode.

    Does not overflow or underflow the stack.

    Also ensures that the bytecode does not perform pointer arithmetic.

    Sreedhar Potla

  • 8/7/2019 OS-03

    45/50

    45

    Virtual Machines

    Java Virtual Machine (JVM)

    Java interpreter

    Interprets bytecodes one at a time.

    Just-in-time (JIT) compiler.

    Just-in-time (JIT) compilerTurns the architecture neutral bytecodes into native machine

    language for the host computer

    Sreedhar Potla

  • 8/7/2019 OS-03

    46/50

    46

    System Design and Implementation

    Design Goals

    Mechanisms and Policies

    Implementation

    Sreedhar Potla

    S D i d I l i

  • 8/7/2019 OS-03

    47/50

    47

    System Design and Implementation

    Design Goals

    Define the goals and specifications of the system.

    User goalsSystem should be

    convenient and easy to use

    easy to learn

    reliable

    safe

    fast.System goals

    OS should be

    Easy to design

    Implement

    MaintainFlexible

    Reliable

    Error free

    Efficient.

    Sreedhar Potla

    S D i d I l i

  • 8/7/2019 OS-03

    48/50

    48

    System Design and Implementation

    Mechanisms and Policies

    Mechanisms

    Determine how to do something.

    Ex: Timer construct (Mechanism for ensuring CPU protection)

    PoliciesDetermine what will be done.

    Ex: How long the time is to be set for a particular user?

    Sreedhar Potla

    S D i d I l i

  • 8/7/2019 OS-03

    49/50

    49

    System Design and Implementation

    ImplementationMaster Control Program (MCP)

    Burroughs Computers.

    Written in variant of ALGOL.

    MULTiplex Information and Computing Service (MULTICS)

    Developed at MIT.

    Written in PL/1.

    Primos

    Prime computers.

    Written in dialect of FORTRAN.

    UNIX, OS/2, Windows NT

    Mainly written in C.

    Sreedhar Potla

    S G i (S SG )

  • 8/7/2019 OS-03

    50/50

    50

    System Generation (SYSGEN)

    obtains information concerning the specific configuration of thehardware system.

    Sreedhar Potla