Microscopic Foundations Of Thermodynamics And Generalized Statistical Ensembles