Real Time Operating System

Real Time Operating System

?? What is the difference between bare metal and an OS? ?

?? Bare metal is like a super loop inside which there is a piece of code. An OS is a software layer between the application layer and hardware and performs many oparation such as task scheduling , memory management,I/O system management,system protection ,ets

?? What is the Hypervisor in embedded systems? ?

It is a software layer that manages different cores in the same SOC. to operates different OSs by putting the entry of each OS to the entry point of its core.

?? What is the kernel? ?

The kernel is the smallest portion of the OS and performs the following functions:

?? Scheduler: Determines which task should run.

?? Dispatcher: Makes the process for the task scheduler.

?? Intertask: Mechanism for data transfer between tasks.

?? What are the types of operating systems? ?

There are two types of operating systems:

?? General-purpose operating system (GPOS): It is a high-performance operating system that is not guaranteed with time but manages to make a lot of features and is often used for desktops like Windows, Linux, iOS, VxWorks, and Android.

?? Real-time operating system (RTOS): This type of OS is guaranteed with time and is used for applications whose performance is affected by any delay. The limitation of time variation can be classified into soft real-time, which has a ±▲t time delay, and hard real-time, whose performance will fail with any time delay. Examples of real-time operating systems include FreeRTOS, QNX, Nucleus, μC, and Keil RTX. Under the RTOS, the unparalleled Automotive company makes a standard for use in the automotive industry called AUTOSAR, which is under the OSEK_VDX unparalleled.

?? What are the characteristics of an RTOS? ?

?? Reliability: An RTOS must be reliable, which means the system must be available without any failure occurring.

?? Predictability: An RTOS must be deterministic with small time variance.

?? Performance: The performance of an RTOS is determined by its speed of response.

?? Compactness: Due to limitations in embedded hardware, an RTOS must be small in size and efficient.

?? Scalability: An RTOS must be able to be used many times in many projects.

?? What is the RTOS scheduling classification? ?

There are two types of scheduling:

?? Offline scheduling: Generates scheduling information before system execution, which means it is not flexible and any change in system parameters will affect the scheduling mechanism.

?? Online scheduling: This type of scheduling occurs during runtime based on priority and can be dynamic, in which the priority may change during the scheduling process, or static, in which the priority is predetermined in the programming state and cannot be changed during runtime. This type may be preemptive, meaning that the high-priority task can interrupt the low-priority task, and if two tasks have the same priority, there are many algorithms used to handle tasks, such as first-come, first-served, shortest job first, but the most popular one is Round Robin.

?? What is a Task? ?

In an RTOS, a task is equivalent to a thread and is implemented in a C function. When creating a task, it is allocated a number of resources by the OS, including a process stack, memory address space, CPU registers, and a program counter. The task thinks it has the CPU to itself.

?? What are the Task states? ?

Task states differ in number and function from one OS to another, but there are some popular states that can be found in all OSs:

?? Ready state: The task is ready to run, but another high-priority task is running.

?? Blocked state: The task is blocked due to an unavailable resource or waiting for a specific time.

?? Running state: The high-priority task is running.

?? Suspend: The task is created but not activated.

?? How to protect data (resources) between tasks from multiple accesses? ?

The way to protect data is by putting it in a critical section using a mutex or semaphore.

?? What is the deadlock problem? ?

?? It is an issue that occurs when task1 acquires mutex1 and task2 acquires mutex2. Then, task1 wants to acquire mutex2 while it has acquired mutex1, which leads to entering a suspended state until task2 releases that mutex. Task2 wants to acquire mutex1 while it has acquired mutex2, which is acquired by task1, leading to entering a suspended state until released by task1. So, the two tasks enter the suspended state (lock each other).

?? What is the priority inversion problem? ?

?? It is an issue that occurs when the low-priority task acquires a mutex, and the high-priority task wants to acquire that mutex. The high-priority task will wait until the low-priority task releases that mutex, which means the low-priority task will have the highest priority.

?? How to protect from priority inversion? ?

?? Priority inheritance protocol: In this solution, the low-priority task inherits the priority from the high-priority task for a specific range of time until it releases the mutex.

?? Priority ceiling: In this solution, the task that acquires the mutex becomes the highest priority until it finishes (it is like assigning priority to the mutex and being the highest priority, and any task that acquires that mutex takes the mutex's priority).

?? How to ask a specific request from the CPU to activate or terminate a task? ?

?? It is done by an exception interrupt (the CPU interrupts itself) SVC handler, which takes a specific number indicating that request.

?? How is the context switching save and restore done when scheduling between tasks? ?

?? It occurs by triggering the PendSV interrupt, which will save and restore the important data needed. In the case of ARM Cortex M3, PendSV saves and restores (R0, R1, R2, R3, R12, PC, LR, XPSR), and to make a correct switch, it should save (R4, R5, R6, R7, R8, R9, R10, R11) manually.

要查看或添加评论,请登录

Ahmed Shaban的更多文章

  • ARM cortex M processor

    ARM cortex M processor

    Hello LinkedIn Today will deep dive in ARM cortex M processor ?? What is the ARM cortex family ? ?? ARM Cortex M: that…

社区洞察

其他会员也浏览了