Complete the code to create two tasks with equal priority in FreeRTOS.
xTaskCreate(task1, "Task1", 1000, NULL, [1], NULL);
Priority 1 is assigned to the task, which is a common base priority for equal priority tasks.
Complete the code to start the FreeRTOS scheduler after creating tasks.
vTaskStart[1]();The function vTaskStartScheduler() starts the FreeRTOS scheduler to begin task switching.
Fix the error in the task function to allow time-slicing by yielding the processor.
void task1(void *pvParameters) {
for(;;) {
// Task code here
[1]();
}
}Calling taskYIELD() inside a task allows the scheduler to switch to another task of equal priority, enabling time-slicing.
Fill both blanks to create two tasks with equal priority and start the scheduler.
xTaskCreate(task1, "Task1", 1000, NULL, [1], NULL); xTaskCreate(task2, "Task2", 1000, NULL, [2], NULL); vTaskStartScheduler();
Both tasks must have the same priority number (1) to enable time-slicing between them.
Fill all three blanks to create a task that yields, create two equal priority tasks, and start the scheduler.
void task1(void *pvParameters) {
for(;;) {
// Task code
[1]();
}
}
xTaskCreate(task1, "Task1", 1000, NULL, [2], NULL);
xTaskCreate(task2, "Task2", 1000, NULL, [3], NULL);
vTaskStartScheduler();The task calls taskYIELD() to allow time-slicing. Both tasks have priority 1 to share CPU time equally. The scheduler is started to begin multitasking.