Sunday, November 19, 2006

Human brain vs Computer

A lotta people have tried to model the computer as a human brain. I thought I should just try the reverse. Well I will just try to put down some analogies.


OS does process scheduling - human brain also does scheduling.. Those who have hajaar concentration are actually able to disable context switches. Perhaps it is possible to do this by disabling interrupts. But then disabling of interrupts is a privileged instruction and it should be possible only for the kernel to use it. So the kernel up their brains is insecure. Haha. The programs that run on their brains are somewhat like some hacker's code on a comp which could possibly disable interrupts and then use the complete processing power of the processor. But then, what the hacker program does is typically considered as useless work (possibly harmful), but the equivalent work on the human brain is considered as useful. Maybe we need to change our notion of usefulness to something more consistent across the platform....

Context switches in comps take approximately constant time. But in the human brain, a context switch to do something utterly 'useless' has switch time tending to zero if you have been doing something 'useful'. And if you are just whiling away time, the context switch time required to switch to a 'more useful' task seems to approach infinity. Strange.....

Just like the comp, the human brain also has memory hierarchies. At the most basic level, there is the RAM and hard disk on the comp. Similarly the brain also has short term and long term memory. We need to spend some time in recollecting old events etc, just like paging in pages from the hard disk to RAM. It would be interesting to find out what sort of replacement algorithm is followed in the brain..... Perhaps the brain also has other levels of hierarchy similar to the different levels of cache in the comp, we might just be unaware of them or rather not tried to model the brain with that many levels of memory hierarchy.

The Spinal cord is very much an equivalent of the FSB. It provides the link between the processor and all the peripheral organs (devices).

Saturday, November 04, 2006

Life is full of surprises

A few weeks back, after those 3 consecutive night outs, I thought things can't get any worse. But the beauty of life is that it always manages to prove you wrong. This year I had the worst Diwali of my life. I had to submit a Compilers assignment on Diwali...

Diwali was on a Saturday. From Friday night till Saturday afternoon I spent the entire time in the Lab trying to finish the assignment. This was after a night out the previous day working on the same assignment. The only period for which I came out from Lab was for having breakfast and even that was not a smooth affair. When I came out of the Lab at seven in the morning, it was bright outside. I decided to go for breakfast and then come back later to continue with the assignment. As soon as I left the dept, it became quite dark and started raining. By the time I reached the hostel, I was completely drenched. It was pouring so badly that I could not even leave the hostel and go to the mess for a while. After about an hour, when the rain had subceeded, I had breakfast and went back to lab.

Finally I managed to finish the assignment and submitted the same by two in the afternoon. Well things would have been fine if that was the only assignment. On Monday I had to submit another OS Lab assignment which required a lot of work. There was no way I could have finished it even if I had put night outs on Saturday as well as Sunday. So I just read up the project description for OS lab and then decided sleep for a while in the evening.

I was so tired that I slept much longer than I had intended to. Others in the hostel were enjoying outside and were bursting crackers etc. Amidst all the noise of crackers, I slept like a log. Finally I woke up at 9 in the night.
Damn!! I had missed dinner also...

Anyway there was nothing much I could do now.. So I went to Coffee day (Oh yeah, a new Coffee day outlet has been opened in IIT) . That was the only eatery that was open in IIT on Diwali. After that I went back to lab to start off on the OS assignment.

On Monday, most of the groups had not finished the OS assignment and so the deadline was postponed. Eventually, since the TA for course was not free whenever we wanted to show it, it kept getting postponed. And I am now in the lab waiting to submit the same OS assignment for which I have been putting fight since Diwali.

Update : Looks like there will be another extension. My partner for the OS assignment is unfortunately ill and has been admitted to hospital. And after such a long wait, the TA told me to submit it after my partner is back...

Tuesday, October 17, 2006

Fate

When something that you hate happens not once, but twice within a week, what do you call it?

FATE?

Well last weekend, I wanted to rebuild the partitions on my hard disk. Actually I wanted to remove 3 separate 30 GB partitions and create a single large partition. I deleted the 30GB partitions in windows and rebooted. But my comp was never able to boot into windows or linux after that. It said grub error 22 and the bootloader failed to initialize. Well this has happened before. So I promptly took out my SuSE DVD and tried to reinstall grub.

"Unable to write to /boot/...."

Damn!!! WTF

So I was not able to reinstall grub. Somehow I managed to install the windows bootloader later and windows was up and running again. But I had just written code for one of my assignments the previous day and it was on the linux partition. I could not place a backup of the code on the department server as the network was having problems the previous day. Fuck!!

Luckily, I had some intermediate version of the code in my mailbox. So I would have to make the additional changes only. This was the first instance of what I call FATE.

The second one occurred yesterday. I had to submit a lab assignment for the compilers course yesterday night at 9 (Monday). Our group started working on the assignment on Saturday. Well we actually had to fix bugs in our previous assignment to start work on this assignment. So that part took us all the time till Sunday night. So a night out on Sunday was inevitable. We stayed in the DCF till 5:30 in the morning and managed to finish quite a bit of the work. Finally we thought we must take a break, so we decided to continue working on the code later during the day after the classes got over. We had been storing all the code on my account all the while. One of my teammates wanted to copy the code to his account as he had a much older version of the code. He used the typical scp command to do this. He asked me to enter the password and I did that. We happily left the lab after that. I went back later in the morning to the lab to continue working on the code. That is when I noticed that something strange was happening. The code was not even compiling fine. I looked up the file and saw that all the changes were lost.

My teammate had scp'ed from his account to mine instead of the mine to his.... And I, being already tired and sleepy just entered my password without seeing the command.

Shit!!! Lost assignment code for the second time.

Luckily, the lab submition deadline was extended to later this week as most groups had not finished. So hopefully we can manage to fix the code to some decent shape

Amidst all this, I got a message yesterday that there will be a midsem today.

I had not attended classes for well over a month in that course - which meant I had to mug from scratch. A night out was the only option.

Fuck.... How was I to manage another successive night out. And to make things worse, the exam today was scheduled for 8:30 PM. So I had to stay awake that much longer and also be relatively active while writing the exam.

Somehow I managed night out number 2 in succession yesterday. There was so much to mug that there was no way I could have made it even if I did not crash at all. Anyway I decided to give it my best shot and stayed awake throughout, mugging away for most of the time. I also attended a couple of classes in between.

Finally at 8:30 I went to the class and the prof promptly came and said it would be a 'Take home quiz'. Damn it!!! The good thing was I had not managed to mug completely and this would give me some time to read up and also refer to the book while writing the paper, but the bad thing was that it meant I need to virtually put another night out if I have to complete it in time for the class tomorrow.

No way... I have slept for only 3 1/2 hours in the past 63 hours and there is no chance of me managing another night out.

I am already halucinating and I can hardly make out what I am writing here. I'd better get some sleep now...

Monday, September 11, 2006

Never store your Prof's mobile number on your cell

A very hilarious thing happened last week. There is this guy in CS dept who had put a night out last Thursday. Let me call him X. X felt terribly sleepy during all the classes on Friday. He had a 2 hour class of Prof. Y in the afternoon on Friday at 2:00 PM. This was after another lecture from 1:00 to 2:00 PM Since he was too sleepy, he decided that he would bunk the 2 hour class. He wanted to know if his friend Z was attending the class. So he put in an SMS - "Attending Class?" to Z during the 1'O clock class. He did not receive any reply from Z. At 2, he met Z outside the classroom and both decided to bunk the 2 hour class. So both went back to their rooms and crashed.

Later in the evening on Friday, X left his mobile in his room when he went to the mess. After dinner, he went to the lab to do some assignment. Then he noticed that there was a missed call from Prof. Y. He wondered how Prof. Y knew his mobile number. He did not want to call Prof. Y as it was already 10 PM. So he sent an SMS to Prof. Y saying - "Sorry. I did not have my mobile with me when you had called sir. Anything important?" He did not receive any reply though.

Then on Sunday, X was just checking the sent messages folder on his mobile. That is when he got a shock. He had sent 2 messages to Prof. Y. He remembered sending only one. So when he checked them, he saw that he had sent the "Attending Class?" message to Prof. Y instead of X.

Shit!!!

The actual names of Prof. Y and Z start with the same alphabet. So X chose Prof. Y in the phonebook by mistake. Yeah this is the problem of storing your Prof's mobile number on your cell. Well after this incident, X immediatly prefixed the names of all Prof's in his phonebook with "Z_" so that the likelihood that he sends a message to one of them by mistake is reduced immensely.


PS : No marks for guessing that X is me!!!

Sunday, September 03, 2006

VMware

I just installed VMware on my SuSE 10.1 so that I can use Windows XP also simultaneously. I must say it is a truly good software. It provides literally and entire new virtual machine. My windows installation on the virtual machine actually seems to be running faster than my native install!!!

It is a phenomenal concept. Of course now the virtualization is moving down to the hardware level where next generation processors offer virtualization technology at the basic processor level - well that is a lot different from the software virtualiazation though. In software virtualization, you provide a virtualization layer between the guest OS and host OS which runs on the actual machine. But in hardware virtualization, you will actually have 2 native OS that can run on the physical hardware.

Below are the steps that I used to get Windows XP Pro (guest OS) running on my SuSE 10.1 (Host OS). I need this post as a reference for myself if I need to reinstall it later :) These are the settings that I used and I guess would pretty much work for most systems.
  1. Install VMware Server on Linux (From RPM).
  2. run vmware-config.pl - Use all default settings. Only change the location for the Virtual Machine files if required.
  3. Run VMware.
  4. Click on Create new virtual machine - Set it to Windows XP Professional and follow steps to create the Virtual Machine drives.
  5. Insert Windows XP CD and click on "Power ON the virtual Machine". Then follow normal windows installation procedure.
  6. Shutdown the virtual machine.
  7. In VMware go to Edit->Preferences. Check the autofit guest option.
  8. Do this step if fullscreen mode does not work without doing this... gedit ~/.vmware/preferences -> Change the option pref.autoFitFullScreen from "fitGuestToHost" to "fitHostToGuest". Only then does full screen mode seem to work in higher resolutions. This is because the host OS might not support certain video modes that the guest OS uses.
  9. Now let us set up the virtual sound device. Click on Edit Virtual Machine Settings and in hardware click Add. Choose Sound adapter and follow the steps.
  10. Boot Windows XP on the Virtual Machine. It will first recognise a new sound device and install a driver for it. Dont bother if it is not the driver that for the sound card that you actually have on your PC. It only requires driver for the sound card on the virtual machine.
  11. Click on VM->Install VMware Tools. This will install it on the guest OS. After this, change resolution to anything supported by your monitor and hit Ctrl+Alt+Return. That will take you to full screen in the Guest OS.

Wednesday, August 23, 2006

Seagate - Amazing support

Initially I was worried about the hard disk crash. But now there are no worries. I did not lose too much data too. I was able to access my data by connecting my HDD as a slave on a friend's comp. I had been worried that the hard disk was totally screwed and there was no way of recovering data. Been lucky though.

I contacted Seagate support (Got the local service center number from their India toll free number) a couple of days back. The conversation went something like this:

Service center : Good evening. How can I help you?
Me : Hi. I have a 160GB Seagate Hard disk. I am having some problems with it for the past 2 days. I have not been able to boot into any OS; Not been able to reinstall any OS too.
Service center : Is it still covered by warranty.
Me : Yes
Service center : Please bring it to us. We will replace it.
Me : So will I be given a replacement immediately
Service center : No Sir, Your complaint will get processed in a couple of days, after which you will get your replacement.
Me : Where do I need to bring it?
Service center : (some address)... Thank you.

I had been very impressed. Well all other companies that I had ever contacted earlier for support (not for a hard disk though) always spoke as though the warranty never existed. The worst support I have experienced has been for Sify. I have a Sify broadband connection at home. It took me 15 days to get a renewal. I had called them more than 25 times during this period. The only reply that I always got was, "Our renewal team will get back to you. Your complaint will be processed within the next 24 hours."
Comparing that to Seagate support, I must say I am overwhelmed by the support.

Yesterday I went to the service center to give my faulty hard disk. The support staff there asked me what the problem with the hard disk was. Then he verified if there were any signs of physical damage on the HDD. After that he took my contact details. He asked me if I had any important data on it and I needed support to recover some data. He told me that it would take about 2 days to get the replacement and gave me a receipt. No other questions were asked. Well that shows that the company values its customers and the confidence that it has in its product. I have received 4 mails from Seagate so far indicating the progress of the request. They also have an online tracking system where you can login and view the status of your request.

Btw, Seagate is the only company that offers 5 years warranty on hard disks. Most of the other manufacturers offer only 3 years support. Also it is the only company that prints the toll free numbers for customer support on the hard disk label itself. Hmm.... Impressive.

Hope I get the replacement tomorrow or the day after.

On a side note, I have been running my comp completely on RAM for the past two days. Since there is no hard disk, I have been reduced to using only a Linux live CD.

Update : Got my hard disk yesterday. So that has been less than 1 week of downtime.

Monday, August 21, 2006

Day1 with no comp (Yesterday was Day0)

Its been a little more than 30 hours since my comp stopped booting. I am still trying to figure out if it is actually a hard disk crash or something else like a faulty RAM. I just hope for the latter. Don't want to lose over 140GB of data (mostly movies/games/music). Don't want to take the pains of rebuilding it from LAN. I doubt if I will get back some of it - like some old black and white tam movies
But I guess I will call up Seagate and ask them for support after all. It seems a very bleak possibility that the hard disk is still intact.

Sunday, August 20, 2006

Incomplete without comp?

Today is the first day I think in the past 4 or 5 years that I have not had access to my comp when I needed it. Well my hard disk seems to have given up after all the trashing that it has been under for the past 1 year. The normal benchmarks that computers pass are not of any use when these comps are used in environments like IIT where they are just beaten black and blue. When you get a bit experimental and try to install every possible thing on your comp, there is nothing much that the comp can do. Well infact at some points of time, I had 3 OS on my comp simultaneously. Windows XP Pro, Mac OSX and Suse 10.0 on one instance and Windows XP Pro 32 bit, Windows XP Pro 64 bit trial and Suse 10.0 on another. No one knows how many times I have reinstalled operating systems on my comp. No wonder the hard disk gave away.

Well I really feel crippled without my comp now. Just shows how much I have become attached to my comp. Not that I really do too many useful things on it, but nonetheless I am just waiting to get it back up and running. Just hope that it does not take too long.

Saturday, July 29, 2006

AMD's survival tactics?

So AMD has finally bought ATI. This looks more like a move for survival rather than a tactical move. With the new Intel processor lineup completely thrashing the top of the line AMD processors at less than a third of their costs (Not to mention the earlier top end processors from Intel which the new processors have just made a mockery of), AMD seemed to be doomed. AMD has no new processor launches lined up for the near future. Even lowering the prices seemed infeasible as the new Intel processors achieve the performance of the AMD processors at a fraction of their cost.

Meanwhile the AMD-ATI merger has made quite a few eyes look up. What could be the implications of this merger? There are many short term as well as long term implications of this merger.

The short term effect is mainly the potential damage to partners. Of these, Nvidia is the pain for AMD followed by ATI for Intel. Taking a look at ATI and Intel - Intel buys quite a few ATI chips and graphics cards and also has a license for crossfire, the SLI equivalent from ATI. In all probability this will end very soon. But that is not very closely related to the deal. ATI's chipsets were just a temporary solution to Intel's demand forecasting weakness. Since that has been more or less made up for, the love between ATI and Intel was going to end soon anyway. So not too many losses here.

However the Crossfire + Conroe is likely to be the most sought after gaming platform in the short term. This is because it will take a while before Nvidia brings out its SLI chipsets that support the Conroe processors. The affair between Nvidia and Intel has not been very impressive in the past to say the least. So you can definitely expect Intel to accelerate its internal GPU projects as far as possible. The giant will not want to be bogged down by a cribbing bride.

Hey how about Intel buying out Nvidia? Sound good right? But that is very unlikely. There is really no value addition that Nvidia can do to Intel. There is nothing much that Nvidia can do which Intel cannot do internally. Short term - it would be expensive and not a very smooth affair, long term - why spend money on something that you can make yourself?

Coming to ATI - It will have some short term loss of business from the Intel - crossfire platform if Intel decides to give-up the license. Intel would then have to do without any dual GPU offering for a while. That is unlikely. So don't be surprised if you see an Intel box with AMD crossfire written on it!!!

Now that brings us to AMD-Nvidia. Nvidia has been a close partner with AMD and the AMD+SLI has been the platform of choice for gamers for a long time. So this deal would be a terrible loss for both sides. So AMD is unlikely to give up its successful relationship so easily. They will definitely have support for Nvidia chips too, at least for a while. So the deal is unlikely to cause much of a bother for Nvidia.

Now coming to the long term effects. It is most likely that the x86 architecture is going to take a radical turn. Today we are having dual core processors and with both Intel and AMD looking to launch quad core chips within a year, we look to be headed towards a multi-core future. With software becoming more and more thread and core aware, this sure seems like the future of computing. We are soon going to see mini-cores.

Few years back, processor makers (read Intel and AMD) were churning out chips that were hot, fast, out of order execution beasts that ran a thread a fast as it could go. Programmers were stupid creatures that had to depend on the hardware to do the job for them. Then came hyperthreading where programmers finally got something better from the hardware. Soon dual core CPU's were introduced. Then came Sun with the introduction of Niagara - This is a server segment processor though. It has a massive 8 cores that are capable of 4 threads each. With today's server technology usually being the Desktop technology of tomorrow, we can soon expect similar things in the Desktop arena. Intel is not to be left behind in such things. They are looking at developing a 32 core system with massive multi-threading - Yes you read it right, 32 cores!! However that is quite a while off. Also, it will also take some time before Desktop software can actually make use of such massive threading. They need to also find a workaround to the memory speed bottleneck for that.

The world of multicores is something radically different from that of single cores. You develop each core at a fraction of the cost that it will take to develop a single core processor (with a possibly lower performance) and then you integrate all these into a single chip that makes a mockery of the single core chip in multithreaded applications. This will also help chip makers to speed up the design upgrade cycle.

Besides, you add in GPU functionality to the chip and you have the perfect recipe for a great computer! Well I am not referring to adding a GPU on the same chip, I am referring to introducing the GPU functionality into the x86 pipeline. Say something like a GPU execution unit in the pipeline that makes mince meat of graphics instructions. Sounds wonderful?

Basically GPUs’ don't have much of a future in the industry. AMD and ATI seem to have realized that. Probably Intel and Nvidia are not too far behind. This industry is really interesting. Watch out for newer, better, radically different products being offered at a never before seen pace.

Disclaimer: This blog is a collection of my readings from around the web with a few of my own additions.

Sunday, July 23, 2006

Traffic @ Bangalore

Money can get you the best cars on the planet, but can't get you across Bangalore any faster than others. The last couple of weeks have been the most tortuous period that I have ever experienced in moving around Bangalore. I travel by the Intel shuttle everyday (Home - Intel, Outer ring road) and this is becoming more and more unpleasant everyday. Lucky that I won't have to do this much longer.

I travel about 25km each way everyday. Not a great distance, but the traffic that I encounter acts like a tiny magnifying glass that makes this look like 100km. On Friday, I had a glimpse of the number of vehicles that probably ply in Bangalore at any time. There was a traffic jam on the outer ring road extending from Sharjapur road to probably Airport road. That is a distance of about 7km. And assuming an average density of about 10 vehicles for every 10m (main road + service lane inclusive), there were about 7000 vehicles stranded on the stretch of road from Sharjapur road to Airport road. I saw almost every vehicle that I could think of - right from tractors to the Chevys' to the Toyotas' to the good old Maruthis'. Not to mention the two wheelers because I saw too many for the first time then I guess.

I was stuck midway between Sharjapur road and office for about half an hour on the service lane (our 'clever' driver saw the traffic on the main road and took the service lane and hence I managed to reach that far). Looking out of the window, I saw some guy in a Mercedes Benz shouting at his chauffeur telling him to go fast when there was no way he could move. I just smiled to myself. This guy might be rich, but Bangalore places everyone on an equal footing.

A huge number of apartments are coming up along that stretch of Ring road and I am sure most of the people who will live in those apartments can't get their vehicles out of the apartment in peak hour traffic.

After a lot of struggle, our driver managed to reach a location on the ring road about 1km from office at 10AM (I had left home at 8). It seemed like we would be stranded there for quite some time. So everyone in the shuttle walked the remaining distance to office - Not the most pleasant thing to do, but probably the best of the available choices.

When you add the indirect costs imposed by these infrastructural hazards to a business, is Bangalore still a economically better option than other places?

Friday, June 16, 2006

First post nothing more

Its been a long while since I decided that I must start blogging (more than 2 years infact). Initially it was because I read quite a few blogs and felt inspired to write something (well if u wanna believe that). But the sort of lazy guy that I am, it was just not possible. Anyways I have made a start now and hope to keep it going from now.