COMP 3500: Homework 2 Points Possible: 100 Note: You do not need to submit hard copies. There should be no collaboration among students. A student shouldn’t share any project code with any other student. Collaborations among students in any form will be treated as a serious violation of the University's academic integrity code. Goals: • To understand the principles of deadlocks. • To learn how to solve deadlock and starvation problems. • To collaborate and discuss deadlock problems with your group members. Questions: 1. [40 points] 2. [20 points] Suppose the following two processes, foo and bar are executed concurrently and share the semaphore variables S and R (each initialized to 1) and the integer variable x (initialized to 0). Can the concurrent execution of these two processes result in one or both being blocked forever? If your answer is yes, please give an execution sequence in which one or both are blocked forever. 3. [20 points] What is the difference among deadlock avoidance, detection, and prevention? 4. [20 points] Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free. Submission: • A heading at the top of your file contains your name and your Auburn UserIDs. • Submit your solution as a single PDF file named as “hw2.pdf” through Canvas • File formats other than PDF will not be accepted by Canvas. Late Submission Penalty: • Ten percent (10%) penalty per day for late submission. For example, an assignment submitted after the deadline but up to 1 day (24 hours) late can achieve a maximum of 90% of points allocated for the assignment. An assignment submitted after the deadline but up to 2 days (48 hours) late can achieve a maximum of 80% of points allocated for the assignment. • Assignment submitted more than 3 days (72 hours) after the deadline will not be graded. Rebuttal period: • You will be given a period of one week (i.e., 7 days) to read and respond to the comments and grades of your homework or project assignment. The TA may use this opportunity to address any concern and question you have. The TA also may ask for additional information from you regarding your homework or project.
欢迎咨询51作业君