diff options
-rw-r--r-- | .vscode/launch.json | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | P1/solutionexe/mapper | bin | 38848 -> 38848 bytes | |||
-rwxr-xr-x[-rw-r--r--] | P1/solutionexe/mapreduce | bin | 32616 -> 32616 bytes | |||
-rwxr-xr-x[-rw-r--r--] | P1/solutionexe/reducer | bin | 33848 -> 33848 bytes | |||
-rw-r--r-- | P1/src/mapreduce.c | 33 |
5 files changed, 51 insertions, 9 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..447de6d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "enter program name, for example ${workspaceFolder}/a.out", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +}
\ No newline at end of file diff --git a/P1/solutionexe/mapper b/P1/solutionexe/mapper Binary files differindex 63e089d..63e089d 100644..100755 --- a/P1/solutionexe/mapper +++ b/P1/solutionexe/mapper diff --git a/P1/solutionexe/mapreduce b/P1/solutionexe/mapreduce Binary files differindex 6857ba1..6857ba1 100644..100755 --- a/P1/solutionexe/mapreduce +++ b/P1/solutionexe/mapreduce diff --git a/P1/solutionexe/reducer b/P1/solutionexe/reducer Binary files differindex 58e0ec4..58e0ec4 100644..100755 --- a/P1/solutionexe/reducer +++ b/P1/solutionexe/reducer diff --git a/P1/src/mapreduce.c b/P1/src/mapreduce.c index 5b63f3f..ed1f9e5 100644 --- a/P1/src/mapreduce.c +++ b/P1/src/mapreduce.c @@ -26,12 +26,19 @@ int main(int argc, char *argv[]) { sleep(1); - // To do - // spawn mappers processes and run 'mapper' executable using exec + pid_t mapperPid; + for (int i = 0; i < nMappers; i++) { + mapperPid = fork(); + if (mapperPid != 0) { + //TODO: exec here + } + } - // To do - // wait for all children to complete execution - + for (int i = 0; i < nMappers; i++) { + //Hopefully this works + wait(NULL); + } + // ###### DO NOT REMOVE ###### // shuffle sends the word.txt files generated by mapper @@ -44,11 +51,19 @@ int main(int argc, char *argv[]) { sleep(1); - // To do - // spawn reducer processes and run 'reducer' executable using exec - // To do - // wait for all children to complete execution + pid_t reducerPid; + for (int i = 0; i < nReducers; i++) { + reducerPid = fork(); + if (reducerPid != 0) { + //TODO: exec here + } + } + + for (int i = 0; i < nReducers; i++) { + //Maybe this works too? + wait(NULL); + } return 0; }
\ No newline at end of file |