What is Operating Syatem ?



Early computer system allowed one program to be executed at a time. This program had complete control and access al resource of system. Now a day’s computer system allows multiple programs to be executed concurrently.

Process Concept

·       An Operating system executes a verity of program.
o   Batch System. – Jobs
o   Time share system – user program or task
·       Process: - is a program that is in execution (process execution must be in sequential fashion.
·       Process is divided in to two sections

Text section
Actually instruction, decides current activity of process, contains PC and other CPU register.
Data section
Involve Process stack, contain temporary local and global data.

·       A Process is more then program codes.
·       A Process is active and program is passive entity
·       Program is content stored on disk while process which has memory and currently executes


Process state


Each process is represented in the operation system by a PCB also called task control block. The PCB simply servers as the repository for any information that may vary from process to process
  • Process state: - this area defined the state of process. It may be new, Waiting, Ready and so on.
  • Program Counter: - The counter hold the value of address in memory for process which next to be executed.
  • Register: - The CPU resisters vary in number and type, depending on the computer architecture. They include
    • Accumulators
    • Index register
    • Stack pointers
    • General purpose register 

  • This state information must be saved when interrupt occur, to allow the process to be continued correctly afterward.
    ·       CPU – scheduling information: - This information includes a process priority, pointer to scheduling queues, and any other scheduling parameter.
    ·       Memory management information: - this information may include base and limit register, the page tables or the segment table, depending on the memory system used by the OS.
    ·       Accounting information: - this information includes he amount of CPU and real time used, time limits, account numbers, job or process numbers and so on.
    ·       I/O status information: - the information include the list of I/O device allocated to this process a list of open file and so on

    Process scheduling

    The objective of multi programming is to have some process running at all times so as to maximize CPU utilization, while the objective of time sharing is to switch the CPU among process so frequently that user can interact with each program while it is running
    ·       As the processes enter in the system, they are put in to a job queue. Job queue consist of all process in the system
    ·       Ready Queue: - The Processes that are residing in main memory and ready and waiting to execute are kept in this queue. This queue is generally stored as linked list.
    ·       A ready queue header contains pointers to the first and final PCB in the list. And Every PCB has Pointer field that point to next PCB in list.
    ·       When a process is allocated the CPU, it executes for a while and eventually quits, is interrupted, or waits for the occurrence of an event such as the compilation of an I/O request. I/O request may be dedicated tape drive or to a shared device such as disk
    ·       The list of process waiting for a particular i/o device is called a queue
    ·       Each device has its own queue. All process which are required disk drive then all that process is there in the disk queue.


    Queuing diagram

    A common representation of process scheduling known as queuing diagram

    ·       Here we have two types of queues. (Represented in Rectangular box)

    1.     Ready Queue
    2.     Device Queue

    ·       Circle represented that serve the queues and arrow indicate flow of process in the system.

    A new process is initially put in the ready queue. It waits in ready queue until it is selected for execution. Once the process is assigned to the CPU and it’s executing, one of several events could occur.
    ·       The process could issue I/O request, and placed in I/O queue.
    ·       The process could crate new sub process and waits for its termination.
    ·       The process could be removed forcibly from the CPU, as a result of an interrupt and be put back in the ready queue.

    A process continues this cycle until it terminates, at which time it is removed from all queues and has its PCB and resource de allocated.

    Schedulers

    Scheduling refers to a set of policies and mechanisms built in to the operating system that govern the order in which the work to be done by computer”
    “A Scheduler is an OS module that selects the next job to be admitted into the system and next process to run.”
    As we know we have number of process residence in main memory among them which will get execution first should be decide in some fashion by OS . OS will perform this operation by Schedulers
    There are two types of Schedulers.

    1.     Long Term Scheduler ( Job scheduler)
    2.     Short Term Scheduler ( CPU  scheduler)

    ·       Long Term Scheduler: -
                          i.     It is also known as job scheduler.
                        ii.     Its primary objective is to provide a balanced mix of job.
                      iii.     It selects a process when it should be brought from job queue into ready queue.
                      iv.     The long tern scheduler is invoked fairly infrequently and can be fairly slow.
                        v.     Processes are added to system much less frequently then processes are swapped between ready queue and CPU.
                      vi.     The long term scheduler usually has to make a more difficult decision then short term scheduler.
                    vii.     The long term scheduler controls the degree of multiprogramming.
                   viii.      If there are too few processes in memory, the system is under utilized. If there are too many processes in memory, the system ay spend too much time swapping between processes because of lack of resource(memory)
    ·        Short Term Scheduler: -
                          i.     It is known as CPU scheduler.
                        ii.     Its main objective is to maximize system performance in accordance with the chosen set of criteria. 
                      iii.     It selects process from ready queue and gives control of CPU to the process.
                      iv.     The short term scheduler is invoked very frequently and must be very fast.
                        v.     Processes typically hold the CPU for short periods of time.
                      vi.     While Short term scheduler is deciding which job to run next, the system is not performing any useful work.


    Context Switch

    “Switching the CPU to another process requires saving the state of old process and loading the saved state of new process is known as a Context Switch
    • While performing Context switch old process lost its share of CPU time and new process will get its share of CPU time.
    • The context of process is represented in the PCB for a particular process. It includes the value of CPU registers, the process state and memory management information.
    • When context switch occurs, the kernel saves context of an old process in its PCB and load saved context of a new process for scheduling and then run.  
    • Context switch time is a time between moving from one process to another by the CPU. This time is a overhead because the system does not perform useful work while switching.
    • Context switch time is depending upon hardware support as well as memory speed, number of register to be copied and existence of special instruction.

    CPU – I/O Burst Design


    • The success of CPU Scheduling depends on the property, CPU – I/O burst cycle of processor.
    •  Process execution consists of a cycle of CPU execution and I/O waits.
    • Process alternate between these two states.
    • Process execution begin with CPU execution this is followed by a I/O burst and another CPU burst and another I/O burst and so on.   
    • All process terminates with CPU burst cycle. Last CPU burst will end with a system request to terminate execution rather than with another I/O burst.
    • The duration of CPU burst have been extensively measured The CPU burst cycles vary greatly by processor and computer. Thy tend to have frequency curve similar to below
    • An I/o bound program would typically many short CPU burst.
    • A CPU bound program might have few very long CPU burst.


    The curve is generally characterized as exponential or in hyper exponential form. It may have many short CPU burst and  few long  CPU burst.

    CPU scheduling


    • When ever the CPU become ideal, the operating system must select one of the processes in the ready queue to be executed. The selection process is carried out by Short-Term scheduler also known as CPU scheduler.
     


What is Operating Syatem ? What is Operating Syatem ? Reviewed by Unknown on 7:52:00 AM Rating: 5

No comments:

Powered by Blogger.