OUTLINE What is the Process Management? What is it covers? pprocess state pprocess table, pprocess...

35
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    224
  • download

    0

Transcript of OUTLINE What is the Process Management? What is it covers? pprocess state pprocess table, pprocess...

OUTLINEOUTLINE

What is the Process Management?

What is it covers?

process state process table, process scheduling

Process State

Process Table(process control block)

process state memory state resource state

Process Scheduling

What is Multiprogramming ProcessConclusion ;Process Management

What is Process Management?

Ever action run iEver action run inside nside a process.a process.

In computer science, a In computer science, a process is an process is an application in application in execution.execution.

What is Process Management?

OOperating system's way perating system's way of dealing with running of dealing with running multiple processes. multiple processes.

CComputing andomputing and distributing distributing "timeshares". "timeshares".

Process State

When a process is When a process is using the CPU, it is using the CPU, it is actually running and actually running and doing some work .doing some work .

If a process does If a process does I/O I/O ,,the device is not the device is not ready or just slowready or just slow

The process states and transitions are;

Process table

TThe suspended process to be he suspended process to be restarted at a later time as if restarted at a later time as if it had never been stoppedit had never been stopped

The O/S maintains information The O/S maintains information about each process in a about each process in a process table process table

Process table

PProcess control blocksrocess control blocks must contain must contain information about information about

process state process state memory state memory state resource stateresource state

Process State

The process state must The process state must contain all the contain all the information information

the value of each the value of each register register

the program the program counter counter

the stack pointer the stack pointer

TThe process is in he process is in

runnning, runnning,

runnable, runnable,

blockedblocked

Memory state

Details of the memory Details of the memory allocation such as pointers allocation such as pointers to the various memory to the various memory areas used by the programareas used by the program

Resource state

Information regarding the status of files being used by the process such as user ID

MULTI-MULTI-PROGRAMMINGPROGRAMMING

Process SchedulingProcesses are put into a job Processes are put into a job queuequeue

They are kept in a list called They are kept in a list called ready queueready queue

The ready queue is The ready queue is generally stored as a link generally stored as a link listlist

Process waiting for a Process waiting for a particular device are placed particular device are placed in a I/O queuein a I/O queue

1717

Process Queuescpuready queue

I/O queuei/o I/O request

time sliceexpires

fork achild

resourcerequestresource queue

wait queue

childexecutes

join

Multiprogramming ProcessSCHEDULERS:SCHEDULERS:

Two types of scheduler:Two types of scheduler:

– Long-term schedulers (Job Long-term schedulers (Job scheduler)scheduler)

– Short-term scheduler (CPU Short-term scheduler (CPU scheduler)scheduler)

Multiprogramming ProcessThe The short-term scheduler:short-term scheduler: selects from among the selects from among the processes that are ready to processes that are ready to execute and allocates the CPU execute and allocates the CPU to one of themto one of themmust select a new process for must select a new process for the CPU frequentlythe CPU frequentlymust be very fast.must be very fast.

Multiprogramming ProcessThe The long-term long-term scheduler :scheduler :

selects processes from a selects processes from a batch system and loads batch system and loads them into memory for them into memory for executionexecutionexecutes less frequentlyexecutes less frequently

2121

SCHEDULERSSCHEDULERS

BlockedNewly arriving jobs

Ready Queue Running

Long-term Scheduler

Short-term Scheduler

2222

Medium-term Medium-term SchedulingScheduling

Partially-executed swapped-out processes

CPUReady Queue

I/OI/O waiting queues

end

2323

The CPU SchedulerThe CPU Scheduler

CPU scheduling decisions take CPU scheduling decisions take place when a process:place when a process:

(i)(i) switches from running to switches from running to waiting statewaiting state

(ii)(ii) switches from running to switches from running to ready stateready state

(iii)(iii) switches from waiting to switches from waiting to readyready

(iv)(iv) terminates.terminates.

2424

Scheduling Criteria

CPU utilizationCPU utilization

ThroughputThroughput

Turnaround timeTurnaround time

Waiting timeWaiting time

Response timeResponse time

FairnessFairness

2525

Scheduling Policies

Preemptive Scheduling:Preemptive Scheduling:

A process switched back A process switched back and forth between running and forth between running and ready stateand ready state

More efficient , better More efficient , better capabilitiescapabilities

More complex and needs More complex and needs hardware supporthardware support

2626

Scheduling Policies

Non-Preemptive Scheduling:Non-Preemptive Scheduling:

Once a process begins Once a process begins execution, it occupies CPU execution, it occupies CPU until it finishes or it blocksuntil it finishes or it blocks

SimplicitySimplicity

Creates problemsCreates problems

2727

SCHEDULING SCHEDULING ALGORITHMSALGORITHMS

First-Come-First-First-Come-First-Served or FIFO Served or FIFO SchedulingSchedulingShortest-Job-first Shortest-Job-first SchedulingSchedulingPriority SchedulingPriority SchedulingRound-Robin Round-Robin SchedulingScheduling

2828

FCFS SchedulingFCFS Scheduling

First process will be First process will be served by CPUserved by CPU

Non-preemptiveNon-preemptive

Waiting time is quite longWaiting time is quite long

ExampleExample

2929

FCFS SchedulingFCFS Scheduling

ProcessProcess CPU Burst Time CPU Burst Time (ms(ms))

P1P1 2424

P2P2 33

P3P3 33P1 P2 P3

0 24 27 30

Waiting time for P1 = 0; P2 = 24; P3 = 27

Ave. waiting time: (0 + 24 + 27) /3 = 17 ms.

3030

FCFS SchedulingFCFS Scheduling

P1P2 P3

0 3 6 30

Waiting time for P1 = 6; P2 = 0; P3 = 3

Ave. waiting time : (6 + 0 + 3)/3 = 3

Much better than the previous case, where we had a

Convoy Effect: short process behind long process. Results in lower CPU utilization

3131

Shortest-Job-First Shortest-Job-First SchedulingScheduling

Selects the shortest job Selects the shortest job firstfirst

Enqueue jobs in order of Enqueue jobs in order of estimated completion estimated completion timetime

It is non-preemptiveIt is non-preemptive

3232

Priority SchedulingPriority Scheduling

Assign a priority to each job and Assign a priority to each job and schedule jobs in order of priorityschedule jobs in order of priority

Typically low priority values = Typically low priority values = “High Priority”“High Priority”

Increasing priority means decrease Increasing priority means decrease its priority valueits priority value

It can be both preemptive or non-It can be both preemptive or non-preemptivepreemptive

Equal priority processes are Equal priority processes are scheduled in FCFS orderscheduled in FCFS order

3333

Round-Robin Scheduling

Designed for time-sharing Designed for time-sharing systemssystems

PreemptivePreemptive

Each process gets a small Each process gets a small unit of CPU time usually 10-unit of CPU time usually 10-100 milliseconds100 milliseconds

After that time the process After that time the process preempted and added to preempted and added to the end of the ready queuethe end of the ready queue

RESOURCESRESOURCES

http://computing-http://computing-dictionary.thefreedictionary.com/dictionary.thefreedictionary.com/process+tableprocess+tablehttp://en.wikipedia.org/wiki/http://en.wikipedia.org/wiki/Process_managementProcess_managementhttp://jan.netcomp.monash.edu.au/http://jan.netcomp.monash.edu.au/OS/l8_2.htmlOS/l8_2.htmlhttp://www.cs.jhu.edu/~yairamir/http://www.cs.jhu.edu/~yairamir/cs418/os2/sld007.htmcs418/os2/sld007.htmhttp://www.bilgiyonetimi.org/cm/http://www.bilgiyonetimi.org/cm/pages/mkl_gos.php?nt=131pages/mkl_gos.php?nt=131

http://gaia.ecs.csus.edu/http://gaia.ecs.csus.edu/~zhangd/oscal/pscheduling.html~zhangd/oscal/pscheduling.html