ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

3 The One Core Illusion

Автор: ROBOTECH

Загружено: 2026-02-11

Просмотров: 42

Описание: This transcript explains the fundamental mechanics of task scheduling within a Real-Time Operating System, specifically focusing on FreeRTOS. It describes how a scheduler uses periodic hardware interrupts, known as ticks, to manage multiple threads by allocating processor time based on assigned priorities. The text details various task conditions—including ready, running, blocked, and suspended—and explains how context switching allows the system to save and resume a task's progress. Furthermore, it clarifies preemptive scheduling, where higher-priority operations or hardware interrupts can interrupt ongoing tasks to ensure time-sensitive execution. The source concludes with a practical demonstration on an ESP32, illustrating how developers can manipulate task states and observe real-time interaction between concurrent processes.

This video provides a detailed look at how the scheduler functions in an RTOS, specifically focusing on FreeRTOS on hardware like the ESP32. While we write code that looks like multiple loops running at once, a single-core microcontroller must divide its time among these tasks through a process called time slicing.

The Role of the Scheduler and the "Tick"

The scheduler is a piece of the operating system that runs at regular intervals to decide which task should execute next.

• The Tick: Most RTOS implementations, including FreeRTOS, use a hardware timer to interrupt the processor at regular intervals, commonly every 1 millisecond. This interval is known as a tick,.
• Priority-Based Selection: At every tick, the scheduler examines all tasks in the "ready" state and chooses the one with the highest priority.
• Round-Robin Scheduling: If multiple tasks share the same high priority, the scheduler alternates between them in a "round-robin" fashion, giving each a turn during successive ticks.

Task States and Transitions

The scheduler maintains a record of each task's state to manage execution efficiently:
• Ready: The task is prepared to run but is waiting for the scheduler to pick it.
• Running: The task is currently using the processor. On a single-core system, only one task can be in this state at a time.
• Blocked: The task is waiting for an event, such as a timer expiring (vTaskDelay) or a semaphore becoming available. Blocked tasks do not consume CPU time.
• Suspended: Similar to the blocked state, but a task only enters or leaves this state through explicit API calls like vTaskSuspend and vTaskResume. This is essentially a way to put a task to "sleep" indefinitely.

Context Switching

When the scheduler switches from one task to another, it performs a context switch. This involves saving the current task’s "context"—its position in the program (instruction pointer), working variables in RAM, and CPU registers—and restoring the context of the next task. This information is typically stored in the stack memory allocated to that specific task.
Preemption and Interrupts
The scheduler uses pre-emptive scheduling, meaning it can forcibly take CPU time away from a lower-priority task to give it to a higher-priority one.

• Hardware Interrupts: These operate outside the standard task priority system. Unless specifically disabled in code, a hardware interrupt will always have a higher priority than any software task.
• Nested Interrupts: Depending on the hardware, one interrupt may even preempt another "nested" interrupt, though it is generally recommended to keep Interrupt Service Routines (ISRs) as short as possible.
Multi-Core Considerations

On multi-core systems, such as the ESP32, the scheduler has the added flexibility of running tasks simultaneously on separate cores,. While this allows for true parallel execution, it can make debugging and task management more complex, so many beginners start by pinning tasks to a single core to observe predictable preemption behavior,.

Practical Example and Challenge

The sources describe an experiment where a high-priority task prints asterisks while a low-priority task prints a sentence. Because of preemption, the asterisks appear in the middle of the sentence, demonstrating that the high-priority task interrupted the lower one mid-execution.
To practice these concepts, the video suggests a challenge: create a program with two tasks where one task monitors the serial terminal for user input (a number) and updates the blinking rate of an LED controlled by the second task,. This demonstrates a simple user interface running independently of the hardware control logic.


What happens if the scheduler runs out of memory for tasks?

How do hardware interrupts bypass the standard task priority system?

Could you explain the risks of deleting tasks with vTaskDelete?

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
3   The One Core Illusion

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

4  RTOS Memory Management

4 RTOS Memory Management

Надоели файлы? Вот, пожалуйста, сокеты • C • Live coding

Надоели файлы? Вот, пожалуйста, сокеты • C • Live coding

2026 03 01 Week 3 - Session 2 TDS Jan 2026

2026 03 01 Week 3 - Session 2 TDS Jan 2026

Вся IT-база в ОДНОМ видео: Память, Процессор, Код

Вся IT-база в ОДНОМ видео: Память, Процессор, Код

Как Сделать Настольный ЭЛЕКТРОЭРОЗИОННЫЙ Станок?

Как Сделать Настольный ЭЛЕКТРОЭРОЗИОННЫЙ Станок?

Claude Code: Настройка, которая делает его в 10 раз полезнее

Claude Code: Настройка, которая делает его в 10 раз полезнее

Музыка для работы за компьютером | Фоновая музыка для концентрации и продуктивности

Музыка для работы за компьютером | Фоновая музыка для концентрации и продуктивности

ИИ-Агент OpenClaw

ИИ-Агент OpenClaw "атаковал" человека, COBOL всё, Кнопочные телефоны возвращаются | Как Там АйТи #88

Фильм Алексея Семихатова «ГРАВИТАЦИЯ»

Фильм Алексея Семихатова «ГРАВИТАЦИЯ»

1 What is an RTOS

1 What is an RTOS

Токенизация за 20 минут: от «что это?» до собственного токенизатора

Токенизация за 20 минут: от «что это?» до собственного токенизатора

PRO СВЕРЛЕНИЕ! Весь курс университета за 32 минуты!

PRO СВЕРЛЕНИЕ! Весь курс университета за 32 минуты!

Так из чего же состоят электроны? Самые последние данные

Так из чего же состоят электроны? Самые последние данные

Как защитить API: Уязвимости и решения

Как защитить API: Уязвимости и решения

Как поймать гравитон? Учёные придумали способ узнать, является ли гравитация силой!

Как поймать гравитон? Учёные придумали способ узнать, является ли гравитация силой!

Доведение моделирования до предела возможностей для поиска порядка в хаосе.

Доведение моделирования до предела возможностей для поиска порядка в хаосе.

Архитектура интернета и веба | Теоретический курс 2026

Архитектура интернета и веба | Теоретический курс 2026

Учебное пособие по Amazon Bedrock AgentCore | Создание, развертывание и эксплуатация ИИ-агентов с...

Учебное пособие по Amazon Bedrock AgentCore | Создание, развертывание и эксплуатация ИИ-агентов с...

99% ЛЮДЕЙ НЕ ГОТОВЫ К 2028 (1% посмотрит это видео)

99% ЛЮДЕЙ НЕ ГОТОВЫ К 2028 (1% посмотрит это видео)

Как запоминать ВСЕ с помощью Obsidian.md и Zettelkasten

Как запоминать ВСЕ с помощью Obsidian.md и Zettelkasten

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]