首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
COMP 10183代写、代做Java编程语言
项目预算:
开发周期:
发布时间:
要求地区:
COMP 10183 Assignment 2
Fall 2023
Overview
In this assignment you will be demonstrating your knowledge of creating and maintaining threads
and using mutual exclusion techniques taught in class to protect critical sections of code to
prevent data races.
Assignment #2 is a more complex teams based race. In Assignment #1 you just needed to track
how long it takes 20 racers to cross the gorge. In this assignment, the racers are divided up into
5 teams of 4 racers each, and they must cross the gorge in both direction.
The Problem
You will be simulating adventure racing teams moving across a gorge on
a ropes course. Each adventure team consists of four members, who
must all cross the gorge, the team may then claim the ropes course
medallion and then all four team members must cross the gorge back to
continue on in the race.
The gorge consists of three rope crossing points.
There is no way to pass another racer on the
rope and each rope can only support one racer
for safety, so a racer may only enter a rope if it is
empty.
You do not need to worry about starvation for this assignment. If an adventure racing team or
single racer has to wait some time for their turn on the rope that is ok, this is a race, no need to
try and implement fairness or sharing.
For this assignment you should not assign racers to ropes in advance. Because racers must go in
both directions, and the race will be won by the team that finishes first, pre-assigning racers to
ropes would create a major disadvantage.
The Design
The design for this simulation should follow the basic UML class diagram given below. You may
add any variables or methods you feel are necessary to solve the problem. Notice that this design
includes 5 AdventureTeams. You will need a total of 25 threads, a thread for each racer, and a
thread for each racing team. The racing team can make decisions about which rope to select.
For all threads to see the three RopeCrossing objects, you may declare these three objects as
static in your main thread (the RaceSimulation class).
Concurrency and Performance
In the main method, 20 racers will arrive at the beginning of execution. Each racing team needs
time to set up their gear, which can randomly take between 200 and 400 milliseconds. Once a
team is ready, racers can begin crossing. Each racer must individually select a rope to cross. No
racer may make a return crossing until all their team mates have crossed.
The racer will take between 400 and 600 milliseconds to cross the gorge on the rope, which will
be determined randomly.
5 racing teams concurrently set up their equipment: Average time = 300 ms
20 racers use 3 ropes to cross the gorge. Average time = 20 * 500 ms / 3 = 3.3 seconds.
20 racers use 3 ropes to re-cross the gorge. Average time = 20 * 500 ms / 3 = 3.3 seconds.
Total race time should be at least (2 * 3.3s + .3s) = 6.9 secs, usually it will be a little longer.
The JVM may not award the rope’s lock to the racer’s in a FIFO (first-in-first-out) manner. This is
correct behaviour and does not need to be changed or managed. It is luck of the draw if the racer
is able to grab the rope when available for their direction.
You will need a way to track when all four members have crossed the gorge and the team can
claim their medallion. Consider using a simple atomic integer counter owned by the team.
To obtain full marks, communication between the threads should be using wait – notify, not busy
waiting. The use of timed sleep in the code is only to represent the racer doing something (setting
up or crossing the rope). Solutions that rely on busy waiting will receive a penalty.
Once all four team members have made it across, the team may claim their medallion and begin
to cross back. Make sure the team members do not start crossing back until all members have
crossed in the first direction. Each racer must individually select a rope to cross and it will take
the racer a random amount of time. Their second crossing time may be different from their first.
Once the team has completed the round trip crossing, they should print their success to the
terminal and then all threads corrrespoding to the team and it’s racers may terminate. As each
racer completes the round trip, you many terminate that individual thread for that racer.
Your program should track and display the following, in order to demonstrate correct
performance:
• Time it takes each team to set up it’s gear
• Each time a team member successfully crosses the gorge
• The time since the simulation started that each team finishes at
o You should maintain a global start time, so each team can compute their end time
• The total number of racers to cross on each rope
• The total execution time, this will the same as the time of the losing team.
For the output, make sure to clearly identify the Team and which Team Member. This can be
done using integers (like done below) or you can name the Teams and Members using Strings.
Sample Output
The following output confirms correct simulation details in several ways. Total time is a little bit
over 6.9 seconds. Team 3 is the loser, their cross time = total simulation time. The sum of the
number of racers to cross the ropes adds up to 40, i.e. 20 racers in each direction. The number
of racers is well balanced, i.e. about the same # use each rope.
Team 2 currently setting up gear for 233 ms
Team 4 currently setting up gear for 291 ms
Team 0 currently setting up gear for 297 ms
Team 3 currently setting up gear for 270 ms
Team 1 currently setting up gear for 318 ms
Team 2, Member 3 crossed Forward on Rope #0 in 407 ms
Team 2, Member 4 crossed Forward on Rope #1 in 527 ms
Team 2, Member 1 crossed Forward on Rope #2 in 533 ms
Team 0, Member 3 crossed Forward on Rope #0 in 443 ms
Team 4, Member 4 crossed Forward on Rope #2 in 407 ms
Team 3, Member 1 crossed Forward on Rope #1 in 432 ms
Team 4, Member 2 crossed Forward on Rope #0 in 506 ms
Team 3, Member 4 crossed Forward on Rope #1 in 459 ms
Team 1, Member 2 crossed Forward on Rope #2 in 558 ms
Team 0, Member 4 crossed Forward on Rope #0 in 507 ms
Team 1, Member 4 crossed Forward on Rope #1 in 451 ms
Team 2, Member 2 crossed Forward on Rope #2 in 507 ms
Team 2 successfully obtained medallion
Team 3, Member 3 crossed Forward on Rope #0 in 404 ms
Team 0, Member 2 crossed Forward on Rope #1 in 513 ms
Team 4, Member 1 crossed Forward on Rope #2 in 423 ms
Team 0, Member 1 crossed Forward on Rope #0 in 405 ms
Team 0 successfully obtained medallion
Team 4, Member 3 crossed Forward on Rope #1 in 472 ms
Team 4 successfully obtained medallion
Team 2, Member 3 crossed Back on Rope #2 in 471 ms
Team 2, Member 4 crossed Back on Rope #0 in 553 ms
Team 2, Member 1 crossed Back on Rope #2 in 472 ms
Team 0, Member 2 crossed Back on Rope #1 in 561 ms
Team 4, Member 2 crossed Back on Rope #2 in 423 ms
Team 0, Member 3 crossed Back on Rope #0 in 595 ms
Team 1, Member 1 crossed Forward on Rope #1 in 561 ms
Team 0, Member 1 crossed Back on Rope #2 in 591 ms
Team 4, Member 1 crossed Back on Rope #0 in 587 ms
Team 3, Member 2 crossed Forward on Rope #1 in 457 ms
Team 3 successfully obtained medallion
Team 2, Member 2 crossed Back on Rope #2 in 428 ms
Team 2 completed crossing, total time since race started = 5.077 secs
Team 4, Member 3 crossed Back on Rope #0 in 506 ms
Team 1, Member 3 crossed Forward on Rope #1 in 587 ms
Team 1 successfully obtained medallion
Team 0, Member 4 crossed Back on Rope #2 in 537 ms
Team 0 completed crossing, total time since race started = 5.618 secs
Team 4, Member 4 crossed Back on Rope #0 in 587 ms
Team 4 completed crossing, total time since race started = 5.77 secs
Team 3, Member 2 crossed Back on Rope #1 in 587 ms
Team 3, Member 4 crossed Back on Rope #2 in 506 ms
Team 1, Member 4 crossed Back on Rope #0 in 541 ms
Team 1, Member 2 crossed Back on Rope #1 in 494 ms
Team 1, Member 1 crossed Back on Rope #2 in 436 ms
Team 1, Member 3 crossed Back on Rope #0 in 455 ms
Team 1 completed crossing, total time since race started = 6.771 secs
Team 3, Member 1 crossed Back on Rope #1 in 447 ms
Team 3, Member 3 crossed Back on Rope #2 in 463 ms
Team 3 completed crossing, total time since race started = 7.03 secs
The number of racers to cross Rope #0 was: 13
The number of racers to cross Rope #1 was: 13
The number of racers to cross Rope #2 was: 14
Total Simulation time = 7.034 seconds
Submission
You will submit your java code in a zip folder to the submission folder on MyCanvas. There is no
need to zip up the entire project, you just need to include all of the .java files in the zip folder.
Grading
You will be evaluated on the following:
• Code Formatting and Documentation – 20%
o Code is readable
o Javadoc and commenting are complete
▪ No need to generate Javadoc in html files
• Code Execution and Performance – 40%
o Submission correctly solves the above problem
▪ Output very similar to sample
▪ Appropriate delays are measured
o timing and performance are good
▪ close to 6.9 seconds run time
▪ well balanced use of ropes
• Code Structure – 40%
o Code uses the correct programming concepts to solve the problem
▪ follows the UML design specification
▪ should use wait() / notify() and locks(), where appropriate
▪ penalty for using busy waiting
▪ penalty for accessing global variables without proper synchronization.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!