I was the technical reviewer for this book, I think that it does a good job as an introductory work: https://www.amazon.com/dp/B086V86RQP/
Miro's free youtube "course" has a set of lessons on RTOSes: https://www.youtube.com/playlist?list=PLb-MsRpo_wlLW0EWRpAqnbbDsf4kxSI1x .
Miro's book, Practical UML Statecharts in C and C++, also provides a lot of valuable information on real-time software design (beyond thinking about UML statecharts). He takes an event-driven approach, which I think is extremely valuable. The book is tuned toward his framework, but you can apply the concepts outside with any real-time setup.
You can download the book for free as a PDF from his website: https://www.state-machine.com/psicc2/ .
From a real-time architecture/design perspective, I recommend this book: https://www.amazon.com/Real-Time-Software-Design-Embedded-Systems/dp/1107041090