Tag Archives: Limbo

Circular Queue

If you float around Computer Science / Programming circles enough, it’s likely that you’ve come across the term “circular queue”.  A circular queue is a queue of <something> that is fixed in size, and when the end of the queue has been reached, it circles back to the front and starts pushing items from there.  If the head catches up to the tail, the queue is said to be full.  In C style languages, circular queues can be implemented using pointers fairly easily.  In my case though, I don’t have pointers, so I’m just keeping two variables (head, tail) that tell me where the import parts are.

Some people might wonder “Why on earth are you implementing a queue by hand?”, which is valid question.  The answer is because there is now STL-type library in Limbo, so implementation of a queue falls into my lap.  I suppose this post doesn’t have much of point, except to say “Use the friggin’ library if it’s available.”.  For one, it’s already been done, and two, it’s probably bug free.

Functional Programming with Erlang

For the past 8 weeks in my graduate operating systems course, we’ve been dealing with the issues of inter-process communication in massively parallel situations.  For development of such applications, we’ve been using an operating system called Inferno (of Plan 9 origins) which has a built in language called Limbo.  Limbo is a great language for learning network programming and multi-threaded programming.  It has communication channels which are typed, so you can pass whatever you want along them without pre-processing the data.  However, you still have to manage all of those channels.  It also has a nice C + Pascal style syntax:

message := “Hello World!”;
sys->print(“%s\n”, message);

While discussing languages that support massive concurrency with my professor, the subject of functional programming came up.  I mentioned to him that I wanted to learn a functional language, but wasn’t sure where to start.  He suggested Erlang due to it’s easy support for massive concurrency.  My question to my readers (if I have any left), is do you have any experience with programming multi-threaded and/or distributed programs with Erlang?  Is it worth the time to learn, or would my efforts be better off elsewhere?