os presentation process

19

Upload: naseer-ahmad

Post on 25-May-2015

480 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Os presentation process
Page 2: Os presentation process

NASIR AHMID

BS(CS)

1st Semester

1421-212007

Prof. Naeem Iqbal

PRESTON UNI

Page 3: Os presentation process

PROCESS CONCEPT

PROCESS:

A program in execution, process execution must progress in sequential fashion.

Page 4: Os presentation process

PROCESS A Process includes

A program in executionAn instance of a program running on a

computerThe entity that can be assigned to and

executed on a processorA unit of activity characterized by the

execution of a sequence of instructions a current state and an associated set of system resources

Page 5: Os presentation process

PROCESSESAll the run able software on comp including OS is organized

into a number of sequential processes or just processes for short processes is just an executing program, including the current values of the registers and variables. Conceptually each process has its virtual cpu.

The cpu switches back and forth from process to processes, but to understand the system much easier to think about a collection of processes running in pseudo parallel, than to keep track of how the cpu switches from prog to prog .This back and forth switching is called multiprogramming.

Page 6: Os presentation process

THE PROCESS MODEL(a) Multiprogramming of four programs.(b) Conceptual model of four independent, sequential processes.(c) Only one program active at any instant.

Page 7: Os presentation process

PROCESS IN MEMORY

Page 8: Os presentation process

PROCESSES CREATIONOS need some way to make sure all the necessary

processes exits.In general purpose systems. Some way is needed

to create and terminate processes as needed during operation.

Principal events that cause processes creation.1. System initialization.2. Executing of a processes creation system call.3. User request to create new process.4. Initiation of a batch job.

Page 9: Os presentation process

PROCESSES CREATIONWhen OS is booted, typically several processes are

created.Foreground processes: Processes that interact

with human user and perform work them.Background processes: Not associated with

particular users, but instead have specific function. E.g. designed to accept incoming email ,sleeping most of the day but comes to life when email arrives.

Daemons: Processes that stay in the background to handle some activity such as email, web pages and so on called daemons.

Page 10: Os presentation process

PROCESSES CREATIONProcesses can be created after boot time as well.Often a running process issue system calls to create one or

more new processes to help it do its job.Creating new processes is particularly useful when the

work to be done can easily be formulated in terms of several related, but otherwise independent interacting processes.

In interactive systems, users can start a program by typing a command or double clicking an icon.

In command based UNIX systems running X windows, the new process takes the new window. In windows , when a processes started it doesn’t have a window, but it can create one or more and most do.

Page 11: Os presentation process

PROCESS TERMINATIONAfter a process has been created, it starts

running and does whatever its job is. However, no process lasts forever.

Sooner or later the new process will terminate, usually on one of the following conditions:

1. Normal exit(voluntary).2. Error exit(voluntary).3. Fatal error(involuntary).4. Killed by another processes(involuntary).

Page 12: Os presentation process

PROCESS TERMINATIONNormal exit(voluntary): Terminate because they

have done their work.Fatal error(involuntary): The process discovers a

fatal error e.g. user types the command cc foo.c to compile the program foo.c and no file exists the compiler simply exits.

Error exit(voluntary): An error caused by a process often due to a program e.g. executing an illegal instruction , referencing nonexistent memory, or divide by zero.

Killed by another processes(involuntary): A process executes a system call telling the OS to kill some other process. Using kill system call.

Page 13: Os presentation process

PROCESS HIERARCHIESParent creates a child process, child processes

can create its own processes.Forms a hierarchy

UNIX calls this a “process group”.Windows has no concept of hierarchy.

All processes are created equal.

Page 14: Os presentation process

PROCESS STATES

State Transition diagram

• Possible process states– ready– running– blocked

Page 15: Os presentation process

PROCESS STATESAs a process executes, it changes states.New: The process is being created.Running: Instructions are being executed.Waiting: The process is waiting for some

event to occur. Ready: The process is waiting to be

assigned to a processor.Terminated: The process has finished

execution.

Page 16: Os presentation process

PROCESS STATES

Page 17: Os presentation process

IMPLEMENTATION OF PROCESS AND (PCB)To implement the process model, the OS maintains a

table (an array of structures called the process table with one entry per process). Some authors call these entries process control block.

These entry contains information about the:Process state.Program counter.CPU registers.CPU switching information.Memory management information.Accounting information.I/O status information.

Page 18: Os presentation process

PROCESS CONTROL BLOCK (PCB)

Page 19: Os presentation process

THANK YOU