News for hackers. Stuff that matters.

Saltor

Re:Thread-Safe Lock Free Priority Queues in Golang on Saturday October 01, 2016 @12:16AM (#12616492)
I don't think that the implementation here performs correctly...

For example, the following:

    q := NewPrioq()
    q.In <- timestamp(20)
    q.In <- timestamp(10)
    q.In <- timestamp(30)
    o := <-q.Out
    fmt.Println("Read", o)
Prints "Read 20" rather than "Read 30".

Furthermore, this input:

    q := NewPrioq()
    for i := 0; i < 202; i++ {
        q.In <- timestamp(i)
    }
    o := <-q.Out
    fmt.Println("Read", o)
will result in a deadlock.

As far as I can tell, this code behaves like a FIFO queue with capacity 201. Each iteration of the loop in Prioq.run() will read once from the input channel, insert into the empty tree, remove the "max" element from the single item tree, and then insert into the output channel.

Reading from the input channel and writing to the output channel are performed in lockstep rather than as needed. A correct implementation of this pattern would need to use a select block and to avoid the deadlock and would need a way for writes to the output channel to be signaled as needed so to avoid the stale max value problem.

Re:Simple diet tricks for asm.js on Saturday August 27, 2016 @01:45PM (#12373347)
This (funny and accessible, don't worry) talk by Gary Bernhardt is what helped me understand asm.js for the first time: https://www.destroyallsoftware.com/talks/the-birth-and-death...
Re:Ubuntu on Windows on Wednesday March 30, 2016 @11:52PM (#11394864)
I'm hopeful that this will lead towards greater unification and innovation, but I can see why people are more likely to bring up "Embrace, Extend, Extinguish" when Microsoft does something compared to when other companies do. The difference is that Microsoft is the one who internally coined the term and used it to describe their strategies. It was a conscious and explicitly stated strategy rather than an unspoken side benefit.

You could certainly say that none of that matters and what we should care about is the actual actions that each company makes, but I can definitely see how people would read more intent into things like this when Microsoft does it compared to other companies.

Re:15-line hash table in C on Friday December 12, 2014 @05:16AM (#8739348)
I'm not. Is there some performance penalty for using a struct over a 2 element array?
Re:15-line hash table in C on Friday December 12, 2014 @04:19AM (#8739181)
why would you a 2 element array of int here instead of defining a struct of 2 ints?