aboutsummaryrefslogtreecommitdiffstats
path: root/P2/include/utils.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--P2/include/utils.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/P2/include/utils.h b/P2/include/utils.h
new file mode 100644
index 0000000..2c91cdf
--- /dev/null
+++ b/P2/include/utils.h
@@ -0,0 +1,43 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/msg.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <ctype.h>
+
+#define chunkSize 1024
+#define MSGSIZE 1100
+
+struct msgBuffer {
+ long msgType;
+ char msgText[MSGSIZE];
+};
+
+// mapper side
+int validChar(char c);
+char *getWord(char *chunk, int *i);
+char *getChunkData(int mapperID);
+void sendChunkData(char *inputFile, int nMappers);
+
+
+// reducer side
+int hashFunction(char* key, int reducers);
+int getInterData(char *key, int reducerID);
+void shuffle(int nMappers, int nReducers);
+
+// directory
+void createOutputDir();
+char *createMapDir(int mapperID);
+void removeOutputDir();
+void bookeepingCode();
+
+#endif \ No newline at end of file