COMP3520 Assignment 1 Discussion Document 2019
COMP3520 Operating Systems Internals Assignment 1 – Discussion Document
General Instructions
For the discussion document, all questions are compulsory. You must make a genuine attempt at questions. An attempt at a question is considered genuine if and only if it is honest and serious.
You must attempt this part of the assignment individually. You will be required to submit your work to Turnitin for similarity checking as part of assignment submission.
You must cite and reference all copied or paraphrased material that are not your own. Any suitable referencing scheme may be used. Where practical, you should use your own words.
You may use diagrams to support your written answers.
Please label your answers with the correct question numbers but do not repeat the question.
Submit your discussion document to the appropriate submission inbox in the COMP3520 Canvas website.
The discussion document is worth 20 % of full marks for Assignment 1. Marking criteria are included in a separate document.
You may use a total number of 2-3 pages, but no more than 5 pages for all your answers to these questions.
1
COMP3520 Assignment 1 Discussion Document 2019
Questions
In your answers, you will be assessed on how well you:
• Demonstrate understanding of relevant operating systems concepts; and
• Present logical responses using appropriate information and ideas. Question 1 (1 point)
Explain the purpose of a condition variable.
Question 2 (1 point)
Consider the function call pthread_cond_wait(&a_condition_variable, &a_mutex). Assume that a_condition_variable and a_mutex have been correctly initialized. Explain why it is an error to call this function if the mutex is unlocked just before the call.
Question 3 (3 points)
In addition to the pthread_cond_wait() function, the pthreads library offers a pthread_cond_timedwait() function that is useful for solving certain types of synchronization problems. Consult the Linux man page for a detailed description of this function.
Describe ONE scenario where you would use the pthread_cond_timedwait() function. Justify your answer.
Question 4 (9 points)
In English and pseudocode, describe and justify the methods that you have used to deal with the synchronization issues on teacher-students coordination in the Group Lab Exercise problem, e.g., how are the students assigned ids by the teacher, how will the students know when it is time for them to enter the lab and do the exercises, and how long they need to complete their exercises (i.e., the students in the same group need to leave the lab room at the same time).
Question 5 (6points)
Discuss in depth how you analysed and tested your methods and program to make sure that your program produces the correct output and has no bugs. If your program is unable to meet the requirements of the assignment, please discuss the potential problems in your methods and program and possible ways to solve these problems.
2