aboutsummaryrefslogtreecommitdiffstats
path: root/P2/lib/utils.c
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-10-27 14:23:53 -0500
committerMatt Strapp <strap012@umn.edu>2020-10-27 14:23:53 -0500
commit897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b (patch)
tree76a81f2e2f8405984130f3d2f5d61aa6527e5627 /P2/lib/utils.c
parentFinish getInterData??? (diff)
downloadcsci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar.gz
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar.bz2
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar.lz
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar.xz
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.tar.zst
csci4061-897f078b8a1c3ef7ddd9bb3920d36c0a98d2498b.zip
Start Shuffle
(none of these probably work)
Diffstat (limited to '')
-rw-r--r--P2/lib/utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index a97aa36..8963d16 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -66,9 +66,9 @@ int hashFunction(char* Qkey, int reducers){
}
int getInterData(char *Qkey, int reducerID) {
+ struct msgBuffer message;
//make sure it work.
int id = openQueue();
- struct msgBuffer message;
msgrcv(id, &message, chunkSize, reducerID, 0);
Qkey = message.msgText;
if (strncmp("END", message.msgText, 3))
@@ -82,8 +82,15 @@ int getInterData(char *Qkey, int reducerID) {
}
void shuffle(int nMappers, int nReducers) {
+ struct msgBuffer message;
//Once again, MAKE SURE THIS WORKS PROPERLY!
int id = openQueue();
+ for (int i = 1; i <= nMappers; i++) {
+ //Extra for loop traversing directory
+
+ message.msgType = hashFunction(/* SOMETHING */, nReducers);
+ msgsnd(id, &message, chunkSize, 0);
+ }
}