Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sujata Ray Dey Maheshtala College Computer Science Department

Similar presentations


Presentation on theme: "Sujata Ray Dey Maheshtala College Computer Science Department"— Presentation transcript:

1 Sujata Ray Dey Maheshtala College Computer Science Department
Processes Sujata Ray Dey Maheshtala College Computer Science Department

2 Processes Process Concept Process State Process Control Block
Process Scheduling Schedulers Context Switch Idea on Co-operating processes Processes Sujata Ray Dey (Comp. Sc.)

3 Process Concept Process – Program at the time of execution
Process Vs Programs – Program consists of Instructions in any Programming Language Process consists of instructions in machine code Program reside in Secondary storage devices Process reside in Main memory Processes Sujata Ray Dey (Comp. Sc.)

4 Process State State of Process is determined by the current activity of the process. New : Process is being created Running : Process is been executing Waiting : Process is waiting for some event to occur Ready : Process is waiting for processor Terminate : Process has finished execution Processes Sujata Ray Dey (Comp. Sc.)

5 Diagram of Process State
Processes Sujata Ray Dey (Comp. Sc.)

6 Process Control Block (PCB)
Each process is represented by its own process control block. A PCB contains – Process state – running, waiting etc. Program Counter – location of next executable instruction. CPU registers CPU scheduling information Memory management information Accounting information I/O status information Processes Sujata Ray Dey (Comp. Sc.)

7 Diagram of a PCB Processes Sujata Ray Dey (Comp. Sc.)

8 CPU switch from Process to Process
Processes Sujata Ray Dey (Comp. Sc.)

9 Process Scheduling Maximize CPU use
Process schedulers select the process to assign CPU Scheduling queues – Job queue : set of all processes in the system Ready queue : set of all processes residing in main memory and waiting for execution Device queue : set of processes waiting for an I/O device Processes migrate among various queues Processes Sujata Ray Dey (Comp. Sc.)

10 Queuing Diagram Processes Sujata Ray Dey (Comp. Sc.)

11 Schedulers Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU It is invoked frequently  must be fast Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue It is invoked infrequently  may be slow The long-term scheduler controls the degree of multiprogramming Processes can be described as either: I/O-bound process – spends more time doing I/O than computations, many short CPU bursts CPU-bound process – spends more time doing computations; few very long CPU bursts Processes Sujata Ray Dey (Comp. Sc.)

12 Addition of Mid-Term Scheduler
The process is swapped out and swapped in by the medium term scheduler. Used to reduce the degree of multiprogramming. Process can be removed from memory and can be reintroduced into memory and execution can be continued where it left off. Processes Sujata Ray Dey (Comp. Sc.)

13 Context Switch When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a context switch Context of a process represented in the PCB Context-switch time is overhead; the system does no useful work while switching The more complex the OS and the PCB  the longer the context switch Time dependent on hardware support Some hardware provides multiple sets of registers per CPU  multiple contexts loaded at once Processes Sujata Ray Dey (Comp. Sc.)

14 Co-operating Processes
Independent – A process is independent if it cannot affect or affected by the other processes executing in the system. Co-operating - Any process shares data with other processes is a co-operating process. Need for process co-operation : Information sharing Computation speedup Modularity Convenience Processes Sujata Ray Dey (Comp. Sc.)

15 Co-operating Processes contd..
Information sharing – An environment is provided to allow concurrent access to the shared resources. Computation Speed up – Parallel execution is done by breaking a task into several subtasks. Modularity – Construct a system in modular fashion. Convenience – Even an individual user may have many tasks to work on at one time. Eg, user may be editing, printing, compiling in parallel Processes Sujata Ray Dey (Comp. Sc.)

16 Thank You Processes Sujata Ray Dey (Comp. Sc.)


Download ppt "Sujata Ray Dey Maheshtala College Computer Science Department"

Similar presentations


Ads by Google