cs作业代写_matlab代做_machine learning代写

講解NWEN303程序編程

- 首頁 >> Database作業

Assignment
4
Due date: 24 May at midnight
Topic: Solving Mailbox overflow [Total Marks: 100]
In this project you are required to edit the code of Cakes in order to solve the problem of Mailbox
overflow. You need to implement a very precise specification.
Task1
[20 Marks]
Understand and explain the given code
In your report, explain how the various classes and methods inside Cakes work.
This includes Alice, Bob, Charles, Tim, OpenAkka, AkkaConfig and Cakes: the class containing
the main method.
We expect about 1 page of text.
Task2
[50 Marks]
Solving Mailbox Overflow
Following very closely the specification below edit the file Cakes.java:
Alice, Bob and Charles are Producers.
A Producer

has a list of stored products, has a maximum size of the list of products,
and can be in running or non-running state.
A Producer knows how to answer to three messages: T, MakeOne and GiveOne.
Here is how a Producer needs to answer those messages.
?
T (a product):
? just add it to the list of products (thus, it can go over the limit).
?
MakeOne, when the list is full (the size is at or over the maximum size limit):
? sets the state to not-running.
?
MakeOne, when the list is not full:
? pipes a future product to self;
? when the future product is completed, tell MakeOne to self.
?
GiveOne, when the list is empty:
? pipes a future product to the sender.
?
GiveOne, when the list is not empty:
? removes a product from the list and tell that product to the sender.
?
(additionally) GiveOne when the state is not-running and the list is not full:
? set the state as running;
? tell MakeOne to self.
To answer those messages, a Producer can make future products.
(Since Actors need non-blocking computation, what kind of Future should it be?)
The computation actually making the product could be very long, and thus it must be asynchronous
with respect to the Producer actor, so that they will be able to keep answering other messages.
In more detail: Alice and Bob will just make Wheat and Sugar; Charles will ask Alice and Bob
for Wheat and Sugar, he will then combine the ingredients to produce a future Cake.
Tim now needs to ask Charles for cakes.
The overall process should keep the same behavior as before.
Edit the file Cakes.java:
?
Introduce an abstract actor Producer, with an abstract make() method.
?
Alice, Bob and Charles now extend Producer and implement make().
?
Tim code is adapted as needed.
?
The method Cakes.computeGift(int) can be adapted, for example to satisfy different
constructors for Charles and Tim.
?
The code as a whole keeps the same behavior as before. In particular, it can still
transparently run on a single machine or on many machines.
NOTE:
Producing cakes with sugar and wheat is, of course, just a metaphor to represent some complex
computation that needs to be performed by the various actors.
To respect this metaphor, only code under the control of Alice can produce Wheat.
In the same way, only Bob can produce Sugar, and only Charles can produce Cakes. Those cakes
must be produced using the Wheat and Sugar objects created by Alice and Bob.
A solution that breaks the metaphor, where for example Charles makes also the Wheat and the
Sugar is invalid and will not receive many marks. If you 'just try to make your code compile' you
are likely to break the metaphor.
Task3
[30 Marks]
Load balancing on multiple machines
?
Edit the class Sugar so that it now takes at least 200 milliseconds to create a Sugar
instance.
?
Then, modify Cakes so that 4 copies of Bob (the Sugar producer) are used, and reside on 4
different machines.
?
Edit the main method to instantiate those 4 Bobs and edit Charles so that he takes
advantage of the 4 Bobs.
?
In the report, describe the improvement in performance between the solution with 1 Bob
and the solution with 4 Bobs; briefly describe how you measured the performance
difference.
TO SUBMIT:
Your submission should include:
1. A jar file with all your code for Task2, without the tweaks of Task3.
Thus Task2 can be marked independently of your performance while encoding Task3.
2. A jar file with all your code for Task3, including an option to run with 1 Bob or with 4 Bobs.
This means you will submit a fair amount of duplicated code that is common for Task2 and
3.
3. Your report in pdf format
4. A txt file stating any bugs in your code and how to run your code (i.e. a readme file)

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
马来西亚代写,essay代写,留学生网课代修代考,论文代写-小精灵代写 美国Assignment代写,Economic代写,留学作业代写-RMTNR北美代写 美国作业代写,网课代考,cs代写,论文代写-ESSAYSHIFU 墨尔本代写,博士论文代写,网课代修,exam代考-熊猫代写 悉尼essay代写,CS代码代写,CS编程代写-熊猫人代写 澳洲CS assignment代写,c++/c代写,python代做-SimpleTense 悉尼代写,商科assignment代写,网课代修,论文加急-OnlyEssay 澳洲作业代写,essay代写,网课代修,exam代考-ESSAYSHIFU 代写essay,代写assignment|DRS英国论文代写留学推荐网站 Assignment代写,【essay代写】美国作业代写-留学代写ESSAY网