CHAP-1 PART-2

Embed Size (px)

Citation preview

  • 8/3/2019 CHAP-1 PART-2

    1/34

    Operating-System Structures

    System ComponentsOperating System

    Services

    System Calls

    System Programs

    Virtual Machines

  • 8/3/2019 CHAP-1 PART-2

    2/34

    Common System Components

    y Process Management

    y Main Memory Management

    y Secondary-Storage Management

    y I/O System Managementy File Management

    y Protection System

    y Networking

    y Command-Interpreter System

  • 8/3/2019 CHAP-1 PART-2

    3/34

    Process Management

    y A process is a program in execution. It is a unit of workwithin the system. Program is a passive entity, process is anactive entity.

    y Process needs resources to accomplish its task such as CPU,memory, I/O, files etc.

    y These recourses are given to process either when it is

    created or allocated when it is running.

    y The CPU executes instructions of a program one afteranother, until the process completed.

  • 8/3/2019 CHAP-1 PART-2

    4/34

    Process Management(count.)

    y The operating system is responsible for the

    following activities in connection with process

    management.

    yCreating and deleting both user and system

    processes

    yprocess suspension and resumption.

    yProvision of mechanisms for:yprocess synchronization

    yprocess communication

    ydeadlock handling

  • 8/3/2019 CHAP-1 PART-2

    5/34

  • 8/3/2019 CHAP-1 PART-2

    6/34

    Secondary-Storage Managementy

    Since main memory (primary storage

    ) is volatile and too smallto accommodate all data and programs permanently, thecomputer system must provide secondary storage to back upmain memory.

    y Most modern computer systems use disks as the principle

    on-line storage medium, for both programs and data.y The operating system is responsible for the following

    activities in connection with disk management:

    y Free space management

    y

    Storage allocationy Disk scheduling

  • 8/3/2019 CHAP-1 PART-2

    7/34

    I/O System Managementy A

    computer has many devices that facilitate user interactionwith computer.

    y Different devices has different working method. For thisderivers of specific device are loaded into computer. When

    needed these drivers are loaded in to main memory.

    y The operating system is responsible for the followingactivities in connection with I/O System Management:

    y A general device-driver interface

    y Drivers for specific hardware devices

  • 8/3/2019 CHAP-1 PART-2

    8/34

  • 8/3/2019 CHAP-1 PART-2

    9/34

  • 8/3/2019 CHAP-1 PART-2

    10/34

  • 8/3/2019 CHAP-1 PART-2

    11/34

    Command-Interpreter Systemy One of the most important system program for an OS is the

    command interpreter. It is the interface between user and

    OS.

    y Many commands are given to OS by Control statements.

    When a new job OS started in Batch system or a user log on

    in a time sharing system, a program executes automatically.

    This program reads and interprets control statements. This

    program is called Control Card Interpreter or Command

    Line interpreter.

  • 8/3/2019 CHAP-1 PART-2

    12/34

  • 8/3/2019 CHAP-1 PART-2

    13/34

  • 8/3/2019 CHAP-1 PART-2

    14/34

  • 8/3/2019 CHAP-1 PART-2

    15/34

    Additional Operating System Functions

    A

    dditional functions exist not for helping the user, but ratherfor ensuring efficient system operations.

    Resource allocation allocating resources to multiple users ormultiple jobs running at the same time.

    Accounting keep track of and record which users use howmuch and what kinds of computer resources. It helps in making

    future decisions for resource allocation

    Protection ensuring that all access to system resources iscontrolled.

  • 8/3/2019 CHAP-1 PART-2

    16/34

    System Calls

    y System calls provide the interface between a running

    program and the operating system.

    y Generally available as assembly-language instructions.

    y Several languages (such as C,C++) can be used to

    write system calls.

    y To understand System call, let a program reads a data

    from a file and copy it to another file. The first input

    that the program will need is the name of two files.

    Once the names are specified , the program must open

    both files and then copy the required data. All these are

    done with the help of System Calls.

    y System call can be divided into 5 categories-------

  • 8/3/2019 CHAP-1 PART-2

    17/34

  • 8/3/2019 CHAP-1 PART-2

    18/34

  • 8/3/2019 CHAP-1 PART-2

    19/34

    Process control

    y A running program must stop either normally (end) or

    abnormally(Abort). On abnormal stop OS must

    provide appropriate message.

    y

    Load and executes system calls are used to bring aprogram into main memory and its execution.

    y If we Create a process than its execution is controlled

    by its attributes( priority, cpu time , etc). These

    attributes are gained byGet process attribute and set

    process attribute system calls. To terminate a process

    terminate system calls is used.

    y Wait system calls is used when a process waits for an

    event(user input, busy resource etc.)

  • 8/3/2019 CHAP-1 PART-2

    20/34

  • 8/3/2019 CHAP-1 PART-2

    21/34

    System calls for Device Management

    1. Request device , release device

    2. Read, write , reposition3. Get device attribute , set device attribute

    4. Logically attach or detach device.(distributed system)

  • 8/3/2019 CHAP-1 PART-2

    22/34

  • 8/3/2019 CHAP-1 PART-2

    23/34

  • 8/3/2019 CHAP-1 PART-2

    24/34

  • 8/3/2019 CHAP-1 PART-2

    25/34

    y There are 2 common methods for communication ,MESSAGE PASSING and SHARED MEMORY.

    y In message passing IPC is used. Before communicationstarts a path must be established.

    y Each computer in a network has a host name and eachprocess has an ID. To know the name of another host andprocess get hostid and get processid system calls areused.

    y The other communicator respond by accept connectionsystem call. Both communicator communicates with thehelp ofread message and write message system calls.

    y The close connection system call terminates thecoomunication.

  • 8/3/2019 CHAP-1 PART-2

    26/34

    y In shared memory method processes us map memory system

    call.

  • 8/3/2019 CHAP-1 PART-2

    27/34

  • 8/3/2019 CHAP-1 PART-2

    28/34

    System Programs

    y System programs provide a convenient environment

    for program development and execution. The can be

    divided into:

    y File manipulation

    y Status information

    y File modification

    y Programming language support

    y Program loading and execution

    y Communications

    y Application programs

  • 8/3/2019 CHAP-1 PART-2

    29/34

    File manipulation

    y OS provides programs for---

    1. Create file

    2. Delete file

    3. Rename file

    4. Copy file

    5. Print file

    6. List file

    7. Manipulating files

  • 8/3/2019 CHAP-1 PART-2

    30/34

  • 8/3/2019 CHAP-1 PART-2

    31/34

    File modification

    y OS provides programs for---

    y Text editors to create and modify filesy Special commands to search contents of files or perform

    transformations of the text

  • 8/3/2019 CHAP-1 PART-2

    32/34

    Programming language support

    y OS provides programs for---

    y Compilers,

    y assemblers,

    y debuggersy Interpreters

  • 8/3/2019 CHAP-1 PART-2

    33/34

    Program loading and execution

    y OS provides programs for---

    y Absolute loaders

    yrelocatable loaders

    y linkage editors

    y Debugging

  • 8/3/2019 CHAP-1 PART-2

    34/34