У нас вы можете посмотреть бесплатно 3 The One Core Illusion или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
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?