<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shriphani Palakodety &#187; OS</title>
	<atom:link href="http://shriphani.com/blog/category/os/feed/" rel="self" type="application/rss+xml" />
	<link>http://shriphani.com/blog</link>
	<description>In Pursuit Of Truth and Beauty</description>
	<lastBuildDate>Mon, 30 Jan 2012 09:32:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Interesting OS Problem: chmod -x chmod</title>
		<link>http://shriphani.com/blog/2010/10/10/interesting-os-problem-chmod-x-chmod/</link>
		<comments>http://shriphani.com/blog/2010/10/10/interesting-os-problem-chmod-x-chmod/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 01:08:02 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/?p=728</guid>
		<description><![CDATA[I seem to be finding quite a lot of interesting OS material to read nowadays. Here&#8217;s a kick ass example of one of them. What if an idiot decides to do &#8220;chmod -x chmod&#8221; These lecture slides describe how to fix that problem in detail: chmod -x chmod View more presentations from José Castro.]]></description>
			<content:encoded><![CDATA[<p>I seem to be finding quite a lot of interesting OS material to read nowadays. Here&#8217;s a kick ass example of one of them.</p>
<p>What if an idiot decides to do &#8220;chmod -x chmod&#8221;</p>
<p>These lecture slides describe how to fix that problem in detail:</p>
<div id="__ss_4968763" style="width: 425px;"><strong><a title="chmod -x chmod" href="http://www.slideshare.net/cog/chmod-x-chmod">chmod -x chmod</a></strong><object id="__sse4968763" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=chmod-forslideshare-100814060123-phpapp01&amp;stripped_title=chmod-x-chmod&amp;userName=cog" /><param name="name" value="__sse4968763" /><param name="allowfullscreen" value="true" /><embed id="__sse4968763" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=chmod-forslideshare-100814060123-phpapp01&amp;stripped_title=chmod-x-chmod&amp;userName=cog" name="__sse4968763" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/cog">José Castro</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2010/10/10/interesting-os-problem-chmod-x-chmod/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spin Locks &#8211; Context Switching</title>
		<link>http://shriphani.com/blog/2010/10/09/spin-locks-context-switching/</link>
		<comments>http://shriphani.com/blog/2010/10/09/spin-locks-context-switching/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 06:28:24 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[context-switching]]></category>
		<category><![CDATA[cs]]></category>
		<category><![CDATA[interrupts]]></category>
		<category><![CDATA[operating systems]]></category>
		<category><![CDATA[preemptive scheduling]]></category>
		<category><![CDATA[spin locks]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/?p=722</guid>
		<description><![CDATA[Disclaimers: If you&#8217;re interested in learning about spin locks, you are @ the wrong place. Purdue University&#8217;s Dr. Gustavo Rodriguez-Rivera is kind enough to put his lecture notes (they are excellent) online. This probably is a fault of my own ignorance more than that of my coursework. Thus far, my understanding of spin locks was [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimers:</p>
<ul>
<li>If you&#8217;re interested in learning about spin locks, you are @ the wrong place. Purdue University&#8217;s <a href="http://www.cs.purdue.edu/homes/grr/" target="_blank">Dr. Gustavo Rodriguez-Rivera</a> is kind enough to <a href="http://www.cs.purdue.edu/homes/grr/cs354/LectureNotes/" target="_blank">put his lecture notes (they are excellent) online</a>.</li>
</ul>
<p>This probably is a fault of my own ignorance more than that of my coursework. Thus far, my understanding of spin locks was that an atomic &#8216;test-and-set&#8217; instruction would be used to lock / unlock and make a portion of the code atomic. I won&#8217;t put the pseudocode for it here but the idea is that if there&#8217;s a lock on a piece of code, if any other thread tries to obtain a lock (spin-locks only!), it starts polling till the thread that has currently obtained the lock calls spin_unlock to give up the lock.</p>
<p>In contrast to this, if a mutex_lock is used, if a second thread tries to obtain a lock, it is thrown into a waiting queue corresponding to the mutex lock. Mutex locks use spin locks to make their own implementations atomic.</p>
<p>Now I thought that if a certain thread obtains a spin lock over some section of code, then it &#8220;sort-of&#8221; functions like a mutex lock but is only a bit more inefficient on single-core machines.</p>
<p>Turns out, I was wrong. Certain spin locks disable interrupts, take hold of CPU and only allow context switching to occur after spin_unlock is called.</p>
<p>From <a href="http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?mutex+9">an article</a> (on FreeBSD kernel development) I found on the interwebs:</p>
<h3>Mutexes which do not context switch are MTX_SPIN mutexes. These should only be used to protect data shared with primary interrupt code. This includes INTR_FAST interrupt handlers and low level scheduling code. In all architectures both acquiring and releasing of a uncontested spin mutex is more expensive than the same operation on a non-spin mutex. In order to protect an interrupt service routine from blocking against itself all interrupts are either blocked or deferred on a processor while holding a spin lock. It is permissible to hold multiple spin mutexes.</h3>
<p>So, to put things in perspective, here&#8217;s some pseudocode:</p>
<pre>
//Thread1:
spin_lock(lock_1);
A;
B;
spin_unlock(lock_1);

//Thread2:
mutex_lock(lock_2);
C;
D;
mutex_unlock(lock_2);
</pre>
<p>The only possible flows of execution (flow of executions? I don&#8217;t know &#8211; too sleep deprived) when these 2 threads are executing concurrently are:</p>
<pre>
A;
B;
C;
D;
</pre>
<p>or</p>
<pre>
C;
A;
B;
D;
</pre>
<p>or</p>
<p><strong>Update:</strong> I forgot to put this in. <a href="http://prashblog.com">PrashMohan</a> pointed this out.</p>
<pre>
C;
D;
A;
B;
</pre>
<p>This choice actually makes sense when I think about it (of course the article was very useful).</p>
<p>Hmm..</p>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2010/10/09/spin-locks-context-switching/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iLugHyd, Sloppy pace, Confusion.</title>
		<link>http://shriphani.com/blog/2007/11/27/ilughyd-sloppy-pace-confusion/</link>
		<comments>http://shriphani.com/blog/2007/11/27/ilughyd-sloppy-pace-confusion/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 13:09:16 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[Daily life]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/?p=32</guid>
		<description><![CDATA[I just returned from iLugHyderabad&#8217;s meeting. It was fun. I met a lot of interesting folks who had dabbled with the new release of Fedora. It is not like I am tempted to try out fedora but it was fun meeting the Fedora enthusiast Rahul Sundaram. Let me recollect what happened during the meet. The [...]]]></description>
			<content:encoded><![CDATA[<p>I just returned from iLugHyderabad&#8217;s meeting. It was fun. I met a lot of interesting folks who had dabbled with the new release of Fedora. It is not like I am tempted to try out fedora but it was fun meeting the Fedora enthusiast Rahul Sundaram. Let me recollect what happened during the meet.</p>
<p>The venue for the meet was the astronomy building at Osmania University. The building was being renovated and I managed to whiten my navy blue coloured jacket by plainly brushing against the walls of the building. There was no electricity in the building too. We were discussing about moving to a different room when a professor who was there to attend the talk (teaches at Osmania and has been using Linux for 12 years !!) used an extension cord that somehow could span the length of two floors. The basic infrastructure needed to conduct the event was now complete. We waited for a few more people to arrive but not many turned up. Seemingly many students had exams the very next day and chose to stay back at home/hostel to study. I began discussing about Django newforms with Theju (I met him at mukt.in . He was one of those who did a project on server side validation at the google summer of code. I will take part in this when I go to college for sure. They give out some excellent projects and help in improving one&#8217;s coding skills.). Seemingly in December, django&#8217;s creators will launch newforms (or is it newforms admin?). Theju promised to teach me how to hack up the admin interface that comes with django.</p>
<p>Someone at the meet with long hair had a lot of troubles with Fedora 8. Seemingly his laptop wouldn&#8217;t boot into fedora and grub would get stuck at the &#8220;Loading Grub, Stage1.5&#8243; stage. I also remember that I had some troubles with the new linux kernel way back when I used feisty. I placed a bug report <a href="https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/118272">here</a>.</p>
<p>After that the talk began. Rahul explained about his association with linux since the days of Red Hat Linux. So automatically becomes part of the elite FOSS gang in Hyderabad.</p>
<p>Rahul turned out to be a jovial speaker and his speech was littered with comic examples dating back to his stint as the &#8220;font guy&#8221;, &#8220;the support guy&#8221; for Fedora and Red Hat Linux. Seemingly on one occasion, he was called up by a Fedora user from Greece who claimed that Greek didn&#8217;t look good in the Bitstream fonts but looked better in DejaVu Sans. Rahul&#8217;s reaction was &#8220;Which one is what and what looks better?&#8221;. We all had a hearty laugh at this. At the end of the meet, we all had an &#8220;introduce yourself&#8221; kind of session and there was this guy who worked at google and was all smiles. I just adore google employees. They seem to be in love with what they do and genuinely are &#8220;good&#8221; at what they do. Krish (mukt.in organizer). So we began talking. I voiced my anger at google&#8217;s choice to make us write applications using android in java and to provide an eclipse plugin to top it all. Now eclipse is a PITA. My experience with it lasted 30 minutes. 10 minutes it took to start, 10 minutes to install the pydev plugin and another 10 to close. Rahul then came in with his comment, &#8220;Some time back, your computer was considered very robust if it could run quake at 50 fps. Nowadays, if you can run eclipse at 50 fps, your box is top of the line.&#8221;. He earned another round of applause. That is the true FOSS spirit.</p>
<p>I did attend a Ruby on Rails session as well sometime back at TWINCLING. Mr. A.P. Rajshekhar gave a talk on ROR and it was one of the best  sessions on web development (I attended one at mukt.in. It was conducted by Thyagu) that I had attended. In a span of two hours, Mr. Rajshekhar covered a lot about Ruby, MVC and also showed us a working application by the name talewiki. Mr. Rajshekhar is also writing a book on ROR and he plans to use talewiki to teach ROR. I promise you Mr. Rajshekhar that I will be the first to purchase your book.</p>
<p>Krish and I are coming up with a web application of our own. I will talk about it later as we are yet to come up with a working model.</p>
<p>I have to still figure out how to generate thumbnails for my firefox extension. I have discovered that nautilus uses a thumbnailer that picks a particular frame of a video, the first page of a file and so on. I think I will freeze the development of filerfox and do something else with firefox. I have to scout for them though.</p>
<p>Anyway, See you later.</p>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2007/11/27/ilughyd-sloppy-pace-confusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I am up to these days</title>
		<link>http://shriphani.com/blog/2007/11/06/what-i-am-up-to-these-days/</link>
		<comments>http://shriphani.com/blog/2007/11/06/what-i-am-up-to-these-days/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 11:33:20 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[Daily life]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/?p=29</guid>
		<description><![CDATA[I have not been able to post a lot these days as I am all tensed about applying to colleges and so on, it is indeed a very stressful process. I have shortlisted a few but I think it is better I don&#8217;t shoot only for the top few and also look at tier 2 [...]]]></description>
			<content:encoded><![CDATA[<p>I have not been able to post a lot these days as I am all tensed about applying to colleges and so on, it is indeed a very stressful process. I have shortlisted a few but I think it is better I don&#8217;t shoot only for the top few and also look at tier 2 colleges with decent research prospects.</p>
<p>Now I am an individual who is eager to play with things. After the LUG meet I decided to make my own file manager extension for firefox that would enable me to easily pick the pictures that I would like to upload. I have made a basic UI for it and I will soon come up with a working version of it in about a week.</p>
<p>Apart from that I got to play with BSD again courtesy a generous gift from Deependra Shekawat ( a great friend who is a freenode regular ). He sent me the PCBSD installation cd. Let me recollect the process.</p>
<p>I put the cd in and up came a very good-looking screen that enabled me to cruise through the process and I kept encountering worthless pics that claim its capability to play all my music and edit all my files and whatnot. Typical &#8220;BSD on the desktop is finally here&#8221; kind of presentation. After a few minutes the installation finished and I was staring at KDE (oh how those jumping icons irritate me). Surprisingly everything works including my wireless. Even the distracting LED (ACER&#8217;s innovative design. They place the radio kill switch under the touchpad so that I can always hit it and see the Network Manager applet tell me that no wireless networks exist). I decide to experiment. The .pbi method of installing things irritates me further.</p>
<p>I recollect that a very dear friend who uses freebsd had told me about the complaints bsd threw when a device was not unmpunted correctly. I plug my external drive in and yank it out immediately. I plug it in again and type `mount /dev/da0s1 /mnt/external_disk` at the shell and get some stupid error report. I investigate further.</p>
<p>Tune2fs seems to be a good utility to look at ext3 fs parameters (my external drive is ext3 formatted, I know it is not smart but who cares). I notice this :</p>
<p>Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file</p>
<p>Bingo! So all I need to do is remove the &#8216;needs_recovery&#8217; &#8220;feature&#8221; (stupid I know).</p>
<p>Being the MIT appreciator I pick debugfs which according to its manpage is written by someone from MIT (woohoo!!). So here goes:</p>
<p>[root@psp-laptop /root]# debugfs<br />
debugfs: open -w -f /dev/da0s1<br />
debugfs: features<br />
Filesystem features: has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file<br />
debugfs: features -needs_recovery<br />
Filesystem features: has_journal resize_inode dir_index filetype sparse_super large_file<br />
debugfs: quit</p>
<p>So there we are. I would however recommend that one runs e2fsck on the drive. That will also remove the troublesome &#8220;feature&#8221;.</p>
<p>Work, work and more work. I need to draft those essays now.</p>
<p>I will write again later</p>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2007/11/06/what-i-am-up-to-these-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filesystems with versioning support.</title>
		<link>http://shriphani.com/blog/2007/08/09/filesystems-with-versioning-support/</link>
		<comments>http://shriphani.com/blog/2007/08/09/filesystems-with-versioning-support/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 13:53:02 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/2007/08/09/filesystems-with-versioning-support/</guid>
		<description><![CDATA[We developers can&#8217;t do without versioning can we. We write crap html to test our parser and end up committing this as well to the server and then move back to a previous version so that those who use svn to get the bleeding edge version of the software do not get your useless html [...]]]></description>
			<content:encoded><![CDATA[<p>We developers can&#8217;t do without versioning can we. We write crap html to test our parser and end up committing this as well to the server and then move back to a previous version so that those who use svn to get the bleeding edge version of the software do not get your useless html to laugh at. I was pondering over what advantages versioning could bring to our traditional way of work. I for one use sys-rescue to back up important files on my computer and append the version number to the filename. I just need to browse through this directory in case I screw up.</p>
<p>Anyway, I decided to have a look at operating systems which matched the performance of ext3 and had some form of versioning in them. My first stop was ext3cow from John Hopkins University. I was particularly attracted to it because it contained ext3 in its name.<br />
I then installed ext3cow on a partition reading instructions from http://www.ext3cow.com/Applying%20the%20Patch.html .</p>
<p>I took me quite some time to understand what was going on. I approached ext3cow with the impression that one would have to revert back to a previous version of the fs by probably mounting it somewhere else (probably these are stored as .iso files somewhere so that they can be dumped on other media ?) . I was stumped to see something like this as I read:</p>
<pre>
[user@machine]$ echo "This is v1 of the file." &gt; foo.txt
[user@machine]$ snapshot
Snapshot on . <seconds>
[user@machine]$ echo "This is v2 of the file." &gt; foo.txt
[user@machine]$ cat foo@<seconds>
This is v1 of the file.
</seconds></seconds></pre>
<p>Amazing. This means that I can access files at any given date in the same way as I access a file that currently exists in the filesystem. Now, there are certain drawbacks to this. Who in this world can remember the seconds since epoch the snapshot was taken ? And its not like I am going to access this snapshot seconds after I took one. There is a solution to all this, <a href="http://www.sandeepranade.com/html/ComputerScience/time-travelling-file-manager.html">a gui interface to ext3cow</a>. It should allow you to save these snapshots using a date-structure you want.</p>
<p>One of the drawbacks of the current version of ext3cow is the lack of the ability to delete a snapshot. It did exist in previous versions though.</p>
<p>After a terribly long period of using ext3cow, here is what I feel it needs:</p>
<p>1. A utility to convert ext3 to ext3cow.</p>
<p>2. The ability to delete a snapshot.</p>
<p>3. A better GUI for ext3cow</p>
<p>Here is my idea about versioning filesystems. Someone creates a versioning file-system that gives the user no control whatsoever over the frequency of snapshots taken and over the snapshots themselves. This would enable one to track let&#8217;s say the activities on an ATM machine ? Take the pic of a guy who enters through the door, save it, take a snapshot detailing the activities and done. If someone somehow manages to delete the current file, you can bring it back from the snapshot.</p>
<p>Well that&#8217;s how it is. I am going to read more about filesystems supporting versioning such as NILFS</p>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2007/08/09/filesystems-with-versioning-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feisty fawn, first observation</title>
		<link>http://shriphani.com/blog/2007/05/08/my-first-python-script/</link>
		<comments>http://shriphani.com/blog/2007/05/08/my-first-python-script/#comments</comments>
		<pubDate>Tue, 08 May 2007 09:03:51 +0000</pubDate>
		<dc:creator>Shriphani</dc:creator>
				<category><![CDATA[Daily life]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[PITA]]></category>

		<guid isPermaLink="false">http://shriphani.com/blog/?p=7</guid>
		<description><![CDATA[I got my feisty cds this morning. I installed feisty immediately and considering that one of the ubuntu devs on #ubuntu told me that feisty&#8217;s way of handling storage devices had changed, I immediately did: shriphani@psp-laptop:~$ cat /etc/fstab # /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 # /dev/sda3 UUID=1a97343a-e3ed-48e2-9db4-ea67228fb1aa [...]]]></description>
			<content:encoded><![CDATA[<p>I got my feisty cds this morning. I installed feisty immediately and considering that one of the ubuntu devs on #ubuntu told me that feisty&#8217;s way of handling storage devices had changed, I immediately did:</p>
<pre>
shriphani@psp-laptop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
#
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=1a97343a-e3ed-48e2-9db4-ea67228fb1aa /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda2
UUID=68033b3d-f469-4a8b-8ade-c3a9984f5281 /boot           ext2    defaults        0       2
# /dev/sda1
UUID=01107bb3-77bb-41c3-b271-6019bfa8ebb3 /home           ext3    defaults        0       2
# /dev/sda4
UUID=da271254-066a-46f4-b1a0-75ba2c4b494f none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0</pre>
<p>What&#8217;s this !!. a UUID describing a device ? I was a bit confused. I also saw that my IDE drive (I have an acer travelmate 4500 laptop) was being recognised as SCSI. I immediately went to #ubuntu on freenode to figure out what was wrong. I was then given the link to <a href="https://wiki.ubuntu.com/LibAtaForAtaDisks">this</a>.<br />
Wow! Surely a lot of thought going into that. So we will be dealing with just one subsystem from now on in Ubuntu land.</p>
]]></content:encoded>
			<wfw:commentRss>http://shriphani.com/blog/2007/05/08/my-first-python-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

