CSAPP 4.47 – Y86-64 bubblesort

Your assignment will be to write a Y86-64 program to perform bubblesort. For reference, the following C function implements bubblesort using array referencing: /* Bubble sort: Array version */ void bubble_a(long *data, long count) { long i, last; for(last = count-1; last > 0; last–){ for( i = 0; i …

CSAPP Direct Caching Simulator Lab Solution

  /* Sources: http://www.gnu.org/software/libc/manual/html_node/Getopt.html https://en.wikipedia.org/wiki/C_dynamic_memory_allocation Computer Systems A Programmers Perspective */ #include <stdlib.h> #include <stdio.h> #include <getopt.h> #include “cachelab.h” #include <math.h> #include <strings.h> typedef unsigned long long int address; typedef int bool; #define true 1 #define false 0 typedef struct // Structure for holding command line parameters given when calling …

Malloc, Realloc, and Free Implementation In C

/* Sources: Computer Systems a Programmers Perspective The C Programming Language http://danluu.com/malloc-tutorial/ http://g.oswego.edu/dl/html/malloc.html https://www.cs.cmu.edu/~fp/courses/15213-s05/code/18-malloc/malloc.c */ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <unistd.h> #include <string.h> #include “mm.h” #include “memlib.h” /* malloc, realloc, and free implementation in C. The list is searched in a first fit manner, where the first fit …