Archive for the ‘Articles’ Category

Recursively deleting symbolic link and what it points to

Recently I looked for a solution to this little problem. how do you, programmatically, delete a symbolic link and a file that it points to?
One problem that you should take care of when tackling this problem, is that symbolic link can point to a symbolic link. Then symbolic link should also point to symbolic link. [...]

Direct IO in Python

Doing file I/O of any kind in Python is really easy. You can start with plain open() and friends, working with Python’s file objects. by the way, Python’s open() resembles C’s fopen() so closely that I can’t stop thinking that open() may be based on fopen().
When its not enough, you can always upgrade to open() [...]

Rethinking linked list insertion

There is one nice thing in looking for a new job. That is, you meet lots of new people and have a chance to learn from them. For example in one of the companies I was asked about something called anti-debugging. I didn’t have a clue what that is and had to ask for an [...]

MSI-X – the right way to spread interrupt load

When considering ways to spread interrupts from one device among multiple cores, I can’t not to mention MSI-X. The thing is that MSI-X is actually the right way to do the job.
Interrupt affinity, which I discussed here and here, has a fundamental problem. That is inevitable CPU cache misses. To emphasise this, think about what [...]

Why interrupt affinity with multiple cores is not such a good thing

One of the features of x86 architecture is ability to spread interrupts evenly among multiple cores. Benefits of such configuration seems to be obvious. Interrupts consume CPU time and by spreading them on all cores we avoid bottle-necks.
I’ve written an article explaining this mechanism in greater detail. Yet let me remind you how it works [...]

Bazaar for subversion users, part 1 – the basics

Table of contents
Introduction to the series
Introduction to the article
Way of working with Bazaar
Demo setup description
Directory and user configuration
The basics
Creating a project
Checking-out the project
Adding files to the project
Committing files
Few words about revision numbers in Bazaar
Local commits or offline commits
Committing local commits to remote branch
Multi-user environment
Making modifications to files and viewing differences
Committing non-up-to-date file
Merging with the latest [...]

Distributed vs. centralized version control systems

When git appeared for the first time, I was convinced that I don’t need it. It seemed that git is good for large and distributed projects, like kernel. While my own needs where much more modest – manage a project with couple of dozen files and perhaps a couple of contributors at most.
Couple of years [...]

6 things that I miss in bash

What is the most frequently used piece of software on your computer? Here’s one program that holds one of the highest place in my list of most frequently used programs. I am talking about… bash.
In case you don’t know, this is the program behind large portion of the Linux command line. It is the program [...]

C/C++ reference counting with atomic variables and gcc

Table of contents
Introduction to the series
Introduction to the article
Way of working with Bazaar
Demo setup description
Directory and user configuration
The basics
Creating a project
Checking-out the project
Adding files to the project
Committing files
Few words about revision numbers in Bazaar
Local commits or offline commits
Committing local commits to remote branch
Multi-user environment
Making modifications to files and viewing differences
Committing non-up-to-date file
Merging with the latest [...]

pthread mutex vs pthread spinlock

Update 06/16/2009: On several occasions, commentators to this article pointed out that this post is somewhat incomplete. Therefore, before I continue, I would like to make some things clear.
Before considering the code below, please note that spinlocks are totally useless on uni-processor computers. This is due to a nature of spinlocks, which I will describe [...]