Question: When I do ping stackoverflow.com from command window in Windows, how does it get the ip address of stackoverflow. Basically how does the entire thing work ?

Answer: 
For @Evan (because I'm waiting for `rm -rf` to finish before i can do work): 

Here is the process of ping resolving a website: 

1. An electrical signal in your brain generates what is known as an idea.
2. This idea is converted to another electrical signal, that travels from your brain, down your spine and into the nerves in your hands where it is processed by the muscles in your fingers.
3. Your fingers convert this electrical energy into mechanical energy which forces the proper key down on your keyboard.
4. The depression of the switch on the keyboard triggers another electrical signal to travel down the wire (or over the airwaves) from your keyboard which triggers an interrupt at the hardware level.
5. This interrupt alerts the operating system of a pending action it needs to take.
6. The kernel process the signal from the keyboard and outputs feed back to the screen
7. the light energy on the screen is converted into electrical energy by your eye and sent to the brain for processing
8. Once the brain has processed and confirmed the readout from the screen is what you want, repeat steps 1-8 until you send the signal to depress the "enter" key
9. The ping command then takes the input - in this case `ping serverfault.com` - and sends a signal to the Operating system to do a ***DNS LOOKUP***
10. The operating system sends a signal to the DNS subsystem, which generates a packet and sends it down the OSI model until it reaches the hardware
11. an electrical signal is generated on the nic and sent out the ethernet cable (or whatever physical connectivity if fiber s/electrical/optical )
12. The signal goes through intermediary network connectivity (switches/routes/etc) until it reaches the ***DNS SERVER***
13. The ***DNS SERVER*** processes the request and reverses steps 10-11 to get back to your machines where it is processed by the OS and passed back to ping.

(I skimped on a couple of places mostly because i ran out of juice and only have 1/2 a cup of coffee in me)
It is called [DNS](http://en.wikipedia.org/wiki/Domain_Name_System).