Exercises for lesson 2, TDDD82 System softare module, Linköping University Q1: The figure below shows the resource allocation graph for five processes and thre resource types (R1,R2, and R3). Assume that this represents the system state at a specific moment in time. (a) Is the system currently in a deadlock state? (b) Assume now that the arrows in the graph also represent the maximum number of resources that a process can request. Is there a sequence of resource assignments that allow all processes to finish their executions without the system ending up in a deadlock? P2 P1 P3 R1 R3 P5 R2 P4 Q2: Describe how synchronization between processes can be accomplished with the help of the monitor concept. What mechanisms are there that support the application programmer? Exemplify this method by describing a system where two processes produce sensor values and a third process combines those values and outputs a result. Assume that the sensors produce data at different rates and that the combination process should use a pair of elements (one from each sensor) every time. Q3: Argue how parallelism occurs in computer systems and the use of modelling it. Exercises for lesson 2, TDDD82 System softare module, Linköping University Q4: (a) The folloing pseudocode uses the semaphores wait and signal with the purpose of achieving mutual exclusion of a shared resource. Does this implementation achieve the objective? If so, explain why. If not, provide a trace from the execution of the processes leading to an unwanted result. process P1 signal(mutex) critical_section_1 signal(mutex) non_critical_section_1 end Process P2 wait(mutex) critical_section_2 signal(mutex) non_critical_section_2 end (b) Explain what happens in the system if a. P1 crashes while in its non-critical section, (non_critical_section_1). b. P2 crashes while in its non-critical section. Q5: Consider two communication services in asynchronous distributed systems. Messages that are treated by service A can be lost, duplicated, or delayed and checksum is only used on the header field. For service B, messages can be lost, delayed or delivered in a too high rate to be processed by the receiver, but always with the correct content. Describe the fault model for each service and explain how the fault may affect validity and integrity properties. Is service B a reliable communication service? Q6: Consider a simple Internet server that respons to client requests without querying other servers. Explain why it is not poessible to set a bound on the time the services takes to respond to the client. What would be required to guarantee that the server responds within a specified time interval? Is your proposal reasonable? Q7: Explain the difference between permanent, transient and intermittent faults, and give one example for each kind. Q8: Consider a replicated service that is implemented using three processes. Assume that every node has a MTTF = 5 days, and that it takes 4 hours to repair a failure. What is the availability of the replicated service? Q9: Explain with the help of an example the concept of consistency in connection with state transfer in distributed systems.