Operating System Fundamentals
49 An operating system could allow the process itself
to pick its own priority, or the priority could be picked by the operating system. In some operating systems, priorities are simply low, medium or high.
In other operating systems, the priorities maybe arranged between 0 and 255 with 0 being the highest and 255 being the lowest (the meanings could be reversed with a larger number being higher in priority. What do we do if there are two processes with the same priority The usual implementation is to utilize round-robin scheduling for all processes that are of equal priority. When a process is put into the Run state, it will get to run until one of the following things happens
1.
it finishes,
2. it blocks,
3. a higher priority process becomes ready. What if the process never blocks or finishes Then the process gets to monopolize the CPU and never allows any other process to run. When a process never gets to run because a high priority process is using all of the time,
it is called starvation. Starvation is a danger of any operating system relying on priorities for scheduling and it requires careful programming to ensure that it does not happen. You maybe wondering how a higher priority process would ever become ready if another process is running all of the time. As long as the currently running process eventually waits or gives a semaphore that the higher priority process is waiting for, then the high priority process gets to run. Inmost operating systems, processes started by the user (application)
are assigned the same priority, and generally the processes created by the operating system are provided a higher priority so that the developers do no need to worry about this aspect. In the Windows Task manager, it is possible to change the priority of the processes. Linux also allows for the user to lower the priority of a process.
Share with your friends: