1. Make a program developed in C language (not C++, just C), capable to do a set of tests to a set of programs, creating one process to each program. You must pass two arguments in the main function, related to two txt files (programs.txt and tests.txt). The first must have the list of programs to test. For example: prog01 prog02 prog03 (Then in the program we must add ".c") The second file, tests.txt, must have the respective test arguments for those programs, like, for example: 5 3 3 2 3 3 4 2 1 The following operations must be well done: 1 - verify and read the data of programs.txt and tests.txt; 2 - create one process for each of the programs (alocate memory as necessary for it); 3 - In each process created: a) Compile the respective program; b) Execute it with all of the arguments read in tests.txt; c) Then, remove the executable file from disk and return the output to a temporary file .txt with the name of the respective program (for example, prog01.txt); 4 - In the main process (father) execute a "ps" instruction; 5 - In the main process wait for all the others to end; 6 - Show the result kept in the temporary files, by order of programs and test arguments, and then erase all of those files, so that our folder be exactly like it was before running this program. Example of output: ./program programs.txt tests.txtPID TTY TIME CMD 8412 pts/1 00:00:01 bash 11850 pts/1 00:00:00 program 11851 pts/1 00:00:00 program 11852 pts/1 00:00:00 program 11853 pts/1 00:00:00 program 11854 pts/1 00:00:00 program 11855 pts/1 00:00:00 sh 11856 pts/1 00:00:00 sh 11857 pts/1 00:00:00 sh 11858 pts/1 00:00:00 sh 11859 pts/1 00:00:00 sh 11860 pts/1 00:00:00 gcc 11861 pts/1 00:00:00 gcc 11862 pts/1 00:00:00 gcc 11863 pts/1 00:00:00 ps 11864 pts/1 00:00:00 gcc 11865 pts/1 00:00:00 cc1 11866 pts/1 00:00:00 cc1 # Test> prog02 5 3 3 Hipothesis: 56 favorables: 10 Probabilitie: 17.86% # Test> prog02 10 5 2 Hipothesis: 105 favorables:...
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here