Specifications

2
Format interchange:
This machine problem gives you several opportunities for working with data layout in memory and for transforming
data from one form to another. Most of these tasks relate to graphics, and involve taking bit vectors or pixel data laid out
in a form convenient to C programmers and changing it into a form easily used by the Video Graphics Array (VGA)
operating in mode X. Although the details of the VGA mode X layout are not particularly relevant today, they do
represent the end product of good engineers working to push the limits on video technology. If you work with cutting-
edge systems, you are likely to encounter situations in which data formats have been contorted for performance or to
meet standards, and you are likely to have to develop systems to transform from one format to another.
Threading: Since the advent of faster processors, it became possible to exploit code parallelism by creating multiple
threads. Multiple threads of execution also allow logical separate tasks to be executed using synchronous operations.
If one thread blocks waiting for an operation to complete, other threads are still free to work. Note that threads are
different from processes. A thread is the smallest unit of processing that can be scheduled by an operating system.
Multiple threads can exist within the same process and share resources such as memory. Different processes cannot
share these resources. On a single processor, multithreading generally occurs by having the processor switch between
different threads, which is known as context switching. Since context switching happens frequently, the user perceives
the threads as running concurrently.
In this machine problem, we illustrate the basic concepts by using a separate thread to clear away status messages after
a fixed time has passed. You will need to synchronize your code in the main thread with this helper thread using a
Posix mutex. You may want to read the class notes on Posix threads to help you understand these interactions. Later
classes will assume knowledge of this material.
Software examples and test strategies:
In addition to these five learning objectives for the assignment, this machine problem provides you with examples of
software structure as well as testing strategies for software components.
When you design software interfaces, you should do so in a way that allows you to test components separately in this
manner and thus to deal with bugs as soon as possible and in as small a body of code as possible. Individual function
tests and walking through each function in a debugger are also worthwhile, but hard to justify in an academic setting.
The modex.c file is compiled by the Makefile to create a separate executable that returns your system to text mode.
We also made use of a technique known as a memory fence to check some of the more error-prone activities in the
file; read the code to understand what a memory fence is and what it does for you.
The Pieces Provided
You are given a working but not fully-functional copy of the source tree for an adventure game along with a skeletal
kernel module for the Tux controller. The Tux controller boards are attached to each machine in the lab.
The table below explains the contents of the source files.