Docsity

Operating System Process Control and Management, Slides of Computer Science

Partial preview of the text

Download Operating System Process Control and Management and more Slides Computer Science in PDF only on Docsity!

Process Control

z Process Control Block (PCB) z Process State Information z Process Control Information z Functions of an Operating-System Kernel z Switch a Process z Change of Process State z Execution of the Operating System

Operating System Control

Structures

z Schedules and dispatches processed for execution by the processor z Allocates resources to processes

(Think about struct rlim t and getrlim it)

z Responds to requests by user programs

z (Think about getopt)

z Tables are constructed for each entity the operating system manages

I/O Tables

z I/O device is available or assigned z Status of I/O operation z Location in main memory being used as the source or destination of the I/O transfer

File Tables

z Existence of files z Location on secondary memory z Current Status z Attributes z Sometimes this information is maintained by a file-management system

(Think about struct stat and stat( ) )

Process State Transition Diagram with Two Suspend States - Seven- State Process Model New Admit Admit^ Suspend Dispatch

Time out

Ready, suspend Ready

Blocked,suspend Blocked

Event Occurs

Activate

Event Occurs

Activate

Suspend

Running Exit

Event Wait

Suspend Docsity.com

UNIX Process State

Transition Diagram (1)

return to user

return^ preempt reschedule process

interrupt, exit^ sleep interrupt return

system call, interrupt wakeup swap out

wakeup

swap in

swap out

enoughmemory^ not enough memory(swapping system only)

fork

Zombie

KernelRunning

Running^ User

Preempted

Asleep inMemory

Ready to Runin Memory

Created

Swapped^ Sleep,

Ready to Run Swapped

UNIX Process State

Transition Diagram (3)

z Asleep in memory: unable to execute until an event occurs; process in main memory. z Ready to run, swapped: process is ready to run, but the the swapper must swap the process into main memory before the kernel can schedule it to execute. z Sleeping, swapped: The process is awaiting an event and has been swapped to secondary storage.

UNIX Process State

Transition Diagram (4)

z Preempted: process is returning from kernel to user mode, but the kernel preempts it and does a process switch to schedule another process. z Created: process is newly created and not yet ready to run. z Zombie: process no longer exists, but it leaves a record for its parent process to collect.

UNIX Process Control

Table

z Process Identifiers ID of this process and ID of parent process. z User Identifiers real user ID, effective user ID z Pointers To U area and process memory (text, data, stack) z Process Size, Priority, Signal, Timers, ......Docsity.com

Processor State

Information

z Contents of processor registers y User-visible registers (data/address register). y Control and status registers (program counter, instruction register. y Stack pointers ( points to the top of the stack). z Program status word (PSW) y contains status information - indicate the mode of execution (user or kernel mode) ?????? Docsity.com

Question 1 Process Control - Exercise/Home Work

z a) A number of operating systems have two modes (UNIX), kernel and user. What are the advantages and disadvantages of providing four mode instead of two?

z b) Can you make a case for even more than four modes?

Typical Functions of an

Operating-System Kernel (1)

Memory Management z Allocation of address space to processes z Page and segment management I/O Management z Allocation of I/O channels and devices to processes Support Functions z Interrupt handling and accounting

Receive Message from Child

Processes

  • wait( ) System Call

  • Status Information of wait( )

  • Example: communication between parent process and child processes (jg73.cc and jg74.cc)

Process Control

Information

z Additional information needed by the operating system to control and coordinate the various active processes y scheduling and state information y data structuring y interprocess communication y process privileges y resource ownership and utilization ??????