Книга: Distributed operating systems
9.2.3. Scheduling
9.2.3. Scheduling
CPU scheduling is done using priorities on a per-thread basis. Each process has a priority and each thread has a relative priority within its process. The absolute priority of a thread is the sum of its process' priority and its own relative priority. The kernel keeps track of the priority of each thread in ACTIVE state and runs the one with the highest absolute priority. On a multiprocessor with k CPUs, the k highest-priority threads are run.
However, to accommodate real-time processes, an additional feature has been added to the algorithm. A distinction is made between threads whose priority is above a certain level and threads whose priority is below it. High-priority threads, such as A and B in Fig. 9-7(a), are not timesliced. Once such a thread starts running, it continues to run until either it voluntarily releases its CPU (e.g., by blocking on a semaphore), or an even higher priority thread moves into the ACTIVE state as a result of I/O completing or some other event happening. In particular, it is not stopped just because it has run for a long time.
Fig. 9-7. (a) Thread A will be run until it is finished or it blocks. (b)-(c) Threads C and D will alternate, in round robin mode.
In contrast, in Fig. 9-7(b), thread C will be run, but after it has consumed one quantum of CPU time, it will be put on the end of the queue for its priority, and thread D will be given one quantum. In the absence of competition for the CPU, they will alternate indefinitely.
This mechanism provides enough generality for most real-time applications. System calls are available for changing process and thread priorities, so applications can tell the system which threads are most important and which are least important. Additional scheduling algorithms are available to support System V real-time and system processes.
- Scheduling Tasks
- Using Priority Scheduling and Control
- Creating and scheduling backups with Wbadmin
- 17.1.3. Linux Scheduling
- 4.4. SCHEDULING IN DISTRIBUTED SYSTEMS
- 4.6.4. Real-Time Scheduling
- 8.2.3. Scheduling
- 10.2.2. Scheduling
- Scheduling and prioritizing print jobs
- Scheduling the printing of individual documents
- 4.4.5 Scheduling Algorithms
- 5.3 Task States and Scheduling