Time-slicing for equal priority tasks
📖 Scenario: You are working with FreeRTOS, a real-time operating system used in embedded devices. You want to understand how FreeRTOS shares CPU time between tasks that have the same priority. This is called time-slicing.Imagine two simple tasks that both print messages repeatedly. You will set up these tasks and observe how FreeRTOS switches between them to give each a fair share of CPU time.
🎯 Goal: Create two tasks with the same priority in FreeRTOS. Each task will print a message in a loop. You will configure the scheduler to enable time-slicing so both tasks get CPU time fairly. Finally, you will observe the output to see the tasks alternating.
📋 What You'll Learn
Create two tasks named
Task1 and Task2Set both tasks to the same priority level
tskIDLE_PRIORITY + 1Enable time-slicing in the FreeRTOS configuration
Print messages from each task to show they run alternately
💡 Why This Matters
🌍 Real World
Time-slicing is used in embedded systems to ensure multiple tasks with the same priority get CPU time fairly, such as in sensor reading and communication tasks running together.
💼 Career
Understanding time-slicing helps embedded developers design responsive multitasking applications where tasks share CPU time predictably.
Progress0 / 4 steps