Skip to content

Instantly share code, notes, and snippets.

@kvu787
kvu787 / queue.md
Last active February 27, 2016 18:54

A distributed queue over RDMA

We implement a queue using RDMA compare-and-swap and fetch-and-add operations. It borrows ideas from the CRQ algorithm. Because it uses a single fixed size circular array, it is non-blocking only for buffered enqs, in contrast to LCRQ which is non-blocking for an arbitrary number of enqs [1].

[1] http://www.cs.technion.ac.il/~mad/publications/ppopp2013-x86queues.pdf

It satisfies the following properties:

// Package queue implements a multi-producer, multi-consumer, unbuffered
// concurrent queue using atomic compare-and-swap operations.
// It has equivalent semantics to an unbuffered Go channel.
package queue
import (
"runtime"
"sync/atomic"
)
@kvu787
kvu787 / gotest.sh
Last active February 23, 2016 19:26
# usage: bash gotest.sh <directory to put test results in> <count>
#
# example:
# cd ~/452-labs/src/paxos
# bash gotest.sh testdir 10
#
# to kill a gotest.sh, run:
# ctrl-z (pause process)
# kill %% (kill most recently paused process)
@kvu787
kvu787 / tcp.go
Last active December 1, 2015 00:21
package main
import (
"fmt"
"net"
"os"
)
const Message string = "Hello World!\n"
const ServerPort string = "173.250.148.245"
@kvu787
kvu787 / AssassinManagerTest.java
Last active December 26, 2015 07:49
See class comments
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.After;
@kvu787
kvu787 / cse143_hw_shower.js
Last active December 24, 2015 03:39
see comments
// Visit courses.cs.washington.edu/courses/cse143/13au/homework.shtml or
// https://courses.cs.washington.edu/courses/cse143/13au/homework.shtml and run
// this snippet of JavaScript to display otherwise hidden homework assignments.
//
// Note that the revealed assignments are probably old ones.
(function () {
"use strict";
// display commented content
import os
import glob
class Directory(object):
"""Creates wrapper object for a directory.
Attributes:
path: str, relative path to directory.
"""