/* This is the helist.c file. It generates a set of random jobs and */ /*job times using the crelist function. Look at it and see what it does. */ /* go ahead and just link up to this file. You can call it what you want */ /* just link to whatever you call it. */ /* example gcc -c thisfile.c gcc -c theprogyouwrite.c gcc theprogyouwrite thisfile -o heap run theprogyouwrite */ /* note that there are no spaced between the comma seperated files */ /* Don't forget to make MAX_JOBS 100. If not your output won't be right */ /* I'll have to break out the red pen */ /* also, if you have a job that won't fit into memory, go ahead and abort */ /* inserting the rest of the jobs, and give a memory dump (i.e. print_out) */ /* of what the memory looks like at the time it wasn't able to allocate */ /* You should print the following messeges: First Fit algorithm: Ran out of memory inserting job of size %d end time %d Dumping Memory */ /* and then the memory dump should appear */ /* don't forget to release your list nodes */ #include #include "heap.h" #define NUM_RUNS 5 #define RAND_MAX 2147483647 static int num_runs = 0; static int time_dev[] = {5,5,6,8,10}; static int time_min[] = {3,5,5,6,3}; static int size_dev[] = {10,15,10,10}; static int size_min[] = {5,3,1,1,1}; void crelist(int *list,int *size, int len) { int i; for (i=0;i= NUM_RUNS) return (0); crelist(times,size,len); num_runs++; return (1); }