G-Sync basics

I would like to understand the mechanism of g-synch method and know the differences between g- and v-synch. Can I get some links to the description, but please not to the advertising material. I want to programmatically turn v- and g-sync on and off