R – How would YOU do/write this homework assignment? (theoretical)


I'm not asking for anyone to do this homework for me, but I bring it up because it's a very good practical introduction to C# and threading, but at the same time I feel it's perhaps a little too simple.

Is this really the best way to teach threading? what key threading concepts are "lost" in this exercize, what would new programmers using threads for the first time likely fail to observe?

I have alot of theoretical knowledge about threading but haven't had to do alot of it myself in the past, does anyone have any caveats for me when writing it?

Here's the link to the original assignment

and here is the goals text:

1) Create a thread-safe generic
circular queue class and create a GUI
to use it (See next section). In this
context, thread safe means that each
operation (method) that changes the
contents of the queue should be
executed by only one thread at a time
in order to avoid data corruption. A
circular queue is implemented as a
fixed size array where the beginning
and end of the queue are indices in
the array. As the queue fills up, the
beginning and end of the queue will
shift to higher values as elements are
added and eventually wrap around to
the first index in the array to reuse
the memory. This class should also
throw an exception (specified below)
to the caller if the operation is

2) Create a GUI to control
two threads in a producer-consumer
fashion. The GUI will be able to begin
and start and stop both the producer
and consumer threads and control the
rate at which they modify the

Best Solution