Posts tagged: programming

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.

Interesting Assignment

Recently in my graduate level operating systems course, we were assigned to make a networked semaphore manager.  Essentially, client machines can connect to the semaphore manager and ask it to control access to SOMETHING.  In our case, we’re just proving a point, so we’re controlling access standard error.  It’s an interesting problem because coding anything over a network is tough.  Secondly, creating a reliable semaphore manager is tough on it’s own.  To make matters worse, we’re using a hosted environment called Inferno.  Inferno was once created by Bell Labs, but is now distributed by Vitanuova.  For reference:

LimboOh, and it’s due in two days.  Taking a bit of time off was nice, but probably not the wisest decision.

Weekend

This weekend I’m charged writing a networked semaphore manager.  In other news, I’m hanging out with Kelly all weekend.

Spring Break 2009

Spring Break 2009

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?

First Week as a Teaching Assistant

This week (Monday), I started my position as a teaching assistant for the Computer Science department at Central Michigan University.  As this was my first time as a TA, they thought it would be prudent to give me lab sections of CPS 100 (“Computers and Society”).

I have 5 sections of CPS 100, with roughly 45 people in each section.  I thought that my lab sections have gone well so far.  In fact, I even learned some things.

  • No matter how many times you explain it, some students will still staple the papers in the wrong order.
  • Stapling papers in the correct order doesn’t matter.
  • Students are generally very surprised when I walk in and stand up by the podium.  Apparently I look young.
  • The students are generally very cordial and nice when dealing with me.  Most don’t want to be there, so it’s all I could ask for I guess.
  • The technology required for Lab WILL fail.  This is not the end of the world, just kind of roll with it and there won’t be any problems.
  • I am old.  Someone called me “Mr. Slingerland”.
  • It feels nice when someone approaches you, apologizing profusely for not bringing a flash drive, because the course syllabus said that they would need one.  If everyone was this dedicated, my job would be way too easy.
  • There is a strong camaraderie between the grad assistants in the department.  We all can relate to each other, so what seems like instant friendships have formed.

That’s all I’ve really learned by teaching so far.  The first lab excercise was really simple, and having done it before class helped a lot with being prepared.

Besides that, I have 3 courses this semester.

  • CPS 650 – Compiler Construction
  • CPS 670 – Operating Systems
  • CPS 685 – Pattern Recognition and Data Mining

All these courses interest me, so I feel that I’ll do well this semester.  Between that and having an office (that I share with 4 other people) on campus, it’ll make getting homework done very easy.