priority present1

Upload: opie-upie

Post on 04-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Priority PRESENT1

    1/8

    PRIORITYSCHEDULING

    NUR SYAHIRAH F2004

    NUR AQILAH F2018

    MUHAMMAD AFIQ F2019

  • 8/13/2019 Priority PRESENT1

    2/8

    Priority Scheduling

    The SJF algorithm is a special case of thegeneral priority scheduling algorithm

    A priority number (integer) is associatedwith each process

    The CPU is allocated to the process with

    the highest priority (smallest integer =highest priority)

    Priority scheduling can be eitherpreemptive or non-preemptive

  • 8/13/2019 Priority PRESENT1

    3/8

    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

  • 8/13/2019 Priority PRESENT1

    4/8

    Pre-emptive priority

    processes in highest priority queue alwaysget run first

    those in lower priority queues alwayswait

    starvationlikely

    Problem: Starvation

    low priority processes may never execute.

    Solution: Aging

    as time progresses increase the priority of the process.

  • 8/13/2019 Priority PRESENT1

    5/8

    Non-Pre-Emptive Priority

    higher priority processes still favored but not exclusively

    every so often, take a process from a lower priority queue apriority ratio table(used in EMAS medium-term scheduling)

    1 2 1 3 1 2 1 4 1 2 1 3 1 2 1

    make priorities dynamic lower a processes priority after each time it has been run for a quantum used in Windows NT

    process given an initial boost in priority, then gradual decay

    favors short interactions

    boost a processes priority if it has not had a go on the CPU lately

    prioritypurchase ?

    a user may wish topaymore to get better service whether funny money i.e. computing time allocations, or real money

    Higher and lower priority bands kernel processes v. background job stream

    real-time processes (NT)

  • 8/13/2019 Priority PRESENT1

    6/8

    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.

  • 8/13/2019 Priority PRESENT1

    7/8

    When you set a 100 CPU program to real-timepriority, you get what you asked for

    Real-time priority is really dangerous. It's higher priority than nearly everything else. It's higherpriority than mouse input, keyboard input, and the disk cache. If you foolishly set the priority classof a CPU-intensive program to real-time, it will suck up your entire processor, leaving no cycles foranything 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 thoseapplications are themselves not running with real-time priority, so all that happens is that yourinput gets quickly transferred to the input queues, where it then sits waiting for the applications toprocess them (which will never happen since the applications are not running with high enoughpriority).

    One might argue that Task Manager should run with real-time priority, so it can extricate you fromthis situation, but that won't help, and it would be wrong. It won't help because you first need to beable to launch Task Manager (or switch to it, if you were prescient enough to have it alreadyrunning), and none of the ways of launching Task Manager run with real-time priority. (Becausenothing in the user interface runs with real-time priority.)

  • 8/13/2019 Priority PRESENT1

    8/8

    Second, even if there were a special code path that enabled you to launchTask Manager at real-time priority, it would be wrong, because the factthat Task Manager is running with real-time priority means that it is nowstealing CPU cycles from that other process which set itself to real-timepriority, which defeats the purpose of that process setting itself to real-time priority in the first place: It set itself to real-time priority because itdidn't want anybody stealing CPU time from it!

    What could be done is to have Task Manager display an extra warningdialog when somebody uses it to change a process's priority. The warningdialog would say something like "Fiddling with priority can result in youbeing totally screwed. Are you sure you want to take this risk?" (Oh wait,that dialog box already exists.) Our friend Igor probably clicked right onpast that warning dialog, because he's thinking, "Of course I want to set itto real-time priority, you stupid program, that's why I clicked Real-TimePriority! 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 userslike me, throwing up frustrating obstacles which prevent me from gettingthings done."