Operating systems have
In this Answer, we will discuss two approaches that use multiprocessors to delegate tasks.
The
The diagram above shows a single CPU system based on the SQMS.
The example above shows a situation where we have three CPUs available. The policy will pick the top three best tasks and assign each to each CPU.
The
This policy works by first placing each task dequeued from the global queue into one CPU queue depending on some heuristic like random allotment or based on the remaining capacity of each queue. Then, it is scheduled independently to prevent problems such as information sharing and synchronization.
The diagram above shows an example of tasks A, B, C, and D dequeued, and two CPUs are available. Each CPU is assigned a task based on the capacity heuristic.
Now that we know what each scheduling policy is, we can discuss the differences and limitations of each.
SQMS | MQMS |
All tasks are placed into queues without any distinction. | Tasks are assigned based on categories such as priority, type, or other categories. |
The same scheduling algorithm is applied to all queues. | Different queues can have different tasks based on characteristics. |
All tasks inside queues are given the same priority. | Preferential treatment is given based on task priority. |
Resource allocation is not optimal due to locking for SQMS code accesses. | Better resource allocation due to multi-queue structure. |
Simpler to implement and manage. | More complex due to its structure. |
Not scalable due to queue bottlenecks. | Scalable due to better parallelism and distributed structure. |
Difficult to properly load balance. | Load balancing is inherently easier. |
Difficult to manage fairness between tasks. | Provides easier fairness due to priorities. |
Long running tasks can reduce responsiveness. | Maintains responsiveness through preferential treatment. |
To conclude, we can summarize that the choice between SQMS and MQMS depends on the requirements, as both policies provide a good solution to their respective issues. However, we can generalize that for systems where all tasks are equally important and require a simple structure, SQMS is the suitable option. In contrast, MQMS is suitable when we require better control and optimization for our system where all tasks are unequal.
Free Resources