Real-time thirsty

The TL;DR:
In this post, I show using a fictitious example why real-time systems are defined by their worst-case timing rather than their average-case timing.

Imagine you’re running a coffee shop — not the kind you find in Amsterdam, but one where they actually serve coffee. Your customers are generally in a hurry, so they just want to get a cup of coffee, pay and leave to catch their plane, train or automobile. To attract more customers and appeal to the Geek crowd, you name your coffee shop “Real-Time Thirsty” and promise an “Average case serving within one minute!”.

While you get many customers, you’re not getting the Geeks-in-a-hurry crowd you were expecting.
Continue reading

Posted in Algorithms, Software Engineering | Leave a comment

Setting up Cygwin for X forwarding

The TL;DR:
This is one of those “recipe” posts that tend to be useful if you happen to want to do exactly what I just did. The end result of this one is a Windows shortcut called “Linux terminal” on the desktop, that opens up an SSH terminal to a Linux box, with X forwarding.

Continue reading

Posted in Notes, Technology | Comments Off on Setting up Cygwin for X forwarding

Shutting down servers

I used to have a server with five operating systems, running in VMs, merrily humming away compiling whatever I coded. I say “used to have” because I shut it down a few weeks ago. Now, I have those same operating systems, as well as a large number of others, running on systems I don’t need to worry about.
Continue reading

Posted in Continuous Integration, Software Development, Software Engineering | Comments Off on Shutting down servers

Checked output iterator

While writing about security — which takes a great deal of my time lately, which is one of the reasons I haven’t updated my blog as often as I usually would — I came to the conclusion that, while I recommend using STL algorithms, iterators and containers for safety purposes that doesn’t solve the problem when the standard algorithms don’t check the validity of their output ranges.
Continue reading

Posted in Uncategorized | Comments Off on Checked output iterator

Schoenmaker, blijf bij je leest (Cobbler, stick to your last)

This is an old Dutch saying, which probably has its origins in a village with a particularly opinionated cobbler.

I am not one to stick to my last — but if I were a cobbler, I don’t think I’d be that cobbler: I like to know what I’m doing.
Continue reading

Posted in Opinions, Uncategorized | Tagged | Comments Off on Schoenmaker, blijf bij je leest (Cobbler, stick to your last)

Interesting modifications to the Lamport queue, part II

In the previous installment, on this subject, I described a few modifications to the Lamport queue introduced by Nhat Minh Le et al. to relax operations on shared state as much as possible, while maintaining correctness.

In this article, I will discuss the further optimizations to reduce the number of operations on shared state, thus eliminating the need for memory barriers completely in many cases.
Continue reading

Posted in Algorithms, C & C++, Interesting stuff | Comments Off on Interesting modifications to the Lamport queue, part II

Interesting modifications to the Lamport queue

While researching lock-free queue algorithms, I came across a few articles that made some interesting modifications to the Lamport queue. One made it more efficient by exploiting C11’s new memory model, while another made it more efficient by using cache locality. As I found the first one to be more interesting, and the refinements more useful for general multi-threaded programming, I thought I’d explain that one in a bit more detail.
Continue reading

Posted in Algorithms, C & C++, C++ for the self-taught, Interesting stuff | Comments Off on Interesting modifications to the Lamport queue

Progress in DNP3 security

In July last year, I discussed why Adam Crain and Chris Sistrunk fuzzed DNP3 stacks in devices from various vendors, finding many issues along the way (see project Robus). This time, I’ll provide a bit of an overview of what has happened since.
Continue reading

Posted in DNP3, Smart Grid | Comments Off on Progress in DNP3 security

CIS: “Protecting” code in stead of data

The Windows API contains a synchronization primitive that is a mutual exclusion device, but is also a colossal misnomer. I mean, of course, the CRITICAL_SECTION.

Continue reading

Posted in Common Issues with Synchronization | Tagged , | Comments Off on CIS: “Protecting” code in stead of data

CIS: Lock Leaks

The two most popular threading APIs, the Windows API and pthreads, both have the same basic way of locking and unlocking a mutex — that is, with two separate functions. This leaves the code prone to lock leak: the thread that acquired a lock doesn’t release it because an error occurred.

Continue reading

Posted in Common Issues with Synchronization | Tagged | Comments Off on CIS: Lock Leaks