联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2021-05-24 10:56

159.355 Concurrent Systems Assignment 3

159.355: Concurrent Systems

Assignment 3

Hans Guesgen

1 Introduction

This is the third assignment for this course. It is worth 25% of the marks for the course. You have one problem

to solve but with two different algorithms: the permission-based Ricart-Agrawala algorithm and the token-passing

Ricart-Agrawala algorithm.

Once you have solutions, submit a zip file containing your solution together with any comments about your code

via Stream. Make sure you include your name and Massey ID number.

Remember that the course is about concurrency. It is your solutions to the concurrency problems that we want

to see, the rest of your code should be as simple as possible. Make sure that you have included sensible comments

so that the marker can understand the code even if it is not running properly.

2 Your Task: Managing Total Social Distancing

A small village in a rural area is experiencing the outbreak of a higly infectious disease. To prevent the spread of the

disease, the 25 families living in the village decide to practise total social distancing. This means that at one time, only

one family is allowed to go shopping in the local mini mart.

Since the families live far apart from each other, they can only communicate by passing messages between each other.

Luckily, one of the families has a computer scientist in the family, and she remembers the Ricart-Agrawala algorithms from

her concurrent systems class. After some brief discussion, the village decides to use these algorithms to determine who

can go shopping next.

Write two simulations for this scenario using the permission-based Ricart-Agrawala algorithm and the tokenpassing

Ricart-Agrawala algorithm. Include print statements in your code that show the workings of the algorithms.

Test your algorithms multiple times to convince yourself that no two families are in the mini mart at the same

time and that no deadlock occurs during the simulation.

You might want to use one of the BlockingQueue classes to implement send() and receive(), but this is not

mandatory.

Massey University 1 ?Hans Guesgen


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp