Threads and Scheduling

fix: Fixed bonus points section.

+9 -5
+1 -1
Makefile
··· 1 1 SRC := src 2 2 BUILD := .build/ 3 3 CC := gcc 4 - CFLAGS := -std=gnu23 -g -Wextra -Wall -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wconversion -Wunreachable-code -pedantic -fsanitize=address -fsanitize=undefined -save-temps -Wno-builtin-declaration-mismatch -fsanitize=leak 4 + CFLAGS := -std=gnu11 -O3 -Wno-builtin-declaration-mismatch 5 5 6 6 CLIBS := $(SRC)/lib/*.c 7 7
+1 -1
README.md
··· 1 1 # tsched 2 2 3 - This project is the second assignment for CCOM-4017. 3 + This project is the second assignment for CCOM-4017. Check out the [instructions](instructions.md). 4 4 5 5 I am using a sockets library I developed mysel. For more information on how the 6 6 sockets library was developed, feel free to visit the repo:
+6 -2
src/cluster.c
··· 46 46 } 47 47 // Left crit region 48 48 49 - // Let the client know what just happened. 49 + // Let the user know what just happened. 50 50 log(INFO, "Consumer %zu:\n\tProcessing: %s for %d seconds.\n", tid, (const char*)proc.program.buf, proc.time); 51 - zumba(cliente, proc.program); 52 51 53 52 // Perform work. 54 53 sleep(proc.time); ··· 85 84 Procs procs = deserialize(out_buf, msg_len); 86 85 for (size_t i = 0; i < procs.len; ++i) { 87 86 Proc proc = procs.procs[i]; 87 + Buffer in_buf = bufcpy(proc.program); 88 88 89 89 // Put the proc in the queue (Enter crit region) 90 90 mtx_lock(&pq_mtx); // down 91 91 pq_insert(&pq, proc); 92 92 mtx_unlock(&pq_mtx); // up 93 93 // Leave crit region 94 + 95 + // Let the client know what is getting processed. 96 + zumba(cliente, in_buf); 97 + free(in_buf.buf); 94 98 } 95 99 96 100 memset(out_buf.buf, 0, out_buf.len);
+1 -1
src/edevice.c
··· 14 14 // Create the socket 15 15 IPv4 ip = parse_address(argv[1]); 16 16 Port port = (Port)atoi(argv[2]); 17 - log(INFO, "Connecting to: %d.%d.%d.%d on port: %d", ip.bytes[0], ip.bytes[1], ip.bytes[2], ip.bytes[3], port); 17 + log(INFO, "Connecting to: %d.%d.%d.%d on port: %d\n", ip.bytes[0], ip.bytes[1], ip.bytes[2], ip.bytes[3], port); 18 18 19 19 Enchufe enchufe = enchufa(ip, port); 20 20 conecta(enchufe);