Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Homework (Week 8) Term 2, 2020 Announcements Course Outline Course Schedule Glossary Maths Resources Moodle - BB Collab Piazza Forum Assignment 0 Spec TeX Guide Web Submission Assignment 1 Spec TeX Guide Web Submission Assignment 2 Spec Web Submission Java Resources Monitors Video Multithreading Video Semaphores Video Volatile Video Web Tutorials Week 1 Homework Monday Board Recording Slides Condensed Slides Thursday Code Slides Condensed Slides Week 2 Homework Thursday Slides Condensed Slides Week 3 Homework Monday Brownies Promela Samples Slides Condensed Slides Thursday Code Slides Condensed Slides Week 4 Homework Monday Slides Condensed Slides Thursday Slides Condensed Slides Week 5 Homework Monday Slides Condensed Slides Thursday Slides Condensed Slides Week 7 Homework Monday Slides Condensed Slides Thursday Slides Condensed Slides Week 8 Homework Monday Slides Thursday Slides Week 9 Homework Monday Slides Thursday Slides Week 10 Notes Homework (Week 8) Table of Contents 1. Ricart-Agrawala Algorithm 2. Token-Passing 3. Actor Model vs. CSP-style Channels Submission: Due on Thursday, 30th of July, 6pm Sydney Time. Please submit using the CSE Give System either online or via this command on a CSE terminal: give cs3151 hw7 hw7.pdf 1 Ricart-Agrawala Algorithm Pseudocode of the Ricart-Agrawala Algorithm is: a) Suppose that we exchanged the lines p8 and p9–p11 in Main, i.e. \(\textsf{requestCS} \leftarrow \textsf{false}\) now executes after the for loop (instead of executing before the for loop). Provide an example in which the modified algorithm is no longer correct. b) In \(\textbf{Receive}\), can the statement \(\textsf{p2:}\ \textsf{highestNum} \leftarrow \textsf{max}(\textsf{highestNum}, \textsf{requestNum})\) be replaced by \(\textsf{p2:}\ \textsf{highestNum} \leftarrow \textsf{requestNum}\)? Why? Justify your answer and provide an example. In both parts of this question, you can sketch diagrams in addition to textual explanations. However, if your textual explanations are clear, such diagrams might be unnecessary. 2 Token-Passing Pseudocode of the Ricart-Agrawala Token-passing Algorithm is: a) In node \(i\), can the value of \(\textsf{requested}[j]\) be less than the value of \(\textsf{granted}[j]\) for \(j \neq i\)? Why? Justify your answer. b) In node \(i\), can the value of \(\textsf{requested}[j]\) be greater than the value of \(\textsf{granted}[j]\) for \(j \neq i\)? Why? Justify your answer. 3 Actor Model vs. CSP-style Channels Compare and contrast actors in the actor model with the CSP (Communicating Sequential Processes) channels: a) Identify at least 2 similarities. b) Identify at least 3 differences and for each of them provide example circumstances in which actors or CSP channels have advantages or disadvantages. 2020-08-06 Thu 03:32 Announcements RSS