Você está na página 1de 6

Systems consist of a collection of processes. OS processes execute system code, and user processes execute user code.

How convert a program into a process? By double clicking on it or by running a.out

Processes may be in one of 5 states:


New - The process is in the stage of being created. Ready - The process has all the resources available that it needs to run, but the CPU is not currently working on this process's instructions. Running - The CPU is working on this process's instructions. Waiting - The process cannot run at the moment, because it is waiting for some resource to become available or for some event to occur. For example the process may be waiting for keyboard input, disk access request, inter-process messages, a timer to go off, or a child process to finish. Terminated - The process has completed.

Types of Scheduling
Long-term scheduling The decision to add to the pool of processes to be executed Medium-term scheduling The decision to add to the number of processes that are partially or fully in main memory Short-term scheduling The decision as to which available process will be executed by the processor I/O scheduling The decision as to which processs pending I/O request shall be handled by an available I/O device

Turnaround Time (TAT) is the residence time Tr , or total time that the item spends in the system (waiting time plus service time). A more useful figure is the normalized turnaround time, which is the ratio of turnaround time to service time. Nonpreemptive: In this case, once a process is in the Running state, it continues to execute until (a) it terminates or (b) it blocks itself to wait for I/O or to request some OS service. Preemptive: The currently running process may be interrupted and moved to the Ready state by the OS. The decision to preempt may be performed when a new process arrives; when an interrupt occurs that places a blocked process in the Ready state; or periodically, based on a clock interrupt. Priority based scheduling requires preemption.

What is the average waiting time in the above example in case of FCFS? FIRST-COME-FIRST-SERVED The simplest scheduling policy is first-come-first served (FCFS), also known as first-in-first-out (FIFO) or a strict queueing scheme. As each process becomes ready, it joins the ready queue. When the currently running process ceases to execute, the process that has been in the ready queue the longest is selected for running. FCFS performs much better for long processes than short ones.

Setting a processes priority


Unix attempts to manage priority by giving those who have used the least access first. In addition, those users who are sleeping on an event (e.g. such as a keyboard press) get higher priority than those jobs that are purely CPU driven. Unix provides the command nice to lower the priority of a process.

Priority Inversion
Priority inversion is a problematic scenario in scheduling when a higher priority task is indirectly preempted by a lower priority task effectively "inverting" the relative priorities of the two tasks.

Solution to Priority Inversion


Research on priority inversion has yielded two solutions: The first is called priority inheritance. This technique mandates that a lower-priority task inherit the priority of any higher-priority task pending on a resource they share. This priority change should take place as soon as the high-priority task begins to pend; it should end when the resource is released. This requires help from the operating system. The second solution, priority ceilings, associates a priority with each resource; the scheduler then transfers that priority to any task that accesses the resource. The priority assigned to the resource is the priority of its highest-priority user, plus one. Once a task finishes with the resource, its priority returns to normal.

References: 1 http://www.embedded.com/electronics-blogs/beginner-scorner/4023947/Introduction-to-Priority-Inversion http://research.microsoft.com/enus/um/people/mbj/mars_pathfinder/authoritative_account.html 2 http://en.wikipedia.org/wiki/Executable_and_Linkable_Format 3 Operating Systems Internals and Design Principles: Seventh Edition, William Stallings Chapter 9 Uniprocessor Scheduling https://www.cs.drexel.edu/~wmm24/cs370/resources/Scheduler.pdf

Você também pode gostar