Why are dot underscore ._ files created, and how can I avoid them? I am using different operating systems on different machines on different locations. I am using a USB flash disk to keep my files (source codes etc.).

I am new to Mac OS X and now I realize there are lots of files created with a dot underscore ._ prefix.

Questions

Why are ._ files created? 

What are their purpose? 

How can I avoid them?
You can't avoid them (but see the dot_clean answer by Saeid Zebardast --they can be removed from a directory if that is what you need).  They're created to store file information that would otherwise go into an extended attribute on HFS+ (Apple native) or Unix/UFS volumes; in earlier Mac OS this would be the resource fork.  Finder file operations will create them automatically to store the icon information, plus Time Machine stores some information in them so if you copy a file backed up via TM it will have that information copied as well.

(This is nothing new; I've noticed that XP and later leave various turds around as well, although not quite as many.)