Operating System: Shell – Bash
Implement a C program simulating the evaluation of an exam. The evaluation is carried out by
a teacher and an assistant, correcting the exam and exchanging information to give the final
mark. The procedure must be implemented by a program reading the name of two files as
command line parameters and generating two processes, the teacher and the assistant
processes.
The teacher process corrects the first part of the exam reading data from the first data file. The
file includes a student for each line in the following format:
“Student Id” “Surname” “Name” “First part of the mark”
Suppose the maximum size for the first three fields is 20 characters while the fourth field is a
number between 0 and 15.
The teacher and the assistant are synchronized as follow:
1. The teacher process sends to the assistant process the surname and name of the student.
2. The assistant process receives the surname and the name of the students and then
simulates correction of the second part of the exam, reading the second part mark from
keyboard. Then it sends the value read through the keyboard to the teacher process.
3. The teacher process, sums up the two marks and writes data to the second file. This second
file has the same format of the first input file. Then the processes continue with the following
students. Use two pipes to transfer data to the assistant and to the teacher process. Be careful
to terminate the assistant process when the teacher process terminates.
Leave an answer
You must login or register to add a new answer .