For the Arduino sketch system, it is kind of a mini-RTOS with its own, semi-standardized hardware abstraction. The sketch is actually based on C++, and the build tool includes a preprocessor that can extract the usual project settings from the sketch file. Arduino implemented a layer of hardware abstraction to mask both the hardware implementation details (a set of drivers with standardized API) and the board differences (the same physical connector can map to different port/pin on different board and chip.) The RTOS part comes in either a dumbed-down FreeRTOS or Arduino's own preemptive context switching, as well as a good selection of guides on writing cooperative multitasking code.