diff options
author | Matt Strapp <strap012@umn.edu> | 2020-09-24 13:29:01 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-09-24 13:29:01 -0500 |
commit | ee8e300b7d5dd481533aabe30d3e07a2c8647d95 (patch) | |
tree | 877bd369fd48bb2e86da96c323e06cb87d5aaef0 | |
parent | Change perms, add VScode thing (diff) | |
download | csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar.gz csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar.bz2 csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar.lz csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar.xz csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.tar.zst csci4061-ee8e300b7d5dd481533aabe30d3e07a2c8647d95.zip |
Start Master
-rw-r--r-- | P1/src/mapreduce.c | 30 |
1 files 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 |