OPERATING SYSTEM PART 2
Essential Properties of the Operating System
- Batch : Jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequencer. Performance is increased by attempting to keep CPU and I/O devices busy at all times through buffering , off line operation, spooling and multiprogramming. A Batch system is good for executing large jobs that need little interaction, it can be submitted and picked up latter.
- Time sharing : Uses CPU’s scheduling and multiprogramming to provide economical interactive use of a system. The CPU switches rapidly from one user to another i.e. the CPU is shared between a number of interactive users. Instead of having a job defined by spooled card images, each program reads its next control instructions from the terminal and output is normally printed immediately on the screen.
- Interactive : User is on line with computer system and interacts with it via an interface. It is typically composed of many short transactions where the result of the next transaction may be unpredictable. Response time needs to be short since the user submits and waits for the result.
- Real time system : Real time systems are usually dedicated, embedded systems. They typically read from and react to sensor data. The system must guarantee response to events within fixed periods of time to ensure correct performance.
- Distributed : Distributes computation among several physical processors. The processors do not share memory or a clock. Instead, each processor has its own local memory. They communicate with each other through various communication lines.
Batch operating system is one where programs and data are collected together in a batch before processing starts. In batch operating system memory is usually divided into two areas : Operating system and user program area. Time sharing, or multitasking, is a logical extension of multiprogramming. Multiple jobs are executed by the CPU switching between them, but the switches occur so frequently that the users may interact with each program while it is running. When two or more programs are in memory at the same time, sharing the processor is referred to the multiprogramming operating system. Spooling is useful because device access data than different rates. The buffer provides a waiting station where data can rest while the slower device catches up.
A process is sequential program in execution. A process defines the fundamental unit of computation for the computer. Components of process
1. Object Program
4. Status of the process execution.
Process vs. Program
Process is a dynamic entity, that is a program in execution. A process is a sequence of information executions. Process exists in a limited span of time. Two or more processes could be executing the same program, each using
their own data and resources.
Program is a static entity made up of program statement. Program contains the instructions. A program exists at single place in space and continues to exist. A program does not perform the action by itself.
When process executes, it changes state. Process state is defined as the current activity of the process. Process state contains five states. Each process is in one of the states. The states are listed below.
1. New : A process that just been created.
2. Ready : Ready processes are waiting to have the processor allocated to them by the operating system so that they can run.
3. Running : The process that is currently being executed. A running process possesses all the resources needed for its execution, including the processor.
4. Waiting : A process that can not execute until some event occurs such as the completion of an I/O operation. The running process may become suspended by invoking an I/O module.
5. Terminated : A process that has been released from the pool of executable processes by the operating system.
1. If one process is ready to execute, but there is no space in the main memory, then it is suspended. (called Swapping)
2. when one process in main memory which was blocked & there is another process ready to execute, but waiting in
secondary memory, then the process in main memory is suspended.
3. when the parent process suspends, then the sub process is also suspended.
Process Control Block
Each process contains the process control block (PCB). PCB is the data structure used by the operating system. Operating system groups all information that needs about particular process.
1. Pointer : Pointer points to another process control block.Pointer is used for maintaining the scheduling list.
2. Process State : Process state may be new, ready, running, waiting and so on.
3. Program Counter : It indicates the address of the next instruction to be executed for this process.
4. Event information : For a process in the blocked state this field contains information concerning the event for which the process is waiting.
5. CPU register : It indicates general purpose register, stack pointers, index registers and accumulators etc. number of register and type of register totally depends upon the computer architecture.
6. Memory Management Information : This information may include the value of base and limit register. This information is useful for deallocating the memory when the process terminates.
7. Accounting Information : This information includes the amount of CPU and real time used, time limits, job or process numbers, account numbers etc.
Process control block also includes the information about CPU scheduling, I/O resource management, file management information, priority and so on. The PCB simply serves as the repository for any information that may vary from process to process. When a process is created, hardware registers and flags are set to the values provided by the loader or linker. Whenever that process is suspended, the contents of the processor register are usually saved on the stack and the pointer to the related stack frame is stored in the PCB. In this way, the hardware state can be restored when the process is scheduled to run again.
Time Multiplexing: Multiprogramming operating system allows more than one process to be loaded into the executable memory at a time and for the loaded process to share the CPU using time multiplexing.