Saturday, May 18, 2013

Expression Templates: A Performance Analysis

Here is a link(PPT Link PDF Link) to a short presentation given by me recently on Expression Templates. The presentation has been adapted from the paper: "Expression Templates Revisited: A performance analysis of current methodologies" by K.Iglberger et. al.


Saturday, May 4, 2013

How to make your Linux System unbootable (and remedy it)...

This happened almost a week back, when I turned on my laptop and was greeted with a black screen instead of the usual tri-colour desktop. Scared because I had already invested too much time in preparing the machine and just the thought of having to do all that again gave me jitters. Fortunately, this time I was able to figure out the problem without having to spend too much time.

In a nutshell, if you want to make your system unbootable (or just want to scare off someone ;)

  1. Select a partition (or create a new one)
  2. Mark it such that it is mounted at boot-time
  3. Assign some random options to be used with the mount command at boot-time 
That's it! The interesting bit that makes the system unbootable is that instead of proceeding with the normal boot-up process in case a partition can't be mounted, the system just gives up. 

In my case, I had just created a partition using Applications->System Tools->Preferences->Disks utility (Ubuntu 12.10) to be auto-mounted at boot-time at /opt. However, as it turned out, the default options that 'Disks' utility sets for a partition do _not_ work. Following is a screenshot showing the default options that 'Disks' uses for a partition:


As can be seen in the section 'Mount Options', Disks utility uses the options: 

nosuid,nodev,nofail,x-gvfs-show 

for the partition. The major culprit here is the 'x-gvfs-show'  option which as of now gives an error when used with the mount command. Here is the relevant bug-report.

What really this 'Disks' utility(?) does is that it creates an entry in the /etc/fstab file for the partition in question. Following is an example entry from my /etc/fstab:

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda9 during installation
UUID=5b13003d-2fa9-4080-956a-0e990542dd39 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda1 during installation
UUID=9ec2dc33-245d-4590-a68e-0cc51e6faef4 /home ext4 defaults 0 2
/dev/disk/by-uuid/6C5F831B0F4B8077 /mnt/6C5F831B0F4B8077 auto nosuid,nodev,nofail,x-gvfs-show 0 0


The first column identifies the partition, second column gives the mount point and third column defines the options to be used together with the mount.  The third entry corresponds to the partition shown in the screenshot above. As can be seen, the option x-gvfs-show is supposed to be used which prevents the partition from being successfully mounted. To remedy this problem, we just need to change the mount options to 'defaults', as shown for the other 2 ext4 partitions in the above /etc/fstab file. And the system will start booting up like a sunflower on a pleasant Zurich afternoon.  

Another point worth noting here is that unless explicitly specified, a partition is mounted at boot-time. To ensure that the partition is not automatically mounted at boot-time, we need to specify the 'noauto' option in the corresponding /etc/fstab entry. Just imagine setting this option for your root partition!!