The Contiki Operating System Jack Nosek
History Developed by Adam Dunkels of SICS Also developed protothreads and μIP First released on March 10, 2003 Named after Thor Heyerdahl's famous Kon-Tiki raft “Contiki runs on tiny and prehistoric computers, yet is able to do much of what we expect from large and modern computers.”
Who uses it? Most common application is as an OS for Networks of Embedded Systems Hobbyists use it as an OS for older and smaller systems Ports for Apple II, Atari, Gameboy, NES, Commodore 64 and 128 Screen captures at http://www.sics.se/~adam/contiki/ports/index.html
Features Minimalist Event Driven Kernel, even runs on 8-bit Microcontrollers TCP/IP Stack Support Dynamic Loading and Unloading of Programs Small Memory Requirements Optional Preemptive Multithreading through Protothreads
Event Driven Kernel Kernel is event based making it a real time OS An event triggers the kernel to call the corresponding event handler Functions very similar to TinyOS Has its drawbacks, i.e. long running computations
TCP/IP Stack Support Implements Dunkels’s own TCP/IP stack called μIP Memory Requirements Kilobytes of Program Code Hundreds of bytes of RAM Allows to connect to networks using SLIP (Serial Line IP)
Dynamic Program Loading The Core Code and Program Code are kept separate in ROM. Program Code loaded at runtime. Program code can be loaded from ROM or RAM Allows for “Over the Air Programming” for networks of sensors
Small Memory Requirements The base system, providing multitasking and TCP/IP networking, can be compiled in about 32 KB Smallest system to date uses about 2000 bytes of RAM Jack Ganssle praised Contiki for its low memory usage in his Embedded Muse newsletter, #113
Protothreads Implemented as an additional library on top of the event based kernel Stackless, lightweight thread comprised of a single C function using 2 bytes of RAM to record its state Adds a layer of abstraction to the state-machine event based code usually written, to create a sequential flow of program code.
Event-driven Event-driven (TinyOS) Processes do not run without events Handler Event-driven (TinyOS) Processes do not run without events Event occurs: kernel invokes event handler Event handler runs to completion (explicit return;) Handler Kernel Handler Handler
Contiki: implementing threads on top of an event-based kernel
Contiki Programs Contiki Tool-kit (CTK) GUI Virtual Network Computing (VNC) Server A Web Server A Web Browser A command line shell. A telnet server. An IRC client. An FTP client. A disk directory file reader. A file and disk image downloader utility. A simple desktop calculator.
End Works Cited Slides 10 and 11 Taken from Adam Dunkles Presentation Contiki – a Lightweight and Flexible Operating System for Tiny Networked Sensors found at http://www.sics.se/~adam/slides/contiki-emnets.ppt