Vous êtes sur la page 1sur 8

PRIORITY SCHEDULING

NUR SYAHIRAH F2004 NUR AQILAH F2018 MUHAMMAD AFIQ F2019

Priority Scheduling
The SJF algorithm is a special case of the general priority scheduling algorithm A priority number (integer) is associated with each process The CPU is allocated to the process with the highest priority (smallest integer = highest priority) Priority scheduling can be either preemptive or non-preemptive

Priority Scheduling
Each process is assigned a priority and the runnable process with the highest priority is allowed to run To prevent high-priority processes from running indefinitely, the scheduler may decrease the priority of currently running process at each clock tick. I/O bound processes are given highest priority

Pre-emptive priority
processes in highest priority queue always get run first those in lower priority queues always wait starvation likely Problem: Starvation low priority processes may never execute. Solution: Aging as time progresses increase the priority of the process.

Non-Pre-Emptive Priority
higher priority processes still favored but not exclusively every so often, take a process from a lower priority queue make priorities dynamic
a priority ratio table (used in EMAS medium-term scheduling) 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1

lower a processes priority after each time it has been run for a quantum used in Windows NT boost a processes priority if it has not had a go on the CPU lately a user may wish to pay more to get better service
whether funny money i.e. computing time allocations, or real money process given an initial boost in priority, then gradual decay favors short interactions

priority purchase ?

Higher and lower priority bands

kernel processes v. background job stream real-time processes (NT)

Set Priority
Two approaches - Static (for system with well know and regular application behaviors) - Dynamic (otherwise) Priority may be based on: - Cost to user - Importance of user - Aging - Percentage of CPU time used in last hours.

When you set a 100% CPU program to real-time priority, you get what you asked for
Real-time priority is really dangerous. It's higher priority than nearly everything else. It's higher priority than mouse input, keyboard input, and the disk cache. If you foolishly set the priority class of a CPU-intensive program to real-time, it will suck up your entire processor, leaving no cycles for anything else. In particular, since not even input runs at real-time priority, you can't stop it via any interactive means, because the thread that manages input can't even run to process your input.

Mind you, even if the input thread did run at real-time priority, that wouldn't really help you any. Sure, it could receive your input and distribute it to the appropriate application queues, but those applications are themselves not running with real-time priority, so all that happens is that your input gets quickly transferred to the input queues, where it then sits waiting for the applications to process them (which will never happen since the applications are not running with high enough priority).
One might argue that Task Manager should run with real-time priority, so it can extricate you from this situation, but that won't help, and it would be wrong. It won't help because you first need to be able to launch Task Manager (or switch to it, if you were prescient enough to have it already running), and none of the ways of launching Task Manager run with real-time priority. (Because nothing in the user interface runs with real-time priority.)

Second, even if there were a special code path that enabled you to launch Task Manager at real-time priority, it would be wrong, because the fact that Task Manager is running with real-time priority means that it is now stealing CPU cycles from that other process which set itself to real-time priority, which defeats the purpose of that process setting itself to realtime priority in the first place: It set itself to real-time priority because it didn't want anybody stealing CPU time from it!
What could be done is to have Task Manager display an extra warning dialog when somebody uses it to change a process's priority. The warning dialog would say something like "Fiddling with priority can result in you being totally screwed. Are you sure you want to take this risk?" (Oh wait, that dialog box already exists.) Our friend Igor probably clicked right on past that warning dialog, because he's thinking, "Of course I want to set it to real-time priority, you stupid program, that's why I clicked Real-Time Priority! This is another in a long string of examples of how Windows is one of those coddling operating systems that gets in the way of advanced users like me, throwing up frustrating obstacles which prevent me from getting things done."

Vous aimerez peut-être aussi