Programming in Linux 2.6

Some excerts from this article (login required).

The article may be a bit old, but the information is useful for those programmers still switching over to the 2.6 kernel.

Synchronous IO:

One feature new to all filesystems is synchronous directories. With a slight performance penalty, changes made in a synchronous directory are committed to disk before control returns to the caller. To make a directory synchronous, run chattr +S /some/directory. To verify that the bit is set, use lsattr -d /some/directory.

Access Control Lists:

…grant access to several users that are unrelated (at the system level, at least). In 2.6, fine-grain permission can be achieved with access control lists (ACLs). An overview of the ACL system is provided in the acl man page. C and C++ programs can alter ACLs using the acl_ set_file() system call.

epoll() System Calls:

Graphical user interface (GUI) programs and some daemons use poll() to watch for changes on a file. The new epoll system works like poll(), but is much more scalable: whereas poll() scrolls through its entire list of file descriptors to check for events, epoll registers callbacks on its file descriptors that fire when an update occurs.

This is simply much more efficient from a system efficiency perspective!

Profiling user domain applications with the kernel:

The new 2.6 kernel exposes a system-wide profiling interface that doesn’t require intrusive recompiles. It also supports profiling the kernel itself, and the system as a whole. In turn, the OProfile toolkit ( pulls in trace data via this kernel interface.


For one, the kernel itself is preemptive: some kernel-space operations can be interrupted to yield to user processes.

Second, the kernel is based on a 1:1 model, in which a kernel thread is available for each user thread. The internal O(1) scheduler lets the kernel efficiently handle a greater number of threads than previous versions, so this doesn’t burden the system. Better still, thread creation and tear down are both faster and less costly.

Kernel 2.6 includes support for the Native Posix Thread Library (NPTL).

Core File Naming

# sysctl -w kernel.core_pattern="core.%h-%p-%u"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s