In the solution we present in class, we use two mutex variables. Many of the solutions submitted use one mutex only. A question raised during discussion with a student whether any solution with one mutex is wrong.
I will post some of the solutions submitted by you, and let you take a look and discuss. I think debugging threads is not easy and is a skill that comes with experience. So hopefully this little exercise will serve as a practice for you.
Continue reading →
Lab 5 has been graded by Mr. Xu Yecheng and your mark is now available through IVLE Gradebook. Many students did not do as well as expected, and did not receive full marks. In particular, many solutions either lead to deadlock or lead to overflow/underflow of pot. If you did not get a 10 and were not aware of bugs in your code, you should look at your code carefully to find out what is wrong (it’s quite illuminating). If you are convinced that your code works but still did not receive a full mark, please feel free to email Mr. Xu or me.
Here is your Lab 7.
Lab 7 is a graded exercise. You have two weeks to complete. Submit your solution to the IVLE workbin before Sunday, 30 October 2011, 10:00pm.
Despite a tiny setback, I managed to regraded your Lab 4. Grades have been sent to your SoC email account (with @comp.nus.edu.sg address) which you can read by logging into sunfire and run mutt or pine, or by logging into SoC webmail.
One more common error emerges from this regrading. I noticed many of you call either wait() or waitpid() without specifying the PID of the process you are waiting for (in the case of foreground process). This can cause a problem, as any of the previously running background process can interrupt the wait.
I am making an exception and made a sample solution to Lab 4 available.
We have discovered errors with the grades and marks given out to Lab 4. This means that the email you received may contain incorrect marks and comments. IMPORTANT: if you receive a full marks, you should still check your solution against the sample posted — because your solution could still be wrong or incomplete.
I apologize for the errors, and I am regrading all of your Lab 4 submissions to make this right.
There is no specific question about shell and Lab 4 in the midterm, in case you are wondering. But you should still get familiarize with the system calls involved, including fork, wait, exec, exit, signal, and kill.
Lab 4 has been graded by Ms. Saranya Sekar. You will receive an individual email with your mark details (sent to your SoC UNIX @comp.nus.edu.sg email address). If you have doubts about your code, comments given, or marks, please seek clarification with Ms. Saranya (email@example.com) and me. Here are the common mistakes that students made in Lab 4.
1. Did not kill child processes when exiting bush. This can be done with killpg(0, SIGHUP)
2. Did not catch SIGHUP signal at bush. So when bush calls killpg(0, SIGHUP), it hangs itself up!
3. Do something extra after execvp() or exit(). Nothing after the execvp() or exit() calls will run. For execvp(), the core image would have been replaced, so the subsequent code wouldn’t matter unless execvp() causes an error. For exit(), the process would have ended, so the subsequent code wouldn’t matter.
4. Mixing up signal() and kill(). signal() is not used to send a signal, but rather to install a customized signal handler. kill() is used to send a signal.
Here is your Lab 6.
Lab 6 is a graded exercise. Submit your solution to the IVLE workbin before Friday, 14 October 2011, 10:00pm. It is longer than the past labs, so please plan your time properly.
Lab 3 has been graded by Mr. Xiang Yongzhou. You will receive an individual email with your mark details (sent to your SoC UNIX @comp.nus.edu.sg email address). If you loose marks for reasons not specified below, please seek clarification with me or Mr. Xiang (firstname.lastname@example.org). Here are the common mistakes that students made in Lab 3.
- For Question 1, if you gave an answer with a wrong time unit (ms vs. ns), you get 0 marks.
- For Question 1, if the question asks for average time and you give total time, you get 0 marks. Partial credits of 0.5 is given if you (a) shown working but gave a wrong answer, (b) stated that the overhead is 100 times without actually calculating the overhead, (c) gave a correct answer but in a unit other than ns (e.g., 0.4ms)
- For 1(d), 0.5 mark each for the first and second part. Again, incorrect units do not earn you any marks.
- For 2(a), you get 1 mark for explaining what does defunct process mean and 1 mark for explaining why it happens.
- For 3(a), you get 0.5 for answering what are the proocesses that constitute the process group and 0.5 for explaining who is the leader. If you only list the process IDs without explaning, no marks is given.
- For 3(b), you get 1 mark for putting a negative sign in front of the process group ID. No marks for using killpg.
We have to penalized some students. You have worked hard on the labs, please do not throw away your marks due to careless mistakes and not following instructions!
- Some of you did not put down your matriculation number correctly. I gave a warning this time, but for subsequent labs, we will deduct 3 marks!
- Please submit a text file, not a MS Word document! (We deducted 3 marks for one student due to this reason).
- Please do not edit any lines starting with “#”. (We deducted 3 marks for one student due to this reason).
- Please do not start your answer with “#”. Our program treats all lines starting with “#” as special lines. My instruction is unclear this time, but we will deduct 3 marks for subsequent labs.
- For late submission, 0.1 marks per minute might sound very little, but it accumulates quickly. So please manage your time and try to finish your lab early, do not wait until the last minute.
Reminder: have you completed the mid-term feedback survey?
Here is your Lab 5.
Lab 5 is a graded exercise. Submit your solution to the IVLE workbin before Friday, 30 September 2011, 10:00pm. Please note that to align with the new opening hours of the OS lab, all lab exercises are due at 10:00pm instead of midnight.
Here is your Lab 4.
Lab 4 is a graded exercise. Submit your solution to the IVLE workbin before Friday, 16 September 2011, 11:59pm.
Here is a video demo of what you are expected to implement in this lab.
Continue reading →