Process Control z z z z Process Control
- Slides: 30
Process Control z z z z Process Control Block (PCB) Process State Information Process Control Information Functions of an Operating-System Kernel Switch a Process Change of Process State 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 rlimt and getrlimit) z Responds to requests by user programs z (Think about getopt) z Tables are constructed for each entity the operating system manages
Memory Tables z Allocation of main memory to processes z Allocation of secondary memory to processes z Protection attributes for access to shared memory regions z Information needed to manage virtual memory
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 z z Existence of files Location on secondary memory Current Status Attributes Sometimes this information is maintained by a file-management system (Think about struct stat and stat( ) )
Process Table z Process image consists of program, data, stack, and attributes z Attributes y process control block ( Think about Process ID and getpid( ) ) (Think about Resource Limits and getrlimit( ) )
Process State Transition Diagram with Two Suspend States - Seven. State Process Model New Admit Ready, suspend Admit Suspend Dispatch Activate Ready Suspend Time out Event Occurs Blocked, suspend Running Activate Blocked Suspend Event Wait Exit
UNIX Process State Transition Diagram (1) fork Created Preempted return to user User Running not enough memory (swapping system only) enough memory preempt return system call, interrupt, interrupt return swap out reschedule process Ready to Run in Memory Ready to Run Swapped swap in Kernel Running sleep wakeup exit Zombie Asleep in Memory swap out Sleep, Swapped
UNIX Process State Transition Diagram (2) z User running: Executing in user mode. z Kernel running: Executing in kernel model. z Ready to run, in memory: Ready to run as soon as the kernel schedules it.
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 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.
Process Control Block Process Identification z Process Control Block The collection of attributes is refereed to as process control block. z Unique numeric identifier y may be an index into the primary process table
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, . . .
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) ? ? ?
Question 1 Process Control - Exercise/Home Work z The VAX/VMS operating system makes use of four processor access modes as follows: z Kernel: Executes the kernel of the VMS operating system, which includes memory management, interrupt handing, and I/O operations. z Executive: Executes many of the operating system service calls, including file and disk management routines. z Supervisor: Executes other operating system services, such as responses to user command. z User: Execute user programs, plus utilities such as compilers, editors, linkers, and debuggers.
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) z z Memory Management Allocation of address space to processes Page and segment management I/O Management Allocation of I/O channels and devices to processes Support Functions Interrupt handling and accounting
Typical Functions of an Operating-System Kernel (2) z z Process Management Process creation and termination Process scheduling and dispatching Process switching Process synchronization and support for inter-process communication
Receive Message from Child Processes * wait( ) System Call * Status Information of wait( ) * Example: communication between parent process and child processes (jg 73. cc and jg 74. 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 ? ? ?
Question 2: Multiple Blocked Queues Process Control - Exercise/Home Work Ready Queue Dispatch Admit Release Processor Time-out Event 1 Wait Event 1 Occurs Event 1 Queue Event 2 Wait Event 2 Occurs Event 2 Queue
Question 2 Process Control - Exercise/Home Work z Figure “Multiple Blocked Queues” suggests that a process can only be in one Event queue at a time. z a) Is it possible that you would to allow a process to wait on more than one event at the same time? Provide an example. z b) In that case, how you modify the queuing structure of the figure to support this new feature?
When to Switch a Process z Trap y error occurred y may cause process to be moved to Exit state z Supervisor call y such as file open
When to Switch a Process z Memory fault y memory address is in virtual memory so it must be brought into main memory z Interrupts ? ? ? y Clock x process has executed for the maximum allowable time slice y I/O
Question 3 Process Control - Exercise/Home Work z In a number of early computers, an interrupt cased the register values to be stored in fixed locations associated with the given interrupt signal. z Under what circumstances is this a practical technique? Explain why it is inconvenient in general.
Execution of the Operating System z Nonprocess Kernel y execute kernel outside of any process y operating system code is executed as a separate entity that operates in privileged mode P 1 P 2 . . . Kernel Pn
Execution of the Operating System z Execution Within User Processes y operating system software within context of a user process y process executes in privileged mode when executing operating system code P 1 P 2. . . Pn OS OS OS Functions Process Switching Functions
Execution of the Operating System z Process-Based Operating System y major kernel functions are separate processes y a process is invoked by the operating system P 1 P 2. . . Pn OS 1 OS 2. . . OSn Process Switching Functions
Question 4 Process Control - Exercise/Home Work UNIX is unsuitable for real-time applications, because a process executing in kernel mode may not be preempted. Elaborate. P 1 P 2. . . … Pn OS OS OS Functions Process Switching Functions
Question 5 Process Control - Exercise/Home Work z The UNIX kernel will dynamically grow a process’s stack in virtual memory as needed, but it will never try to shrink it. z Explain why it would be possible to shrink the stack, and z Why the UNIX kernel does not shrink it.
- Dairy plant management
- Primary control vs secondary control
- Control volume vs control surface
- Stock control e flow control
- Control volume vs control surface
- Negative regulation
- Positive control vs negative control
- Hdlc adalah
- Control de flujo y control de errores
- Negative control vs positive control examples
- Error control and flow control
- Scalar control vs vector control
- Control c control v
- The control process begins with establishing standards.
- Statistical process control ppt
- Process control systems
- Pmi 2013
- Seven core metrics in spm
- Explain the process control block
- Explain the process control block
- Spc/apc
- Process control instrumentation technology
- Process design and control design should always be in
- Process control block (pcb)
- Sample pfmea
- Process control board
- Importance of management functions
- Distance velocity lag process control
- Environmental process control
- Environmental process control
- Discrete process control