3. Process Management : A BCA Notes


 Process Management

    The term process was first used by the designer in 1960. Since the, the term process, used somewhat inter changeability with "task" or "job" the process has been given many definition of the process is "program in "execution". Seems to be most frequently used and in the present study of OS.
    • A programming execution 
    • An  asynchronous activity 
    • An animated strip of a procedure in execution.
    • An entity to which processors are assigned.
    • A dispatch able unit.
    The relation between process and program is that it is same beast with different name or when these beast is sleeping (not executing) it is called program and when it is executing it becomes process. Process is not same as program. A process is more than a  program code. A process is an active entity as oppose to program which considered being a positive entity. A program is  an algorithm expressed in some suitable notation (programming language). Being a passive a program is only a part of process. 
    Process on other hand includes.
    1. Current value of program counter (PC).
    2. Contents of the processor register.
    3. Value of the variables.
    4. The process stacks (SP) which typically contains temporary data such as sub-routine parameter, return address and temporary variables.
    5. A data section that contains global variables.
    6. A process is a unit of work in a system. 
    In process model all software on the computer is organized into a number of sequential process. A process includes program counter, registers, variable conceptually, each process has its own virtual CPU. In reality the  CPU switches back and fourth among processor. (The rapid switching back and forth is called multi-programming or multi-processing.)

    Process States

     The process state consists of everything necessary to resume the process execution if it is some how put a site temporarily. The process state.
    Consists of at least followings.
    1. Code for the program 
    2. Programs statics data
    3. Programs dynamic data.
    4. Program procedure call stack
    5. Contents of general purpose registers.
    6. Contents of program counter 
    7. Contents of program status word (PSW)
    8. OS resources in use.
    A process goes through a series of discrete process state.
    a.) New state :- The process is being created.
    b.) Blocked or waiting state :- A process  is to be said running if it has the CPU, that is process actually using the CPU at that particular instance.
    c.) Blocked or waiting state :- A process is said to be blocked if it is waiting for some event to happened such that I/O completion before it can process. Note that a proceeds is unable to run until some external event happens.
    d.)Ready state :- A process is said to be ready if it use a CPU if one were available. A ready state process  is runnable but temporarily stopped running to let other processes run.
    e.) Terminated state :- The process has finished its execution.

    Stages of  process Model

    There are seven stages of process model.

    i.) Blocked-to-blocked/suspended 

    If there are no ready process in the main memory at least one blocked process is swapped out to make room for another process which is not blocked.

    ii.) Blocked / Suspended-to-blocked 

    If the process is terminated making space in the main memory and if there is any high priority process which is blocked but suspended, anticipating that it will become free very soon, The process is brought into the memory.

    iii.) Blocked / Suspend to ready / Suspended 

    A process is moved from blocked/suspended to ready/suspended if the event occur on which the process was waiting, as there is no space in the memory.

    iv.) Ready / suspended to ready 

    If there are no ready process in the memory OS has to bring one process in memory to continue the execution, sometimes this transaction takes place even there are ready process in memory but having low priority than one of process in ready/suspended state. so the high priority process is brought into main memory.

    v.) Ready to ready/suspended 

    Normally the blocked process are suspended by the OS but sometimes to make lager block free, a ready process may be suspended. In this case normally low priority process is suspended.

    vi.) New to ready/suspended 

    When a new process is created, it should be added to ready state. But sometimes insufficient memory may be available to allocate  that newly created process. In this case the new process is shifted to ready/suspended.
    Diagram
    Process Management

    Process Structure 

     The location of the process depends and memory management scheme being used by the OS. In the simplest case, the process is maintained in secondary memory, and to manage these process, at least small part of this process is maintained in the memory. To execute the process, the entire process or part of it is brought into main memory, and for that the OS needs to know the location of the process.
        The contents of the process are user program to be executed, and the user data which is associated with that program. Apart from these there are two major part of the process.
        System stack (which is used to sore parameters and calling address for procedure and system calls), and process control box (This is a collection of process attributes needed by OS to control the process). A collection of user program, data, system stack and process control box is called process image.
     
    Process Management

    Process control block

    A process in an OS is represented by a data structure known as process control block (PCB) or process descriptor. The PCB contains important information about a specific process including.
    i.) The current state of the process (ready, blocked suspended, waiting, running or whatever).
    ii.) A unique id of the process in order to track which is which information.
    iii.) A pointer to the present process.
    iv.) A pointer to the Child process (if it exist).
    v.) The priority of the process.
    vi.) Pointer to locate memory of the process.
    vii.) A register save area.
    Diagram
    Process Management


    No comments:

    Post a Comment