Introduction - If you have any usage issues, please Google them yourself
Based on STM32, explaining task switching, given in detail with reference to the compilation, and complete a simple operating system, task scheduling, is very good for entry-OS, read this, follow others such as FreeRTOS are similar principle.