Desktop Wallpapers Waste Memory.

My colleague often says something along the lines of:

I don’t know why everyone has a desktop wallpaper its nothing but a waste of memory

I thought that this sounded somewhat like an urban myth and decided to see if there was any evidence to support or dispell this claim. Well it turns out that although the wallpaper is pushed to video memory for rendering it cant be kept there as if it were just general purpose RAM. So the wallpaper does have to be stored in conventional memory, but is it a waste?

Well assuming a resolution of 1280×1024 and a 32bpp color (4 bytes per pixel) we get:

1280 × 1024 × 4 = 5 MiB

So I am wasting 5 MiB of my 8 GiB of RAM. As a percentage:

5/8192 × 100 ≈ 0.06%

But yes it is a bit of a waste, I should probably turn off my desktop wallpaper.


I like to write up my holidays so that I can look back and remember what I did, trouble is I usually take so long trying to capture everything that I end up not posting them at all. I have drafts for several Holidays that have been sitting there for years. I have decided that I am just going to post what I have written and improve the post at a later date.


My Dad kindly helped me build a nice decking area at the back of my house where we can have barbecues, and enjoy the sun. When I say he helped me, what I actually mean is that he did all the hard work.

I am really pleased with the results, Thank you Dad for being so kind and helpful.

Update: I created a panoramic view by stitching the above three images together in Hugin

How to write an operating system (Part 2)

You may have read my previous post about writing a Hello World operating system. Although I did post this on April 1st it wasn’t actually a prank, and it does actually work.

I decided to improve the code. With the following replacement for main.c we can print “Hello World!” on the screen in a more developer friendly way.

char * vidmem = (char*)0xB8000;
int pos = 0;

void putc(char ch){
	vidmem[pos++] = ch;
	vidmem[pos++] = 0x7;

void puts(char* s){
	int c;
	for(c = 0; s[c] != ''; c++)

int main(){
	puts("Hello World!");

Now this is all very good, but suppose you need to check that some number in your os is some value that you expected, we are going to have to write a function to convert the number into an ascii representation before displaying it on the screen, we can’t use the itoa() function of the standard c library, because we didn’t compile it into our OS. We need to instead roll our own itoa function.

int strsize(char* str){
	int i;
	for(i = 0;str[i]!='';i++);
	return i;
char* strrev(char* str){
	char* tmp;
	int i = strsize(str) - 1;
	int j = 0;
	    tmp[j] = str[i];
	tmp[j] = '';

	return tmp;

char* toDigit(int n){
	char digits[10] = "0123456789";
	char* str;

	int i = 0;
		str[i] = digits[n%10];
	str[i] = digits[n%10];
	str[i] = '';

	return strrev(str);

This initial attempt might have worked, however its riddled with errors, which I have since learned about. For example returning a pointer to a stack variable, is probably not a good idea!
When I originally wrote this I hadn’t seen the Kerrigan an Ritchie implementation thier implementation is much better has more features, and less bugs. After re-writing the code my final version of main.c was as follows
Continue reading How to write an operating system (Part 2)

SC101T Linux Cluster

I recently aquired a Netgear SC101T Network storage device. After discovering that the device is not a NAS and instead was a SAN device I was at first a little disappointed. Furthermore the device uses a proprietry file system and a proprietry protocol called zSAN to access the device. Well fortunately someone has developed an SC101-NBD linux userspace driver that translates the proprietry zSAN protocol into linux nbd (Network Block Device) protocol. After downloading and compiling the driver at first nothing worked, and I found the reason to be that the driver was developed for the SC101 not the SC101T. After a bit of hunting around I found that someone had posted the following fix in on the driver support group forum.

The fix is pretty simple. In psan.c the functions ‘psan_query_disk’ and ‘psan_query_root’ pass an info’ value of ‘1’ into the ‘psan_get_t’ struct. Doing so seems to cause the ‘select’ to fail in the ‘wait_for_packet’ function. Changing the value passed into ‘info’ to ‘0’ seems to allow the device, disks and partitions to be discovered fine – I’m now currently watching my linux box mkfs.ext3 /dev/nbd0

I followed the instructions and re-compiled the driver, this time it worked. Issuing a

sudo ut listall

Gave the following output

TOTAL(MB): 610480 # PARTITIONS : 1
FREE (MB): 64
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
F1A2F2EA-7C87-11DE-ACB7-0013A9D715B7 linux1 610407
TOTAL(MB): 610480 # PARTITIONS : 1
FREE (MB): 133594
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2B4F7D24-67FE-11DE-8CC5-0013A9D715B7 linux0 476877

This lists the partitions on the device that had been previously created using the Windows™ software. A partition can be attached by issuing

sudo ut attach F1A2F2EA-7C87-11DE-ACB7-0013A9D715B7 /dev/nbd0

So this provides block device access to the partition, to use the partition obviously one has to put a file system on it. The difference with this SAN based device and say a local hard disk device, is that a local harddisk is only accessed by one machine at a time. Since I wanted to access the device from multiple machines something like ext2fs is not suitable. What is much more suitable is gfs2 which is actually designed for SAN storage devices. To install gfs2 on debian based distributions you can run

sudo apt-get install gfs2-tools

mkfs.gfs2 -j 5 -t storage:linux0 /dev/nbd0

To actually mount the device the lock manager also has to be configured.

<?xml version="1.0"?>
<cluster name="storage" config_version="1">
<clusternode name="korma" nodeid="1">
<method name="human">
<device name="last_resort" ipaddr="korma"/>
<clusternode name="tikka" nodeid="2">
<method name="human">
<device name="last_resort" ipaddr="tikka"/>
<fencedevice name="last_resort" agent="fence_manual"/>

Continue reading SC101T Linux Cluster