Sunday, October 10, 2010

Automatic Consistency for Disk Storage

I was going over my grad school works and I stumbled upon some piece of research that I did early in my grad school that never saw the light.  I think it's fair to say that this is one of the most complex prototypes I built while in grad school, but ironically never got to publish it for lack of a compelling motivation of the idea.  It's part of my dissertation though, except that it's buried somewhere deep into the 125 pages.  I thought it fit to give it at least some credit by putting up a blog post about it.

The work makes a case for ensuring semantic consistency of data at the disk-level, using the additional knowledge of block pointers as proposed by Type-Safe Disks (OSDI '06).   Preserving data consistency in the event of unexpected system crashes is known to be one of the key challenges in disk storage.  In many cases, disk-data becomes completely unusable unless it conforms to  certain software-specific invariants that define it's consistency.   For example, an on-disk B-Tree with dangling pointers in some of the nodes, cannot be used locate data items.

Today's consistency mechanisms operate at the software-level making disks totally oblivious to the consistent state of the data.  Knowledge of consistency at the disk level enables interesting functionality which cannot be provided by traditional disks.  We built a new disk system that we call an ACE-Disk (Automatic Consistency Enforcing Disk), a disk that preserves the semantic consistency of stored data. In our approach, the disk system takes responsibility for consistency management, and thus is empowered to provide consistency-aware functionality such as data snapshotting.  Applications simply inform the disk about relationship between various blocks that the application already knows about.

Here is a link to the full manuscript of the work for those interested.

Friday, October 8, 2010

Plant on Concrete Floor

Tulsi on concrete floor

These holy basil plants (Tulsi) found their way through the cracks of the concrete floor in our house front-yard - amusing.  Holy basil has special significance in the Hindu religious tradition and is considered the sacred plant of Lord Vishnu.  There's also an ancient belief that where Tulsi grows, there will be prosperity.

Saturday, September 25, 2010

The Kart Racing Fiasco

So a few days ago I went on a fun trip w/ my colleagues for Go-Karting in Bangalore.  The particular place we went was supposedly one of the good ones in the city.  I've done fun GoKarting more than a few times before while in the US and I rate my skill-level as "average" (possibly wrt. a pretty skewed sample).   However, this time it was very different.

First, we had an unpleasant surprise when we reached the place: the Karts were nothing more than a few pieces of rusted metal awkwardly welded together, and a generator like diesel "engine" stuck behind.  The racing spot was a reasonably sized open area with stacked tires marking the track, and the width of the track for the most part was just enough to fit in two Karts.  The first round was good, as it was lap timing based and not a real-time race (they let one Kart at a time into the track and measure the time to complete the lap).   We found that the Karts despite being so rudimentary and pathetic in their form, were actually capable of going quite fast - easily about 60km/h - kind of dangerous given the nature of the track and the Kart.

The second round was a real race - about 8 Karts were let into the track at the same time (including mine) with their starting points just a couple meters apart.   Of course people were close to each other trying to pass one another in the curves.   In one such curve, my Kart slightly hit another Kart on the side and to our surprise, my Kart just took off in the air and went over the other Kart and brushed over my colleague's shoulder in that Kart.  Luckily he wasn't hurt.  However, this incident was pretty scary in hindsight because when my Kart took off, it could have hit my colleague in his head or something causing serious injury.

Analyzing the cause of the incident, it appeared like the form-factor and the weight of the Karts played an important role; they were not heavy enough to remain stable even for a slightest hit on the side - after all they were just a few pieces of cheap metal welded together. Given this, the GoKarting company should have at least refrained from indulging us in a realtime race if they had even some regard for our safety.  And note: this was the case w/ one of the "good" places for Go-Karting in Bangalore.

Anyway, this was not the first time I've seen a "fun" place in India poorly organized with least regard to safety - a good lesson to scrupulously use "common-sense" before embarking into such so called "fun" ventures in India.

Saturday, April 17, 2010

Phone wallpaper color can affect battery life

It seemed like some kind of a joke when I first read about it: with the recent phone displays made of OLED (Organic LED), the battery power consumed by the display varies based on the color being displayed. This was however not true with normal LCD displays found in most current and older generation phones or laptops.

In regular LCD displays, the screen is illuminated by a separate back-lit and the pixels themselves do not emit any light. In the case of OLED displays, the pixels themselves are illuminated and there is no need for a back-lit. Therefore, the power consumed by the display is basically dependent on how many of these pixels are illuminated and to what level. According to an article, a color profile with black background and white text consumes nearly 1/3rd of the power consumed by one with white background and black text.  In this case, the pixels that display the black color are not illuminated at all thereby saving battery life. HTC Nexus One has an OLED display, whereas all versions of the iPhone until now has regular LCD displays with back-lit.

OLED displays have other advantages aside from battery savings: their refresh rate is much higher, and they also render pretty sharp colors.  However, they do not fare well under sunlight as the maximum brightness of OLED pixels is still lower than what separate back-lits can provide.

So to save battery life on the Nexus one, set a dark background!

Friday, April 16, 2010

Holy Basil



I wanted to give away this Holy Basil plant of mine as I was moving, and was concerned if there'd be anyone interested in taking it. I posted a note in the local Desi club here in Mountain View for what it is worth, and was surprised to see more than 20 people respond within 5 minutes of sending it, many of them seemed frantically interested.

I just don't get the reason for that kind of enthusiasm.  I do understand the sentimental aspect which was why I was having it in the first place.  But clearly this is not so rare an item - anyone could get basil seeds from Walmart or any other store and grow their own plant in less than a month.

Monday, April 12, 2010

Is Assisted GPS better than Standalone?

Personally, I think GPS is one of the great marvels of science. The ability to precisely pinpoint your location with an accuracy of a few feet is incredible and is exceptionally useful. While GPS technology has been around for a long while, it's becoming more pervasive in the recent years after it found it's way into cell phones. Most medium to high-end cell phones today have inbuilt GPS hardware. In the context of cell phone GPS, I am sure everyone would have heard the term "A-GPS" which stands for "Assisted GPS". There's been poor understanding about the difference between the GPS hardware present in conventional navigation systems and these A-GPS hardware present in recent cell phones. So far, I've been under the impression that A-GPS  is something that cannot function without data about the initial co-ordinates (orbit/ephemeris) from a cell tower, until I talked about this to one of my friends (an MIT graduate) who is an expert in this field. There's been conflicting information about this on the web, and it also appears that some of the Wikipedia articles on this topic have incorrect information.

So apparently conventional navigation systems have a stand-alone version of GPS which obtains a location fix from scratch on their own, including the initial orbit/ephemeris data. This initial setup is pretty computation-intensive and takes a long time to obtain, thereby consuming significant battery power. Once the ephemeris information is obtained, the precise location fix is pretty fast. Stand-alone GPS systems can sometimes take even tens of minutes to obtain a fix because of this initial computation. They can also sometimes never get a fix when they are not in clear view of the sky.

A-GPS however, has an add on to the standalone GPS chip which is capable of obtaining precomputed orbit/ephemeris data from the cell tower instead of computing it on it's own from scratch, and hence is many times faster and energy efficient compared to standalone GPS. A-GPS chips' functionality is however a strict super-set of the functionality of a standalone GPS, as even if the cell tower fails to deliver the data, the A-GPS can fall back to normal standalone mode. According to my friend, there is no such GPS chip that cannot fall back to the standalone mode in the event of not being able to get the assistance of the cell tower, and if at all such a limitation exists, say, in a cell phone, it is artificially imposed by software. So according to my friend, if you have a cell phone whose GPS does not work without a cell signal, you should blame the phone software for it.

So yes, Assisted GPS is better than standalone, in all respects.

Note: Of course, obtaining approximate location using cell phones by cell tower "triangulation" is totally different from the above, and it can be done in pretty much any cell phone, as it does not require any GPS hardware.

Sunday, April 4, 2010

Zeno's paradox

I've always been intrigued by paradoxes in Physics, my favorite being the Zeno's paradox.  While there are various paradoxes in different fields, most I've come across are too mathematical in nature and do not directly relate to real world examples.  Zeno's on the other hand is a pretty interesting one and I've never had to try too hard to explain it to someone.   I was recently having a conversation about the Zeno's paradox with one of my colleagues and he had an interesting explanation and reasoning about the paradox.

The Zeno's paradox involves a segmented view of space or time. The tortoise and the rabbit (or Achilles) paradox says that in a race between a tortoise and a rabbit where the rabbit begins the race after a non-zero time delta from the time the tortoise began the race, it is impossible for the rabbit to ever win the race. This is because, say the starting position of the race is A, and while the rabbit began the race, the tortoise had moved to a position A+in the time interval d mentioned above.  Now, by the time the rabbit reaches the position A+x, the tortoise would have reached a different position A+x+y. This can be generalized to any position of the rabbit during the race, where, when it reaches a previous position T of the tortoise, the tortoise would have reached a different position T+farther from the rabbit, as the tortoise is in continuous motion.  Therefore, the rabbit always stays behind the tortoise and can never win the race, irrespective of how much faster the rabbit moves compared to the tortoise. It's also pretty easy to write a proof for this using mathematical induction.

Here is the reasoning that convinced me: the paradox is caused due to a distorted understanding of finiteinfinite, and infinitesimal distances. The laws associated with finite distances cannot hold true when the space is divided into infinitesimally short segments, as in the above case of the tortoise and the rabbit.  My colleague had a clearer explanation for this: basically the distance between any two points A and B in space can be divided into an infinite number of segments. Mathematically, the sum of an infinite number of distance segments is infinity.  However, when the individual distances themselves are infinitesimally short, their sum need not necessarily be infinity, and can be finite.  Therefore in the race between the tortoise and the rabbit, although there were infinite number of points, their sum is still finite (as the race is for a finite distance), and the above induction logic wouldn't hold true. 

Another of Zeno's paradoxes, the "Arrow of Flight" paradox is interesting too, and the above explanation seems to apply to that as well.

Monday, March 29, 2010

Why I love Karmic Koala ..

As an avid Linux user, I was overwhelmed by the features and improvements in Ubuntu 9.10 (Karmic Koala).  From the days when Linux was considered hard to use (except for geeks), the various Linux distributions have tried hard to address the "usability" and "user-friendliness" short-coming, and I guess today Linux has evolved so much that in several aspects it's much more user-friendly than Windows.  However, many do not realize this simply because they haven't tried it.  Here are the things I love about the latest version of Ubuntu:

  • Ubuntu Software Center - haven't seen something similar in Windows (well, you first need free software, and then a common repository of such free software).   It's basically a really nice front-end to the huge software repository for Ubuntu.  You can pretty much find *any* software you want here and install within seconds, by a click of a button.  This front-end is way better than the Synaptic package manager.
  • Gnome 2.28 is great - both in terms of look and feel and responsiveness.
  • Pretty user-friendly way to manage networks.  It's now as easy to connect to a wireless network in Linux as in Windows/Mac.
  • Inbuilt drivers support most common models of USB devices out of the box, esp. webcams and printers
  • Booting is lightning fast.
  • Default file system is now Ext4 - much faster and reliable than Ext3.
  • Performance: visibly faster than older versions of Linux, and Windows/Mac on the same hardware.

Monday, March 22, 2010

The Switch from Iphone to Android

I finally made the switch from my Iphone 3GS to Android (Nexus one), and after more than a couple of months, I think the switch was well worth it.    Here are the key factors that make Android better than the iphone (for me).

  • Background applications: this has been discussed widely across the web, but the aspect that bothered me the most about this was the inability to sync arbitrary data in the iphone (other than ones such as email/calendar etc.)
  • Better notifications: this has to do both w/ the hardware and software.   All android phones have an external LED for visual notification which according to me is a prerequisite.  With proper customization of the LED behavior, a pretty solid notification system can be setup with minimal battery usage. With respect to software, "repeat notification" can be achieved through external apps on Android, which isn't possible on the Iphone. (repeat notification is something like say playing a notification sound every 5 minutes when there is a missed call or other event, until it's viewed).
  • Customization: the ability to configure most aspects of the phone behavior according to specific user needs.  Iphone is worst on this aspect.
  • Range of functionality that external apps can provide: although the number of apps available for iphone is much higher than that for Android, the range of functionality that iphone apps can provide is limited due to the fact that the iphone OS does not export a lot of low level functionality.  (for example, an app cannot modify the phone behavior when a call is received).
  • The pace at which the OS is improved/updated.

Wednesday, February 10, 2010

Impressive design



I came across this vehicle a few days ago close to my office, and thought it's worthy of a snap. It appeared new - may be a 2009 design. I am impressed by the taste of the people who designed it, and the ones who purchased.


Wednesday, January 6, 2010

Smartphones and Application Memory

It seems weird that most smartphone OS writers limit the "Application memory" to be a very small fraction of the total storage in the phone (in some cases this is also a hardware limitation). For example in the Blackberry Storm which I owned a while ago, the application memory is limited to a mere 128MB while the total inbuilt storage on the phone is 1GB and the media card slot allows expansion up to 16GB.

For some background, application memory in the context of smartphones is the term normally used to refer to the part of persistent storage on the phone where (and only where) the actual application binaries can reside and can be run from. Most phones also share this memory for storing data such as call logs, SMS, emails, calendar and tasks data, etc. It is very important for this memory to be large enough not only to accommodate more applications on the phone but also to manage a larger history of emails, tasks, calendar items, and phone call logs. This also applies to application-specific data, as most smartphone applications today use the application-memory to store their data (for example, a notebook application stores its notes in the application memory).

The demarcation of the portion of memory as "application memory" should have been a hardware constraint in the early days where persistent storage costs, speeds, and power consumption were some of the biggest constraints while designing smartphones. The hardware used for application memory will have to be fast and power efficient as it is constantly used by running applications, and for basic functionalities such as calls logs and emails. Solid-state flash storage has been used for this for quite a while.

However, today flash costs have come down and storage capacity has increased a lot. A 32GB flash card is about $50 today. Yet, the constraints on application memory still exist. For example, the Blacberry Storm 2 smartphone released just months ago just has 256MB of application memory. I guess this has now mostly become a software limitation while all it takes is to bite the bullet and update the software to manage more space.

Sunday, January 3, 2010

Using Keyboard Shortcuts in GMail

I've found the custom keyboard shortcuts lab in GMail pretty good at making the UI experience (geek?) friendly and comes closer to the simple interface of the good old Unix text-based email clients such as pine (which I loved :-), mutt etc.

Enable the following two labs in GMail:
- Custom keyboard shortcuts
- Go to label

Under settings, configure shortcuts similar to the ones in pine. A carefully chosen set of shortcuts will eliminate the need for using the mouse in your GMail experience for the most part.