The 32-bit microcontroller has been increasing in capabilities and decreasing in cost which has resulted in real-time operating systems becoming the dominant scheduler in many embedded systems. While there are more than a hundred different RTOS flavors out on the market, engineers sometimes struggle with basic terminology. Take for example threads and task which under many circumstances are used synonymously yet signify slightly different concepts.
The ThreadX User Guide version 5 defines an embedded task as “a semi-independent portion of the application that carries out a specific duty.” In other words, a task tends to be a high level duty that is carried out by the application. The word task is often used in such a generic way that it can be difficult to determine if a developer is referring to a program segment or a completely separate and loadable program.
A thread on the other hand is defined as “a semi-independent program segment that executes within a process”. For embedded software developers working with microcontrollers, a process is essentially the entire application that runs on the system. A thread is then a small program that has a specific function and purpose within the overall application. Threads tend to be lower level than tasks and have minimal overhead.
Most RTOSes that one encounters are probably actually thread scheduler and not task schedulers but for now many developers just use the terms interchangeably. It’s good to know though that there is a subtle difference.