Hi,
here is answer from StackOverflow - https://stackoverflow.com/questions/28958389/why-do-rtos-tasks-have-to-be-executed-in-infinite-loop