1 / 19

PROCESS Control BLOCK & PROCESS SCHEDULING

PROCESS Control BLOCK & PROCESS SCHEDULING. Dhanjit Das 11CS10012 Operating Systems – Scribe submission | 22/1/14. Process Control Block (PCB). Also called: Task Controlling Block Task Struct Switchframe

zinna
Download Presentation

PROCESS Control BLOCK & PROCESS SCHEDULING

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PROCESS Control BLOCK &PROCESS SCHEDULING Dhanjit Das 11CS10012 Operating Systems – Scribe submission | 22/1/14

  2. Process Control Block (PCB) • Also called: • Task Controlling Block • Task Struct • Switchframe • is a data structure in the operating system kernel containing the information needed to manage a particular process. • The PCB is "the manifestation of a process in an operating system”

  3. Role of PCB • Central in process management: they are accessed and/or modified by most OS utilities, including those involved with scheduling, memory and I/O resource access and performance monitoring. • The set of the PCBs defines the current state of the operating system. • Data structuring for processes is often done in terms of PCBs. For example, pointers to other PCBs inside a PCB allow the creation of those queues of processes in various scheduling states ("ready", "blocked", etc.) that we previously mentioned.

  4. PCB Structure Information associated with each process • Process state • Program counter • CPU registers • Accumulator, Index reg., stack pointer, general Purpose reg., Program Status Word (PSW) • CPU scheduling information • Priority info, pointer to scheduling queue • Memory-management information • Memory information of a process • Base register, Limit register, page table, segment table • Accounting information • CPU usage time, Process ID, Time slice • I/O status information • List of open files=> file descriptors • Allocated devices

  5. A Typical Entry

  6. Process Representation in Linux • Process is represented by a task_struct  data structure

  7. Its fields can be divided into a number of functional areas: • State • Running: either running or is ready to run • Waiting: waiting for an event or for a resource • Stopped: stopped, usually by receiving a signal • Zombie: halted process which, still has a task_struct  • Scheduling Information • Identifiers: each process has process identifier • Inter-Process Communication • classic Unix IPC mechanisms of signals, pipes and semaphore

  8. Links: • Times and Timers • File system: keep track of files opened by process • Virtual memory: must track how that virtual memory is mapped

  9. Context Switch • Procedure of storing the state of an active process for the CPU when it has to start executing a new one.

  10. Context Switch

  11. Context switch is essential feature of a multitaskingoperating system. • usually computationally intensive • Time dependent on hardware support • Some hardware provides multiple sets of registers per CPU -> multiple contexts loaded at once

  12. Process Scheduling • requirement for most modern systems to perform: • multitasking(executing more than one process at a time) • multiplexing(transmit multiple data streams simultaneously across a single physical channel).

  13. Performance Metrics • Throughput: The total number of processes that complete their execution per time unit. • Latency: • Turnaround time: total time between submission of a process and its completion. • Response Time: amount of time it takes from when a request was submitted until the first response is produced. • Fairness: Equal CPU time to each process (or more generally appropriate times according to each process' priority and workload). • Waiting Time: The time the process remains in the ready queue.

  14. A Queing Representation

  15. Queing • A new process is initially put in the ready queue. It waits there until it is selected for execution, or is dispatched. Once the process is allocated the CPU and is executing, one of several events could occur: • The process could issue an I/O request and then be placed in an I/O queue. • The process could create a new sub-process and wait for the sub-process's termination. • The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue. • A process continues this cycle until it terminates, at which time it is removed from all queues and has its PCB and resources de-allocated.

  16. Types of Schedulers • Long Term Scheduler • It is also called job scheduler. • determines which programs are admitted to the system for processing. • selects processes from the queue and loads them into memory for execution. • provide a balanced mix of jobs, such as I/O bound and processor bound. • Short Term Scheduler • also called CPU scheduler. • change of ready state to running state of the process. • also known as dispatcher, execute most frequently and makes the fine grained decision of which process to execute next. • faster than long term scheduler.

  17. Dispatcher • gives control of the CPU to the process selected by the short-term scheduler. • This function involves the following: • Switching context • Switching to user mode • Jumping to the proper location in the user program to restart that program. • Dispatcher Latency: amount of time it takes for a system to respond to a request for a process to begin operation. • With a scheduler written specifically to honor application priorities, real-time applications can be developed with a bounded dispatch latency.

More Related