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(-) (limited to 'P1/src') 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(-) (limited to 'P1/src') 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 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(-) (limited to 'P1/src') 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