Scheduling

                        

               Scheduling in Interactive Systems

                   Some algorithms that can be used in interactive systems. All of these can also be used as the CPU scheduler in batch systems as well. While three-level scheduling is not possible here, two-level scheduling (memory scheduler and CPU scheduler) is possible and common. Below we will focus on the CPU scheduler.

Round-Robin Scheduling:

                  One of the oldest, simplest, fairest, and most widely used algorithms is round robin. Each process is assigned a time interval, called its quantum, If the process is still running at the end of the quantum, the CPU is preempted and given to another process. If the process has blocked or finished before the quantum has elapsed, the CPU switching is done when the process blocks, of course. Round robin is easy to implement. 




Scheduling in Real-Time Systems:

                     A real-time system is one in which time plays an essential role. Typically, one or more physical devices external to the computer generate stimuli. If the calculation takes too long, the music will sound peculiar. 

    Real-time systems are generally categorized as hard real time, meaning there are absolute deadlines that must be met, or else, and soft real time, meaning that missing an occasional deadline is undesirable, but nevertheless tolerable. 

Priority Scheduling:

1.Priorities can also be assigned dynamically by the system to achieve certain system goals.     For example, some processes are highly I/O bound and spend most of their time waiting       for  I/O to complete. 

2.Whenever such a process wants the CPU,xdwr3cs  it should be given the CPU immediately, to let it start its next I/O request which can then proceed in parallel with another process actually computing. 

3. Making the I/O bound process wait a long time for the CPU will just mean having it around occupying memory for an unnecessarily long time. 

4.A simple algorithm for giving good service to I/O bound processes is to set the priority, to 1/f, where f is the fraction of the last quantum that a process used.

                           To prevent high-priority processes from running indefinitely, the scheduler may decrease the priority of the currently running process at each clock tick.


                              If this action causes its priority to drop below that of the next highest process, a process switch occurs. Alternatively, each process may be assigned a maximum time quantum that it is allowed to run. When this quantum is used up, the next highest priority process is given a chance to run.