⚙️
FreeRTOS Task Visualizer v1.0.0
Speed 6×
Tasks
Try it: drag the sliders, use ⏭ Tick to step 1 ms at a time, or switch a task off with its toggle.
States:
RUNNING — using CPU now
READY — waiting for CPU
BLOCKED — inside vTaskDelay()
SUSPENDED — task switched off
UPTomar · SDC
CPU Core
💤
Idle
all tasks blocked
t = 0 ms  |  tick = 0
0
System Ticks (1 ms each)
⚙ Scheduler
Press ▶ Play to start. The scheduler will decide which task runs next.
🔀 Task State Diagram hover = explain · click a task = follow it
Event Log
0 ms
Simulation ready. Press ▶ Play to begin.
Logic Analyser — Task Timeline
Running
Ready
Blocked
Suspended

📖 User Manual · Manual de utilização

What is this?

An interactive simulation of the FreeRTOS scheduler running four tasks on a single CPU core. Time is virtual: 1 tick = 1 ms. Each task runs for a short burst (Run), then calls vTaskDelay() and sleeps (Delay). Priorities decide who gets the CPU.

Top bar

  • ▶ Play / ⏸ Pause — start or pause the simulation.
  • ⏭ Tick — advance exactly one tick (pauses first if running). Ideal to follow the scheduler's decisions one at a time.
  • ↺ Reset — back to t = 0. Your sliders and on/off switches are kept.
  • Speed 1×–20× — from 2 up to 5000 ticks per second (shown next to the slider). Use low values to understand, high values to watch long-term behaviour.

Tasks panel (left)

  • On/off switch — suspends the task (vTaskSuspend) or resumes it (vTaskResume). A suspended task is never scheduled.
  • Priority (1–5, higher wins) · Delay (ms spent BLOCKED after each run) · Run (ms of CPU needed per run). Changes take effect immediately.
  • Counters show runs, % of time blocked, and each task's own output (LED, serial messages, temperature, button presses). The blue bar is the remaining delay.

Task states

  • RUNNING — using the CPU (only one at a time).
  • READY — able to run, waiting for the CPU.
  • BLOCKED — waiting for the delay/event; uses no CPU.
  • SUSPENDED — switched off until resumed.

Centre panel

  • CPU core shows who ran in the last tick (or Idle). Scheduler explains its latest decision and lists the ready queue.
  • Task State Diagram — adaptation of the FreeRTOS valid task state transitions. Each numbered dot is a task; it travels along the arrow of every transition, and the arrow lights up in the task's colour. ×N counts how many times each transition happened.
    • Hover a state or an arrow to read what it means.
    • Click a dot (or a name in the legend) to follow one task; click again to release it.
    • Hover an Event Log entry to highlight its arrow in the diagram.

Event Log & Timeline

  • The Event Log (right) lists every transition with its time stamp. It is generated by the same events as the diagram, so both always agree.
  • The Logic Analyser (bottom) shows each task's state over time: green = running, amber = ready, blue = blocked, grey = suspended. Use the window selector (100 ms – 5 s) to zoom — short windows are best with ⏭ Tick.

Scheduling rules used

  • The scheduler always picks the highest-priority READY task.
  • A task that becomes READY with a higher priority preempts the running one (Running → Ready); the preempted task keeps its remaining work.
  • Equal priorities: no time slicing — the running task keeps the CPU until it blocks; the next one is the task that ran longest ago (round-robin).

Things to try

  • Set Speed to 1× and press ⏭ Tick repeatedly during the first 20 ticks to see how the four tasks take turns.
  • Give TaskSerial a long Run (20 ms) and watch TaskButton (priority 3) preempt it.
  • Set all priorities equal and observe the round-robin order.
  • Switch tasks off one by one and see the CPU become idle.

O que é isto?

Uma simulação interativa do escalonador do FreeRTOS com quatro tarefas num único núcleo de CPU. O tempo é virtual: 1 tick = 1 ms. Cada tarefa executa durante um curto período (Run), depois chama vTaskDelay() e adormece (Delay). As prioridades decidem quem fica com o CPU.

Barra superior

  • ▶ Play / ⏸ Pause — inicia ou pausa a simulação.
  • ⏭ Tick — avança exatamente um tick (pausa primeiro, se estiver a correr). Ideal para seguir as decisões do escalonador uma a uma.
  • ↺ Reset — volta a t = 0. Os sliders e os interruptores mantêm-se.
  • Speed 1×–20× — de 2 a 5000 ticks por segundo (indicado junto ao slider). Valores baixos para compreender, valores altos para ver o comportamento a longo prazo.

Painel de tarefas (esquerda)

  • Interruptor — suspende a tarefa (vTaskSuspend) ou retoma-a (vTaskResume). Uma tarefa suspensa nunca é escalonada.
  • Priority (1–5, maior ganha) · Delay (ms em BLOCKED após cada execução) · Run (ms de CPU necessários por execução). As alterações têm efeito imediato.
  • Os contadores mostram as execuções, a % de tempo bloqueada e a saída de cada tarefa (LED, mensagens série, temperatura, pressões do botão). A barra azul é o atraso restante.

Estados das tarefas

  • RUNNING — a usar o CPU (só uma de cada vez).
  • READY — pronta para executar, à espera do CPU.
  • BLOCKED — à espera do atraso/evento; não usa CPU.
  • SUSPENDED — desligada até ser retomada.

Painel central

  • O CPU Core mostra quem executou no último tick (ou Idle). O Scheduler explica a sua última decisão e lista a fila de prontas.
  • Task State Diagram — adaptação do diagrama valid task state transitions do FreeRTOS. Cada bolinha numerada é uma tarefa; desloca-se ao longo da seta de cada transição, e a seta acende com a cor da tarefa. ×N conta quantas vezes ocorreu cada transição.
    • Passar o rato sobre um estado ou seta explica o seu significado.
    • Clicar numa bolinha (ou num nome da legenda) segue uma só tarefa; clicar de novo liberta-a.
    • Passar o rato numa entrada do Event Log realça a respetiva seta no diagrama.

Event Log e Timeline

  • O Event Log (direita) lista cada transição com o instante em que ocorreu. É gerado pelos mesmos eventos do diagrama, por isso ambos estão sempre de acordo.
  • O Logic Analyser (em baixo) mostra o estado de cada tarefa ao longo do tempo: verde = running, âmbar = ready, azul = blocked, cinzento = suspended. Use o seletor window (100 ms – 5 s) para ampliar — janelas curtas funcionam melhor com ⏭ Tick.

Regras de escalonamento usadas

  • O escalonador escolhe sempre a tarefa READY de maior prioridade.
  • Uma tarefa que fica READY com prioridade superior faz preempção da que está a executar (Running → Ready); a tarefa interrompida mantém o trabalho que lhe falta.
  • Prioridades iguais: sem time slicing — a tarefa em execução mantém o CPU até bloquear; segue-se a que executou há mais tempo (round-robin).

Experiências sugeridas

  • Coloque Speed em 1× e carregue em ⏭ Tick durante os primeiros 20 ticks para ver como as quatro tarefas se revezam.
  • Dê à TaskSerial um Run longo (20 ms) e veja a TaskButton (prioridade 3) fazer preempção.
  • Ponha todas as prioridades iguais e observe a ordem round-robin.
  • Desligue as tarefas uma a uma e veja o CPU ficar em idle.
FreeRTOS Task Visualizer — Manuel Barros · SDC2026 · Universidade Politécnica de Tomar (UPTomar)