Cooperative thread-based kernel for multi-thread ATmega328p purposes