Working on something way out of my league for learning purposes (multi-threading and c#)

So we've been given a (very) brief introduction to concurrency. It wasn't a very fleshed out session, but either way I've decided to take on a small project.

The project is to design a concurrent car park simulation.

There are four entrances, and a single car can occupy one section at a time (A section is one rectangle in the below picture). So if there is another car waiting to occupy that section, it must wait till it is free. The vehicles should adhere to the normal one-way policy. Once a vehicle is in it's parking lot, the button turns from green to red (to show it is taken). We should be able to press the red button to release that vehicle.

http://ift.tt/1WcEGVa

So here's what I've decided so far.

Each section will be it's own thread To pass a car object from one thread to another we will use a buffer The interface can be designed by using C# "Panels" to represent a section A "car" can be an object (With a specific color and speed) So first off, Is it right to use "Panels"? Also, How would I go about assigning a thread to these panels to run concurrently? I've tried searching the web but could not find it. Would it be more advisable to hard code in the GUI? That is making rectangle Graphic objects?

Basically what I'm looking for is, the best way to implement this, an explanation if possible and Any tips/Reading material to guide me towards accomplishing specific tasks would be great as well.

Thank you

by Ridwan232 via /r/csharp

Leave a Reply