The course includes a graded programming project that gives the student an opportunity to implement distributed algorithms and gain a deeper understanding of them. It is also meant to to force students to reason about which algorithms to use to achieve a certain set of system properties.

The project can be found in Canvas.

The project is done in the Kompics programming framework.

The project is done in groups of 2 students and handed in in Canvas.

Assistant Niklas Ekström created page 16 January 2013

Assistant commented 27 January 2013

The tutorial 1 document is updated with Python examples, and a PDF version is also available (found at the link above).

The Python assignments kit has been updated with docstrings for all public classes and methods in Kompics, which may provide some assistance.

Assistant commented 31 January 2013

Update about programming assignment submission and deadline:

You are now allowed to send in programming assignments until 08:00 on the morning of the presentation. But, you should also send an email before 22:00 on the evening before (Tuesday) and say that you are going to come, so that I can make a schedule and put up here. This is so that not everyone have to be there at 08:00 in the morning.

Please use "Programming assignment 1" as subject for the email with the assignment.

Assistant commented 31 January 2013

Also, the tutorial for programming assignment 2 will be after the presentations are done. The approximate time for this will be in the presentation schedule.

Assistant commented 7 February 2013

I have now sent an email to each of you with the time for your presentation. Please come on time (or preferrably be there a few minutes before).

The last time slot ends at 15:05, so if you want me to go through the tutorial for programming assignment 2 you can come at that time.

I believe that if you have done programming assignment 1 then reading up on programming assignment 2 on your own should be fairly easy.

Assistant commented 11 February 2013

For the presentation of programming assignment 2 (PA2) we will use a different approach than for programming assignment 1 (PA1).

Everyone should show up at 13:00, and everyone should bring their own laptop and be able to present themselves, even if you have been working in a group of two.

Please note that I have changed the due date for PA2 to be 11:00 on Thursday, that is one hour earlier than before!

commented 13 February 2013


How will this work? Do we not get an email with a time to persent as last time?
It would be nice to know in advance when to present since my other course's lecture(one lecture a week) collides. It would be nice to not miss the entire lectrue. 

Assistant commented 13 February 2013

Hi Johan and all,

Because of the very limited time at the last presentation we decided to try a new approach for this presenatation.

You should all come at 13:00. I have then divided you into groups of around 4 persons. Everyone in the group have done the assignment in the same language (Java/Python) and if you did the assignment in a group of two you will be in separate groups at the presentation.

You are then expected to discuss the answer to the exercises you have done among yourselves in the groups. You will do this for about 15 minutes. You should discuss the  similarities/differences between your answers, and what was challenging. I will be around to discuss with you if you have questions.

If there were any recurring questions I will try to discuss those when we reconvene after the group discussions.

For the grading I will look at the code and the report that you have submitted.

After this I will go through the (N, N) atomic register algorithm that you didn't have time to go through today, and then do the tutorial for programming assignment 3, and then we wrap up.

commented 14 February 2013

Hi, can anyone tell me whats the venue for presentation

commented 14 February 2013

According to the schedule, it is Ka-Sal E.

commented 15 February 2013

With current algorytm it's not possible to do exercises 2-4. Every set of commands like Wi:R will switch reading[r] to true and will never perform writing operation (because of latency and asyncronous nature of the operations) and reading operation will always return 0 as a value. Delay between this operations is requierd, but it will ruin the whole idea of exercise 2 and 3. What should we do?

Assistant commented 15 February 2013

Hi Dmitry and all,

What must happen is that the read must wait until the previous write has completed before the read is allowed to be invoked, since the register abstraction requires that every process is sequential (a process is not allowed to have multiple outstanding operations).

You can achieve this using the "blocking" flag in the Application component.

When you trigger the Read event, set blocking = true, and when you get a ReadReturn event, set blocking = false and call doNextCommand().

Thanks for pointing this out, and if it is still unclear, please write again.

Assistant commented 15 February 2013

(and you should also do the same for writes, set blocking = true, etc.)

One user removed his/her comment
commented 15 February 2013

We fixed the issue by putting operations that have to be delayed into a queue.

Assistant commented 15 February 2013

Just to be a little more clear about this:

Commands are dispatched in the Application component through the doNextCommand() method.

Inside doCommand(), if you do not set blocking=true, doNextCommand() will automatically go ahead with the next command in the commands queue when doCommand() returns. If you want to wait until a command gets a response before invoking the next command, then set blocking=true, and later when you get a response to the currently running command, set blocking=false and call doNextCommand().

You can look at the methods doSleep() and handleContinue() (handleApplicationContinue() in Python) in the Application component for an example.

commented 18 February 2013

Hi Niklas! Could you clarify Assignment3.Exercise4 ? What are we exactly supposed to do? Get three different lineralizations where the last written value is 1, 2 and respectively 3? Thanks for you time!

Assistant commented 19 February 2013

Hi Yuri,

The point of exercise 3 and 4 is for you to experiment with, and get a better understanding of, concurrently running read and write operations, and how they can be linearized.

In exercise 3 you should run the scenario as described in the assignment. You should then write down the values returned from the reads, and provide a linearization of all operations that is consistent with the values returned by all reads.

Start by doing exercise 3, and hopefully after that it will be clear how to do exercise 4, as described in the assignment.

One user removed his/her comment
commented 21 February 2013

Hi Niklas, 
also question about exercise 3. In our implementation we should have one node that is the leader, elected by function "select" in ELD component. This node is the only one that can propose values. So, is it right that other nodes propose values? They will never be successfull in their proposals, because they are not leaders. Am I right? Then I think that this exercise does not make sense...

Assistant commented 22 February 2013

Hi Gerard and all,

Any process can propose a value for a consensus instance. However, only a process that believes itself to be the leader will try to impose its proposal on the acceptors. This is to be able to satisfy the termination property, for otherwise two proposers might abort each other forever.

If a process has proposed a value, and then the previous leader crashes, then some other process' value can be decided.

I do think that you have a good point though. In a real system, a process that wants to propose a value would send the proposal to the current leader, who would propose that value if it hasn't already proposed some other value.

But for this assignment, let's not worry about this. Stick to the algorithms and exercises given.

commented 26 February 2013

Hi, I have a question regarding exersise 1 of assignment 4.
When discussing GC implementations do we need account for any performance implications it will have (since of course execution must be stopped for a full GC)? Should we consider a model like the "young generation" - "old generation" and a survival space in JVM or is it enough to disregard performance and discuss a full GC?

Seif Haridi edited 24 February 2014

There are six programming assignments in the course. Assignment 6 is optional with bonus points. They will be available at

Assignments are done in KOMPICS..


Assignment Open date Due date 1 2014-02-03  2014-02-13 2 2014-02-04 2014-02-13 3 2014-02-11 2014-02-18 4 2014-02-13 2014-02-23 5 2014-02-20 2014-02-273-03 6 2014-02-253-03 2014-03-103

Feedback News