From 7876155157067a1b85854df7ac524e338ad6f864 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 24 Sep 2020 07:31:07 -0500 Subject: Start to add Git issues --- P1/src/mapreduce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/P1/src/mapreduce.c b/P1/src/mapreduce.c index 5b63f3f..7a38761 100644 --- a/P1/src/mapreduce.c +++ b/P1/src/mapreduce.c @@ -26,8 +26,8 @@ int main(int argc, char *argv[]) { sleep(1); - // To do - // spawn mappers processes and run 'mapper' executable using exec + // TODO: spawn mappers processes and run 'mapper' executable using exec + // To do // wait for all children to complete execution -- cgit v1.2.3 From d1d2be2a1d425646c442defc010a0da62a149ead Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 24 Sep 2020 08:17:45 -0500 Subject: Change around TODOs for my sake --- P1/src/mapreduce.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/P1/src/mapreduce.c b/P1/src/mapreduce.c index 7a38761..e879864 100644 --- a/P1/src/mapreduce.c +++ b/P1/src/mapreduce.c @@ -26,11 +26,10 @@ int main(int argc, char *argv[]) { sleep(1); - // TODO: spawn mappers processes and run 'mapper' executable using exec + //TODO: spawn mappers processes and run 'mapper' executable using exec - // To do - // wait for all children to complete execution + // TODO: wait for all children to complete execution // ###### DO NOT REMOVE ###### @@ -44,11 +43,9 @@ int main(int argc, char *argv[]) { sleep(1); - // To do - // spawn reducer processes and run 'reducer' executable using exec + // TODO: spawn reducer processes and run 'reducer' executable using exec - // To do - // wait for all children to complete execution + //TODO: wait for all children to complete execution return 0; } \ No newline at end of file -- cgit v1.2.3 From 95a026539b2641632bc584456dd2d81a905a259b Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 24 Sep 2020 13:21:25 -0500 Subject: Change perms, add VScode thing --- .vscode/launch.json | 27 +++++++++++++++++++++++++++ P1/solutionexe/mapper | Bin P1/solutionexe/mapreduce | Bin P1/solutionexe/reducer | Bin 4 files changed, 27 insertions(+) create mode 100644 .vscode/launch.json mode change 100644 => 100755 P1/solutionexe/mapper mode change 100644 => 100755 P1/solutionexe/mapreduce mode change 100644 => 100755 P1/solutionexe/reducer 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 old mode 100644 new mode 100755 diff --git a/P1/solutionexe/mapreduce b/P1/solutionexe/mapreduce old mode 100644 new mode 100755 diff --git a/P1/solutionexe/reducer b/P1/solutionexe/reducer old mode 100644 new mode 100755 -- cgit v1.2.3 From ee8e300b7d5dd481533aabe30d3e07a2c8647d95 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 24 Sep 2020 13:29:01 -0500 Subject: Start Master --- P1/src/mapreduce.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/P1/src/mapreduce.c b/P1/src/mapreduce.c index e879864..ed1f9e5 100644 --- a/P1/src/mapreduce.c +++ b/P1/src/mapreduce.c @@ -26,11 +26,19 @@ int main(int argc, char *argv[]) { sleep(1); - //TODO: 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 + } + } - // TODO: 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 @@ -43,9 +51,19 @@ int main(int argc, char *argv[]) { sleep(1); - // TODO: spawn reducer processes and run 'reducer' executable using exec - //TODO: 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 -- cgit v1.2.3