The goal of these assignments is to develop the skills of designing and implementing distributed protocols over multiple machines. They are more about designing and understanding the protocols/systems rather than programming.
Assignment 1 is a simple application of MapReduce. It familiarizes you with the Go language and the distributed coding environment.
Assignment 2 works on a more complicated protocol—distributed snapshot. It expects you to tackle more challenging designs.
Assignment 3 and 4 implement Raft, a complex consensus protocol. It expects you to solve difficult problems in distributed systems.
- Start early. These assignments are difficult.
- Understand the protocols and work out your design first before coding.
- Code progressively. (Finishing an assignment in one sitting is impossible!)
- Save your progress frequently. Use Git!
- You can develop your code on any OS, e.g., MacOS, Windows, Linux. Please note that TAs will grade your assignments on Ubuntu.
- The assignments are written in Go. The tests are known to work with Go v1.13 and above.
- Git is required for assignment submission.
There are some useful tools in the Go ecosystem, e.g., Go fmt, Go vet, and Golint. These tools could make your coding easier, but you do not have to use them.
For those who are used to Emacs and Vim, there are some resources for Go development, e.g., go_in_emacs (additional information available here) and go_in_vim (additional resources here).
For those who are used to Sublime, there are some useful Sublime packages for Go development: GoSublime and Sublime-Build, and Go-Plus (walkthrough and additional info here).
JetBrains Goland is also a good option. It's a useful, full-featured Go IDE. You can get a free educational account with your UB email address.
Good coding style is always important, and sometimes necessary, e.g., in large collaborative projects. Your code should have proper indentation, descriptive comments, and a comment header at the beginning of each file, which includes your name, student id, and a description of the file. A good coding style is always consistent, e.g., the same format for all comments throughout your code. We do not grade your code based on the style, you earn full credits as along as the code passes all tests, but you should prepare yourself (starting from now) for future real-world projects.
It is recommended to use the standard tools gofmt and go vet. You can also use the Go Checkstyle tool for advice on how to improve your code's style. It would also be advisable to produce code that complies with Golint where possible.
Version control is necessary for developing large collaborative projects while working as a team. These assignments are individual, but you will be familiarized with the basic functions of Git. Please read this Git Tutorial.
The basic Git workflow in the shell (assuming you already have a repo set up):
- git pull
- do some work
- git status (shows what has changed)
- git add all files you want to commit
- git commit -m "brief message on your update"
- git push
All programming assignments require Git for submission.
We use Github for distributing and collecting your assignments. (You need to create a Github account if you have not done so.) You now should have your working copy of the assignments on Github, named labs-fall22-[your_github_username], by joining the Github classroom. It should be private. Never make it public or share it with anyone else; otherwise, it is a violation of academic integrity. To work on the assignments on your local machine, you need to clone the repository from Github to your machine. Normally, you only need to clone the repository once.
$ git clone https://github.com/Distributed-Systems-at-Buffalo/labs-fall22-[username].git 586
$ cd 586
$ ls
assignment1-1 assignment1-2 assignment1-3 assignment2 assignment3 assignment4 README.md
$
Now, you have everything you need for doing all assignments, i.e., instructions and starter code. Git allows you to keep track of and save the changes you make to the code. (This is why it's called version control.) For example, to checkpoint your progress, you can commit your changes by running:
$ git commit -am 'partial solution to main 1-1'
$
Commit is to package your recent changes on your local machine, snapshot it with a version number, and allow you to revert some changes or go back to previous version (commit) of your code. At this point, your code is mostly safe, e.g., accidentally deleting some lines/files is not the end of the world (ctl+z cannot save you in this case but Git can allow you to restore the code to some recent commit.) You should do this regularly!
Commit is mostly safe because your local machine could fail/crash. You should always pair commit with push. Push is to upload your commits to Github (a remote fault-tolerant machine). You can push your changes to Github after you commit with:
$ git push origin master
$
After push, you should be able to see your recently pushed commits on Github website. Please let us know that you've gotten this far in the assignment, by pushing a tag to Github. A tag is a descriptive flag attached to a specific commit.
$ git tag -a -m "i got git and cloned the assignments" gotgit
$ git push origin gotgit
$
As you complete parts of the assignments (and begin future assignments) we'll ask you push tags. You should also be committing and pushing your progress regularly. We grade your assignments by pulling your tagged commits from Github. So please push and tag your submission commit! We do not grade your unpushed commits on your local machine.
Now it's time to go to the assignment 1-1 folder to begin your adventure!
Some of the assignments are adapted from MIT's 6.824 course. Thanks to Frans Kaashoek, Robert Morris, and Nickolai Zeldovich for their support.