Other articles

  1. Review - Addresses

    Consider the following C program.

    #include <stdio.h>
    void pa(char* s, void* p) {
      printf("%s: %lx\n", s, (long)p);
    char gc;
    double gd;
    void main() {
      char lc;
      double ld;
      pa("gc", &gc);
      pa("gd", &gd);
      pa("lc", &lc);
      pa("ld", &ld);
      pa("main", main);
      pa("pa", pa);

    The …

  2. Lecture 20: Operating System

    On Wednesday we'll wrap things up by looking at how operating systems create the illusion of multiple programs running at the same time. Slides are here.

  3. Performance Mystery

    Why is the time required for copy1 so different from copy2?

    #include <stdio.h>
    #define N 10000
    unsigned char src[N][N], dst[N][N];
    void copy1(unsigned char src[N][N], unsigned char dst[N][N]) {
      int i, j;
      for(i = 0; i < N; i++) {
        for(j = 0; j …
  4. Problem Set 3

    Due 27 February by 10pm

    Your assignment is to code a recursive implementation of Quick Sort in MIPS assembly and run it on the simulator.

    You can find the tools for this assignment here.

    Here is an example of quick sort in C.

    #include <stdio.h>
    int data[] = { 
     46,78 …
  5. Problem Set 2

    Due 20 Feruary by 10pm

    Problem set 2 is available here.

    You will use my hacked up version of Prof. McMillan's MIPS simulator to modify the code we wrote in class. This is brand new code so expect and report the occasional bug.

  6. Programming MIPS

    Today we will back up a bit and write some MIPS code live in class. There is no better way to learn to program than actually doing it.

    Let's start with an implementation of insertion sort in C. Here is a typical implementation.

    #include <stdio.h>
    int data[] = { 42, 19 …
  7. Lecture 5 - Assembly and Simulator

    You can find the slides for today here.

    Copying the code from the slides loses for formatting so I'll put the code fragments here.

    Slide 9

         add   $t0,$zero,$zero     # sum = 0
         add   $t1,$zero,$zero     # for (i = 0; ...
         addu  $t0,$t0,$t1   # sum = sum + i;
         addi  $t1,$t1 …
  8. Problem Set 1

    Problem set 1 is available here. This is brand new code so expect and report the occasional bug.

    The little text field should turn red if you have the format wrong and green when it thinks you have the answer correct.

  9. Welcome

    Welcome to the site for Comp 411 section 2 for spring 17.