Subtle Errors in C++ Programs

I recently stumbled upon a subtle bug in a benchmark code which again reminds me to never use C++ again, if I can. Here’s a buggy snippet from this code (simplified): // BUGGY ostringstream os; int i = 1; os << "foo-" << i << ".dat"; const char *filename = os.str().c_str(); int fd = open(filename, O_RDONLY); You may expect above code to try open a file named foo-1.dat but that’s not what is happening here. [Read More]

Compressed RAM disk for Windows, The Virtual Way!

Recently, I developed Linux kernel driver which creates generic RAM based compressed block devices (called zram). Being RAM disks, they do not provide persistent storage but there are many use cases where persistence is not required: /tmp, various caches under /var, swap disks etc. These cases can benefit greatly from high speed RAM disks along with savings which compression brings! However, all this seems to be completely Linux centric. But with virtualization, zram can be used for Windows too! [Read More]

Difference Engine: Harnessing Memory Redundancy in Virtual Machines

Here is link to paper (pdf) (MP3) Recently I came across this paper published in OSDI ‘08. Its an extension to VMware’s page-sharing and shows some amazing and hard to believe results. VMware page-sharing mechanism scans memory for all VMs and maps pages with same contents to a single page. This achieves memory savings if multiple VMs are hosted running same OS. However, with technique discussed in this paper, we find pages that are nearly same. [Read More]

RAM is not enough - Memory Compression!

This is my first post and what else I could start with! Memory compression has been my pet project since last 2 years. It adds a compression layer to swap path – whatever OS swaps out will be compressed and stored in memory itself. This is huge win over swapping to slow hard-disks which are typically used for swapping. Biggest challenges are what to compress? how much to compress? how to manage compressed blocks? [Read More]