Modularity and Virtualization

Jan 12th, 2015

by Xinran Chen, Ivy Wang and Yingjia Lee

Overview

For last week's lecture, we worked on building a paranoid word count program for scratch. This lecture will focus on making changes to this program to improve it.

Three Ways to Improve Our Code

Implementing These Changes

We currently have 3 different versions of a read/write system:

In order to update the read/write process, we need to optimize all three of these. Ideally, we'll only have one copy of a read/write function. Theoretically, this could be done by asking the company that makes the EEPROM to accommodate a read_ide_sector to support DMA and read larger sectors.

We would then have every program use that program in BIOS. In fact, this was what BIOS was originally intended for.

However:

Because of these problems, we choose to focus on changes to the software instead of the firmware. However, this also opens up some problems with our current word count program:

Modularity and Abstraction

In order to combat the above problems, we want to write programs with the goals of modularity and abstraction.

In order to determine how "nice" a boundary is, we need some metrics to determine whether a certain implementation of modularity is "good" or "bad".

* Waterbed Effect: Optimizing one metric often causes the other metrics to suffer. We need to determine whether or not these tradeoffs are worth it.

Applying these concepts to our current version of read_ide_sector

Implementing Modularity

Inefficiency