aboutsummaryrefslogtreecommitdiffstats
path: root/P2
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-03 19:34:21 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-03 19:34:21 -0600
commitc2c0eb935c2e4f55b81f7fbf80b7d5c195883e23 (patch)
treef77b191d953f305495f5aad2f01ae2a4fc45215a /P2
parenthelp (diff)
downloadcsci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar.gz
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar.bz2
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar.lz
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar.xz
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.tar.zst
csci4061-c2c0eb935c2e4f55b81f7fbf80b7d5c195883e23.zip
poggers????????
Diffstat (limited to '')
-rw-r--r--P2/lib/utils.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index 02f4a9f..3b4f829 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -90,12 +90,9 @@ int getInterData(char *Qkey, int reducerID) {
struct msgBuffer message= makeMessage();
//DEBUG! make sure it work.
int id = openQueue();
- //Likes to hang
msgrcv(id, &message, MSGSIZE, reducerID, 0);
- // printf("INTER DATA: %s\n", message.msgText);
- // *Qkey = *message.msgText;
strcpy(Qkey, message.msgText);
- // printf("INTER DATA: %s\n", Qkey);
+ printf("INTER DATA: %s\nREDUCER ID:%ld\n", Qkey, message.msgType);
return (strncmp("END", message.msgText, 3) != 0);
}
@@ -113,9 +110,8 @@ void shuffle(int nMappers, int nReducers) {
if (!strcmp(".", entry->d_name) || !strcmp("..", entry->d_name))
continue;
sprintf(message.msgText, "%s/%s", newpath, entry -> d_name);
- message.msgType = hashFunction(entry -> d_name, nReducers);
- // printf("SENT SHUFFLE:%s\n", message.msgText);
- // printf("%ld\n", message.msgType);
+ printf("%s\n%d\n", entry->d_name, hashFunction(entry->d_name, nReducers)+1);
+ message.msgType = (hashFunction(entry -> d_name, nReducers)+1);
msgsnd(id, &message, MSGSIZE, 0);
}
closedir(dir);