 Let's focus shortly on the main terms with operating systems, what are the main components of operating system? The basic ones, the basic bricks are the tasks or threads, those are the mini-programs run in endless loop, which are performed by some particular actions, so those are the main components of operating system. To manage the tasks, to manage the switching between the tasks, we need a scheduler, so this is the heart of the operating system and it is managing the operation of the tasks under components. To pass the information among the tasks, we can use queues, so queues are the components which allow us to pass the information from one task to the other, or between the interrupt and the task. Some special version of the queue is a semaphore. We can call it as a queue with one component of type on-off, and again it can be used between the tasks or between the tasks and the interrupt. And again, some special version of semaphore is a mutex. Mutex is a semaphore, we can tell that mutex is a semaphore with a token. And last but not least, software timers, which allow us to extend the existing hardware timers group, which we've got within the MCU, and those software timers help us to manage the task execution in some particular moments. This list is not full, there are more components which we will describe more further within this training session, but those are the main ones visible almost all of the application based on 3R2S. What is a task? A task or threat is a C function which should be run with an infinite loop, like we see it on the screen. We can call it as a mini main function already known from classical C coding. We will describe it more in details later on within this presentation. Each task has its own stack and its priority. In fact, it has its stack area and so-called tcb task control block, which contains its main configuration and parameters like current state, priority, connection to other OS components. Each task can be in one of four states. Ready to be executed, it is a default state after task creation, run state, so currently executed, block state, waiting for some event or delay to be run, and suspended state when the task is not active but still present in memory. To create and delete the task, we need to call a dedicated APE function. We can create or delete the task before we start the scheduler or during its work. What is the scheduler? The scheduler is an algorithm determining which task should be executed. The selection is done from ready to be executed task list in 3R2S around robin scheduling algorithm is implemented. All the tasks are executed one by one from the ready to be executed list. Round robin can be configured either in preemptive or cooperative multitasking mode. Preemptive means that the task with higher priority can preempt, can interrupt currently executed task while cooperative mode means that the task cannot be interrupted by or preempted by the other task with even with the higher priority. In most of the cases, the preemptive mode is used and this setting is configured by default in the configuration of the operating system. Operating system heap is a memory area within a RAM where all variables related to operating system and its components are stored. In majority of the cases, it is an area separated from MCU stack and heap which is used to service interrupts and store some global variables. The creation of and release memory areas within this region is done by special functions which are booking the memory space for each operating system component during its creation. Most of operating system components like tasks, queues, semaphores, mutexes needs two memory areas. The first one, so-called control block, contains main settings of given component like its name, size, other OS components it is connected to. The second one is a stack area used to store temporary variables. We will discuss it more in details in one of the next sections of this training. Thank you for watching this video.