Category: Programming

  • The GNU Configure and Build System

    The GNU Configure and Build System consists of autoconf, automake, and libtool. I wrote an essay about them a long time ago. Slightly more recently I was a co-author of a book about them. David MacKenzie started writing autoconf way back in 1991. I was an early beta-tester and contributed some early features. autoconf generates…

  • Hyperthreaded Memory

    One thing I didn’t really touch on in my earlier notes on multi-threaded programming is memory. As processors become increasing hyperthreaded and multicored, access to shared memory becomes the bottleneck. The obvious recourse of processor designers will be to break the sharing: each processor will have its own memory. We already see this in the…

  • Gcc vs. Users

    Development of the gcc compiler faces recurring tension between people who want gcc to generate better code and people who want gcc to support their style of programming. The languages which gcc supports all have standards which are intended to provide an interface between the programmer and the compiler. The programmer can assume that the…

  • Single Threaded Memory Model

    One more round on the parallel programming theme. There has been some recent discussion on the gcc and LKML mailing lists about an interesting case. static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static int acquires_count = 0; int trylock() { int res; res = pthread_mutex_trylock(&mutex); if (res == 0) ++acquires_count; return res; } On x86 processors, current…

  • Gold Workqueues

    The gold linker is multi-threaded. I’ll sketch the implementation I chose. I wanted to avoid using lots of fine-grained mutexes, because they are both error-prone and expensive. Instead, I used a workqueue system. This requires breaking up the job into, essentially, a state machine. The whole link is defined as a series of relatively independent…