Yorkville High School Computer Science Department
Yorkville High School Computer Science Department on Facebook  Yorkville High School Computer Science Department Twitter Feed  Yorkville High School Computer Science Department on Instagram

Yorkville High School Computer Science

ASSIGNMENTS: Mobile App - May 10, 2019 :: UI Project - May 10, 2019 :: Web App - May 15, 2019 >>

Operating System Design :: Lessons :: Overview

Course Overview

The Operating System Design strand of Computer Science Advanced Studies is not a typical Operating System Design course that you would see in college. This course is based off the NAND to Tetris curriculum created by Noam Nisan and Shimon Schocken. The difference with this course compared to the typical college OS Design course is that you will be learning everything from the hardware of the computer up to the operating system. In essence, this course takes elements from college hardware design, OS design, and compiler courses and puts it into one course. Obviously, you will not gain the depth of understanding of operating system that you would from a college OS design course, but you will have a very good understanding of every bit of the computer to help make you a better programmer.

This course will start by teaching you the lowest levels of a computer by designing the hardware of the computer. You will design the software in a simulated hardware environment, which is what real computer engineers do when designing the silicon components of a device. You will then combine the individual chips that will make up a hardware platform. To form the bridge between hardware and software you will create a machine language and an assembler. On the software side you will create a virtual machine to translate your assembly language and a compiler to run your software. You will then create the operating system and programs that run on the system.

Structure of the Operating System Design Strand of Computer Science Advanced Studies

The highest level of this course design is at the abstract design level where you will design programs that work on your operating system. You can see where the game of Pong is in the diagram below.

Pong at Abstract Design Level

You will be using a programming language called Jack to create programs and your operating system. Below is some example code from Pong and the operating system itself.

/** A Graphic Bat for a Pong Game */
class Bat {
    field int x, y;            // screen location of the bat's top-left corner
    field int width, height;   // bat's width & height
    // The class constructor and most of the class methods are omitted

    /** Draws (color=true) or erases (color=false) the bat */
    method void draw(boolean color) {
       do Screen.setColor(color);
       do Screen.drawRectangle(x,y,x+width,y+height);

    /** Moves the bat one step (4 pixels) to the right. */
    method void moveR() {
       do draw(false);  // erase the bat at the current location
       let x = x + 4;   // change the bat's X-location
       // but don't go beyond the screen's right border
        if ((x + width) > 511) {
           let x = 511 - width;
       do draw(true);  // re-draw the bat in the new location
/** An OS-level screen driver that abstracts the computer's physical screen */
class Screen {
     static boolean currentColor;  // the current color 

     // The Screen class is a collection of methods, each implementing one 
     // abstract screen-oriented operation.  Most of this code is omitted.
     /** Draws a rectangle in the current color. */
     // the rectangle's top left corner is anchored at screen location (x0,y0)
     // and its width and length are x1 and y1, respectively.
     function void drawRectangle(int x0, int y0, int x1, int y1) {
         var int x, y;
         let x = x0;
         while (x < x1) {
             let y = y0;
             while(y < y1) {
                do Screen.drawPixel(x,y);
                let y = y+1;
             let x = x+1;
Jack Programing Language

Your Jack programming language will use a compiler to compile your programs onto a virtual machine. The virtual machine lets your programs run on any platform. This is a similar model to how Java works.

Below is a brief look at how compilation works in Jack. This will be covered in more detail later in the course.

Jack Compilation Example

The virtual machine is shown below.

A Virtual Machine
Virtual Machine Translator

A virtual machine translator will translate the machine code into assembly code, and an assembler will translate the assembly code into executable binary. This is considered low-level programming.

Low-Level Programming
Computer Architecture

A hardware architecture needs to be created to realize the semantics of the machine language. It should be able to parse instructions and execute them.

Machine Language

The diagram below is a typical Von Neumann machine, which we will be implementing in this course.

Von Neumann Machine

Gate logic will be used to design the computer. Combinatorial logic will be used to design an arithmetic logic unit and sequential logic will be used to design RAM. The course will start out will the design of these smaller parts of a computer system.

Gate Logic
Yorkville High School Computer Science Department on Facebook Yorkville High School Computer Science Department Twitter Feed Yorkville High School Computer Science Department on Instagram