# EKA2

EKA2 (EPOC Kernel Architecture 2) is the second-generation Symbian platform real-time operating system kernel, which originated in the earlier operating system EPOC.
EKA2 began with a proprietary software license. In October 2009, it was released as free and open-source software under an Eclipse Public License. In April 2011, it was reverted to a proprietary license.
Like its predecessor, EKA1, it has preemptive multithreading and full memory protection. The main differences are:
* Real-time guarantees: each application programming interface (API) call is fast, but more importantly, time-bound
* Multiple threads inside the kernel, and outside
* Pluggable memory models, allowing better support for later generations of ARM instruction set architecture.
* A nanokernel which provides the most basic OS facilities upon which other personality layers can be built
The user interface of EKA2 is almost fully compatible with EKA1. EKA1 was not used after Symbian OS version 8.1, and was superseded in 2005.
The main advantage of EKA2 was its ability to run full telephone signalling protocol stacks. Previously, on Symbian phones, these had to run on a separate central processing unit (CPU). Such signalling stacks are very complex and rewriting them to work natively on Symbian OS is typically not an option. EKA2 thus allows personality layers to emulate the basic primitives of other operating systems, thus allowing existing signalling stacks to run largely unchanged.
Real-time guarantees are a prerequisite of signalling stacks, and also help with multimedia tasks. However, as with any RTOS, a full analysis of all threads is needed before any real-time guarantees can be offered to anything except the highest-priority thread; because higher priority threads may prevent lower-priority threads from running. Any multimedia task is likely to involve graphics, storage and/or networking activity, all of which are more likely to disrupt the stream than the kernel is.
Inside the kernel, EKA1 only allowed one thread (plus a null idle thread). EKA2 allows many threads. This makes it much easier to write device drivers that involve complex finite-state machines, such as those for SD card memory sticks or USB flash drives. Interrupts are handled with an interrupt service routine, which may request an immediate deferred function call (called as soon as the interrupts are processed), or a deferred function call, which is queued to run on a kernel thread. Either may in turn communicate with user-side threads.
Power management in EKA2 was largely unchanged from EKA1. The exact scheme varies between phones, but generally the null thread puts the CPU and peripherals to sleep, after having requested a wake-up whenever the next timer is due to expire.
EKA2 runs on ARM architecture CPUs and the WINS emulator. Unofficial ports exist for other CPUs. On the emulator, EKA2 provides somewhat better emulation than EKA1, more so for the RProcess APIs which Symbian OS uses to represent processes. In EKA1 they didn't work at all on the emulator, which runs as a single Windows process.
Much of the credit for EKA2 goes to a single Symbian kernel engineer, who began the project as an experiment many years before it became an official part of Symbian OS.