From 93576d0ea1c25adb6378e222d59991c1e3b8804c Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Fri, 17 Apr 2020 02:01:23 -0400 Subject: [PATCH] Improve program output --- correct.c | 4 +++- deadlock.c | 4 +++- makefile | 12 ++++++------ starvation.c | 4 +++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/correct.c b/correct.c index 9e5729b..2376039 100755 --- a/correct.c +++ b/correct.c @@ -40,7 +40,8 @@ void release_forks(); * Initializes and runs program. */ int main(int argc, char* argv[]) { - printf("Starting \"Correct\" implementation of program. Has no deadlock or starvation.\n\n"); + printf("Starting \"Correct\" implementation of program.\n"); + printf("(Should have no deadlock or starvation.)\n\n"); // Create variables. philosopher_count = 10; @@ -114,6 +115,7 @@ int main(int argc, char* argv[]) { free(thread_results); printf("\nTerminating \"Correct\" implementation of program.\n"); + printf("(Should have no deadlock or starvation.)\n"); } diff --git a/deadlock.c b/deadlock.c index 8171971..b369e63 100644 --- a/deadlock.c +++ b/deadlock.c @@ -40,7 +40,8 @@ void release_forks(); * Initializes and runs program. */ int main(int argc, char* argv[]) { - printf("Starting \"Deadlock\" implementation of program.\n\n"); + printf("Starting \"Deadlock\" implementation of program.\n"); + printf("(May deadlock, such as instances where each thread picks up one fork.)\n\n"); // Create variables. philosopher_count = 10; @@ -114,6 +115,7 @@ int main(int argc, char* argv[]) { free(thread_results); printf("\nTerminating \"Deadlock\" implementation of program.\n"); + printf("(May deadlock, such as instances where each thread picks up one fork.)\n"); } diff --git a/makefile b/makefile index 3b03732..ef3bb72 100755 --- a/makefile +++ b/makefile @@ -49,11 +49,11 @@ help: @echo "Default: Executes \"run\", then \"clean\"." @echo "" @echo "Available Commands:" - @echo " all - Executes \"run\", then \"clean\"." - @echo " correct - Compile program to \"correct.out\". Then run." - @echo " deadlock - Compile program to \"deadlock.out\". Then run." - @echo " starvation - Compile program to \"starvation.out\". Then run." - @echo " valgrind_correct - Compile program to \"correct.out\". Then run with memory error checking." + @echo " all - Executes \"run\", then \"clean\"." + @echo " correct - Compile program to \"correct.out\". Then run." + @echo " deadlock - Compile program to \"deadlock.out\". Then run." + @echo " starvation - Compile program to \"starvation.out\". Then run." + @echo " valgrind_correct - Compile program to \"correct.out\". Then run with memory error checking." @echo " valgrind_deadlock - Compile program to \"deadlock.out\". Then run with memory error checking." @echo " valgrind_starvation - Compile program to \"starvation.out\". Then run with memory error checking." - @echo " clean - Remove temporary/compiled files from directory." + @echo " clean - Remove temporary/compiled files from directory." diff --git a/starvation.c b/starvation.c index e0c88f5..bef7057 100644 --- a/starvation.c +++ b/starvation.c @@ -40,7 +40,8 @@ void release_forks(); * Initializes and runs program. */ int main(int argc, char* argv[]) { - printf("Starting \"Starvation\" implementation of program.\n\n"); + printf("Starting \"Starvation\" implementation of program.\n"); + printf("(Philosophers don't put forks down until they rest. Thus starvation happens frequently.)\n\n"); // Create variables. philosopher_count = 10; @@ -114,6 +115,7 @@ int main(int argc, char* argv[]) { free(thread_results); printf("\nTerminating \"Starvation\" implementation of program.\n"); + printf("(Philosophers don't put forks down until they rest. Thus starvation happens frequently.)\n"); } -- GitLab