인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

rtos

rtos

RTOS Internals

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: rtos description: RTOS Internals

Real-Time Operating Systems (RTOS) Mechanics

Preemptive Scheduling and FreeRTOS Internals

FreeRTOS utilizes a priority-based, preemptive scheduling algorithm. The core data structure is pxReadyTasksLists, an array of List_t structures, one for each priority level up to configMAX_PRIORITIES - 1. The scheduler always selects the highest priority task in the ready state. Context switching is architecture-specific but fundamentally involves saving the CPU context onto the task's stack, updating the TCB (Task Control Block) stack pointer, and restoring the context of the newly selected task via a PendSV handler in ARM Cortex-M architectures.

Priority Inheritance in Mutexes

To prevent priority inversion, FreeRTOS implements priority inheritance for its Mutex objects (which are specialized semaphores). When a high-priority task attempts to acquire a Mutex held by a lower-priority task, the scheduler temporarily elevates the priority of the mutex holder to match the blocked high-priority task. Upon releasing the mutex, the holder's original base priority is restored.

flowchart TD
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
    subgraph SchedulerFreeRTOSScheduler ["FreeRTOS Scheduler<br><br><br>"]
        Tick[SysTick Interrupt] -->|"xTaskIncrementTick()"| UnblockCheck[Check Delayed Lists]
        UnblockCheck -->|"Yield()"| SwitchContext[Context Switch PendSV]
    end
    subgraph TaskStateTaskStateMachine ["Task State Machine<br><br><br>"]
        Running -->|"vTaskDelay()"| Blocked
        Blocked -->|"xSemaphoreGive()"| Ready
        Ready -->|"Schedule()"| Running
    end
저장한 Skills