FreeRTOS - Task Creation and ManagementWhich of the following is the correct syntax to create a FreeRTOS task with a stack size of 128 words?AxTaskCreate(TaskFunction, "TaskName", 128 * sizeof(char), NULL, 1, NULL);BxTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL);CxTaskCreate(TaskFunction, "TaskName", 128 * sizeof(int), NULL, 1, NULL);DxTaskCreate(TaskFunction, "TaskName", 128 / sizeof(int), NULL, 1, NULL);Check Answer
Step-by-Step SolutionSolution:Step 1: Recall FreeRTOS stack size parameter meaningThe stack size parameter is the number of words, so 128 means 128 words.Step 2: Check syntax correctnessxTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL); passes 128 directly, which is correct. Multiplying by sizeof(int) or dividing is incorrect.Final Answer:xTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL); -> Option BQuick Check:Stack size param = number of words, no sizeof needed [OK]Quick Trick: Pass stack size as word count, no sizeof multiplication [OK]Common Mistakes:Multiplying stack size by sizeof(int)Dividing stack size by sizeof(int)Using bytes instead of words
Master "Task Creation and Management" in FreeRTOS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More FreeRTOS Quizzes RTOS Fundamentals - FreeRTOS architecture overview - Quiz 9hard RTOS Fundamentals - FreeRTOS architecture overview - Quiz 12easy RTOS Fundamentals - Task states (Ready, Running, Blocked, Suspended) - Quiz 3easy Task Creation and Management - xTaskCreate() function - Quiz 4medium Task Creation and Management - Multiple tasks running concurrently - Quiz 11easy Task Creation and Management - Task function signature - Quiz 7medium Task Scheduling - Priority-based scheduling - Quiz 2easy Task Scheduling - Time-slicing for equal priority tasks - Quiz 2easy Task Scheduling - vTaskDelay() for periodic tasks - Quiz 4medium Task Scheduling - Why scheduling determines real-time behavior - Quiz 5medium