You have just experienced the S3 sleep state. It was designed to save you money (both in power costs and hardware lifetime). Your computer was not shut off, it was still drawing several watts of power. Just wake it up: hitting the power button should be sufficient, and you'll notice a lack of a BIOS screen, loading screen, etc...your system will simply show you the desktop again.
is this how the Vista defrager work
Yes. The defragger was redesigned for Vista, and not just the user interface, or lack thereof, either. For example, it now runs automatically, negating any need to run it manually. Also, it now ignores files smaller than 64 megs.
More info.