CS 452/652 Winter 2020 - Lecture 4
January 13, 2020
prev next
Programming
- use unit testing where possible
- use assertions generously!
- availability of resources: track < ARM < PC < developer
- hardware emulation, such as QEMU → unclear cost/benefit
- important principle: KISS
- related: "premature optimization is the root of all evil" (Donald Knuth)
- think strategically about
- functionality: start simple, add functionality in small steps
- test (and commit) at each step
- data structures: encapsulate, start simple, exchange later
- bugs: not every bug is a show-stopper
Optimization
Processor Configuration
- ARM 920T has instruction- and data-cache → enable!
- RedBoot disables before starting program with 'go'
- Related features (not relevant for CS 452/652)
- lockdown mode: lock specific code/data into fast cache memory
- Thumb mode: use simpler/smaller instruction set to reduce memory footprint
- MMU enabled with default setting → no need to tinker with
- details: see control register CP15 in EP93XX and ARM documentation
Compiler Optimization
- compiler understands data dependencies in synchronous control flow
- code without side effects might be removed
- repetitions might be removed
- C/C++ keyword "volatile"
- goal is complete understanding of what we are doing ⇒ enable optimization!
Runtime Optimization
- pipelining and out-of-order execution
- very important challenge in other areas!
- one old processor → not relevant for CS 452/652
- Java keyword "volatile" handles this (different from C/C++)
Kernel Overview
- microkernel → device drivers outside kernel
- normal scope: memory, threading, communication
- here: tasks and message passing
- do not use shared memory between tasks
- hardware protection optional
- entry/exit between kernel and user-level tasks
- software interrupt - system call
- hardware interrupt - device activity
Generic Kernel Loop
void kmain() {
initialize(); // includes starting the first user task
for (;;) {
currtask = schedule();
request = activate(currtask);
handle(request);
}
}