Microcontroller on Arduino is usually Atmega328p which has very limited resources like 32K of Flash and 2K of RAM. Trying to run RTOS or any other real time operating system doesn’t make sense. It is possible, but not forth and it is not effective. But if you sill want to run multiple tasks on Arduino there is a way out. Adafruit walks us through simple tricks how to implement your own real time scheduler.
The idea they are talking about is not RTOS, but state machine. All you have to do is to keep an eye on Arduino internal clock which counts miliseconds (returned by millis() function) from program start. Each separate task is considered to be separate state machine which keeps track of time. Once its time comes – it executes task and goes low until its time comes again. This way there is no problem to run many tasks like blinking LEDs at different rate or turning servo motors at different rates and angles. Once you get used to it, you can go further and create object oriented program which looks more elegant and easy to expand. So next time if you program grows big and clumsy, remember about multitasking.