(in Operating System)

21
PROCESSES (IN OPERATING SYSTEM) By: PARITOSH SHARMA

description

about computer processes

Transcript of (in Operating System)

Page 1: (in Operating System)

PROCESSES(IN OPERATING SYSTEM)

By: PARITOSH SHARMA

Page 2: (in Operating System)

INTRODUCTION

It contains some Sub topics by which we can able to understand it:

• Concept of the processes.• Difference b/w process and program.• Type of processing (tasking).• Process states.• Process control block (PCB).• Process state transitions.

Page 3: (in Operating System)

PROCESSES CONCEPTS

• Early computers allows single program to be executed at a time, but in today's scenario multiple programs are executed concurrently at a time.

• The term ‘process’ first used in 1960s.• A ‘process’ is the unit of work in modern

time-sharing system, so it consists of a collection of processes.

Page 4: (in Operating System)

A PROCESS CONTAINS:

• Text section: contains program code.• Current activity: value of program counter.• Process stack: contains temporary data such as

function parameter, local variables etc.• Data section: contain relevant variables.

Page 5: (in Operating System)

DIFFERENCE B/W PROCESS AND PROGRAM:

• A Program would be executed by specific way/method called process, specific program has specific process. So a program itself is not a process.

• A program is a ‘passive’ entity. For example, contents of a file stored on disk.

• A process is a ‘active’ entity. For example ,a program counter specifying the next instruction to execute and a set of associated resources.

Page 6: (in Operating System)

• Two process may be associated with the same program at a time, they are not considered two separate execution sequences.

For example: several users or a user may be running different copy of program, each of these program is separate process(text section are equivalent, the data section varies). So these two processes would not only be completely independent from the view of operating system(OS).

Page 7: (in Operating System)

TYPE OF PROCESSING (TASKING)

• There are two types of Tasking:-

Implicit tasking (System defined)

Explicit tasking (programmer defined)

Page 8: (in Operating System)

Implicit tasking (system defined)

• In this tasking process is defined by the system, it is used in time sharing systems.

For example: a separate process may be created for each of the job activities-including compilation, linking and execution of the user program, on same operating system.

Page 9: (in Operating System)

Explicit tasking (Programmer defined)

• In this of tasking the programmer explicitly define each process and some of its attributes, (for explicit control of system activities and high performance).

• OS and application program are common example of programmer-defined processes.

Page 10: (in Operating System)

Reasons for explicit tasking

They are as follows:-• It speeds up the execution of an application.• It provides user convenience by creating tasks

to handle individual actions.• It uses multiprocessor system. So, more than

one process can execute at a time.• It uses distributed computing system.

Page 11: (in Operating System)

PROCESS STATES

• In these days multiprocessing are commonly used so, a process goes through a series of stage (states). The life time of a process can be divided into several stage, they are as follows:-

• New (Born)• Running (Executing)• Waiting/Blocked (Waiting for some resources and

processor)• Ready (Ready for execution)• Terminate (Finally stop )

Page 12: (in Operating System)
Page 13: (in Operating System)

• New state: the new process is being created.• Running process: when a process gets a

control from CPU plus other resources, it starts executing.

• Waiting/Blocked state: a waiting state process has shortage of some resources other than the CPU. Such processes are not considered for execution until the respective blocking condition is fulfilled.

Page 14: (in Operating System)

• Ready state: a ready process processes all the resources needed for its execution, except the processor (CPU).

• Terminate state: in this state the process finally stops. So, a process terminates when it finished executing its last statement.

So, these all stage/state would work in sequence, Operating system works as a traffic manager.

Page 15: (in Operating System)

PROCESS CONTROL BLOCK (PCB)

• The operating System groups all information that it needs about a particular process into a data structure called a Process Control Block (PCB).

• Its simply serves as the storage for any information for processes.

Page 16: (in Operating System)

A PCB is shown in fig..

Page 17: (in Operating System)

• Process number or ID: Each process is identified by its process number, called process ID.

• Priority: Each process contains some priority with respect to other processes.

• Process state: Each process may be in one of the following states-new, ready, waiting, running, terminated.

• Program counter: It indicates the address of next instruction to be executed for this process.

Page 18: (in Operating System)

• Register: The register may vary in type and in number, depending upon the computer architecture.

They include general purpose register, accumulator, index registers, etc.

Page 19: (in Operating System)

• CPU-scheduling information: It includes a process priority, pointers to scheduling queues, and any other scheduling parameters.

• Memory management information: This may include such information as the value of base and limit registers, the page tables, or the segment tables, depending upon the memory system used by the OS.

Page 20: (in Operating System)

• Accounting information: It includes the actual CPU time used in executing a process.

• I/O status information: This information includes the list of I/O devices allocated to this process, list of pending operations and so on.

• File management information: It includes information about open files and access rights given to any file.

Page 21: (in Operating System)

PROCESS STATE TRANSITIONS

• When a job is admitted to the system, a corresponding process is created and normally inserted at the end of ready list.

This ready list like a queue. So the process in the ready list gradually moves to the head of the list as the process before it in the list complete their turn as using the CPU.