aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Smith <smit9523@umn.edu>2020-10-24 17:50:59 -0500
committerAndrea Smith <smit9523@umn.edu>2020-10-24 17:50:59 -0500
commit8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06 (patch)
treed199480e823da3344c01c6c00513fdfb7ee32a9a
parentAdd sendChunkData branch (diff)
downloadcsci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar.gz
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar.bz2
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar.lz
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar.xz
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.tar.zst
csci4061-8ee6c8d3dfe2bffced4aed4dd2cd17512e2a0f06.zip
Check TODO's
Diffstat (limited to '')
-rw-r--r--P2/lib/utils.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index dffade8..c8f6f72 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -5,8 +5,8 @@ char *getChunkData(int mapperID) {
// sends chunks of size 1024 to the mappers in RR fashion
void sendChunkData(char *inputFile, int nMappers) {
- msgBuffer message;
- key_t key;
+ struct msgBuffer message;
+ key_t key = 10;
int msgid;
// open message queue
@@ -16,8 +16,23 @@ void sendChunkData(char *inputFile, int nMappers) {
// construct chunks of 1024 bytes
while(fgets(message, chunkSize, fptr) != EOF) {
-
+
+ /* Go to the end of the chunk, check if final character
+ is a space if character is a space, do nothing
+ else cut off before that word and put back file */
+ // TODO! help
+
+ msgsnd(msgid, &msgText, mapperID);
+ }
+
+ for (int i = 1; i < mapperID; i++) {
+ msgsnd(msgid, (void*)&END, MSGSIZE, i);
+
+ // TODO! does this need to be in another loop or is blocking good enough?
+ msgrcv(msgid, (void*)&ACK, MSGSIZE, i);
}
+
+ msgctl(msgid, IPC_RMID, 0); // close that bih
}
// hash function to divide the list of word.txt files across reducers