From an academic prospective, this is a good read: http://www.hackster.io/bruceland/preemptive-kernel-for-atmel-mega1284