Working on...

your queries, use contact form

3 Feb 2021

Functions of RTOS and scheduling algorithms

Functions of Real time operating systems (RTOS)

a)    Task Management

i.           Multithreading or Multitasking: Most important function of RTOS is it must be able to perform multiple tasks at the same time with proper resource allocation.

ii.      Preemptability – Preempt means to acquire in advance. During multitasking, resources are allotted as per requirement and these resources must be needed to acquire in advance to avoid deadlock or starvation.

iii.       Thread Priority  - Priorities of almost all tasks are decided for smooth functioning

iv.          Inter Task Communication & Synchronization - Multiple tasks will pass the information among each other in a timely fashion to ensure the data integrity.

v.        Short Latencies – Latency means delay. While executing the task, switching the task or execution of interrupt, latencies must be short and predefined.

 

Scheduling algorithm

 

Embedded system is used for specific task/function/application but need to perform more than one task that are related to that particular task. In such a case each task is allotted its resources as per requirement. To allocate the task resources, proper management is needed which is achieved by using different scheduling algorithms.

Scheduling algorithms are employed to minimize the resource starvation. Following are the some scheduling algorithms that are generally used for multitasking.

 

1. First In, First Out

First In, First Out (FIFO) or First Come, First Serve (FCFS) is the scheduling algorithm which works on the principal of queue processing and allocate the resources according to the time and priority. Different variations like Last In First Out (LIFO), First In Last Out (FILO) are also exist where priorities of tasks are different and need to manage as per conditions.

 

2. Shortest Job First

Shortest job next (SJN) or Shortest Job First (SJF) or Shortest Process Next (SPN) is the simple scheduling algorithm which gives priority to the process that needed less time for execution. Advantage of SJN is it is simple in nature and increases process throughput but on the other hand to use SJN effectively, execution of each process must be known and if many processes of short execution time are added continuously, it leads to starvation.

 

3. Fixed-priority pre-emptive scheduling

          This scheduling system ensures that the processor must execute the highest priority task first among all tasks that are currently ready to execute. The main advantage of this scheduling algorithm is it makes sure no task holds the processor for time longer than the given time, but on the counter side it may lockout the process. To rectify this problem, aging method is used which will slowly and steadily increase the process priority for better management of process queue.

 

4. Round-robin scheduling

One of the simplest form of scheduling the task is Round-robin (RR). In this method time slot is assigned to individual process in equal and circular manner without any priority and this process continues until the job finishes and needs no more time.

 

 

5. Multilevel feedback queue

A multilevel feedback queue is a scheduling algorithm designed by considering following requirements.

1. Giving the preference to short jobs.

2. Giving the preference to I/O bound processes.

3. Sorting the processes into categories as per need of the processor.

 

Initially the processes are circulated in round robin fashion till the completion and leave the system. Or, if a process is waiting for I/O, its priority is increased by one level, and placed at the end of the next-higher queue. Generally in this scheduling method, only one chance is given to process to complete otherwise its priority is lowered down.

No comments:

Post a Comment