Processes and Context Switching

Engineering world
0

 PROCESSES AND CONTEXT SWITCHING:

 

The best way to understand processes and context is to dive into an RTOS implementation. We will use the FreeRTOS.org kernel as an example; in particular, we will use version 4.7.0 for the ARM7 AT91 platform. A process is known in FreeRTOS.org as a task. Task priorities in FreeRTOS.org are ranked opposite to the convention we use in the rest of the book: higher numbers denote higher priorities and the priority 0 task is the idle task.



To understand the basics of a context switch, let’s assume that the set of tasks is in steady state:

Everything has been initialized, the OS is running, and we are ready for a timer interrupt. Figure 3.4 shows a sequence diagram for a context switch in freeRTOS.org. This diagram shows the application tasks, the hardware timer, and all the functions in the kernel that are involved in the context switch:

 

vPreemptiveTick () is called when the timer ticks.

 

portSAVE_CONTEXT() swaps out the current task context..

 

vTaskSwitchContext ( ) chooses a new task.

 

portRESTORE_CONTEXT() swaps in the new context

Post a Comment

0Comments
Post a Comment (0)