$30
Planets!
Homework #2, CSCI 322
Geoffrey Matthews
January 23, 2015
Description: This is a continuation of homework #1. Fix any errors in your version of
planets02.rkt (see me if you need help) and then create two new versions of this
program:
1. A program called planets03.rkt that uses a new thread for each planet, and
also uses the synchronization methods in The Little Book of Semaphors, Listing
3.10, to assure that all planet forces are updated before any planet moves, and
that all planets move before any update their forces.
2. A program called planets04.rkt that behaves just like planets03.rkt except
that the thread that refreshes the view does not execute while the planets are
updating their positions. It can update the view any time the planets are calculating their forces, but not when they are changing their positions. Make sure you
use only basic semaphores (semaphore-post and semaphore-wait) to accomplish
this task.
Give meaningful names to all your semaphores, and explain in the comments in
the file how your program assures that refresh never happens while the planets
are moving. If you use an example from The Little Book, reference it and discuss
how it works in our example.
Due date: Friday, February 6, midnight. 50% of this assignment’s grade points for each
stage.
1