An ecosystem is the totality of the environment encompassing all chemical, physical, geological and biological parts. Ecosystems function by the exchange of matter and energy. Plants use chlorophyll in photosynthesis to convert inorganic material into organic compounds and to store energy for growth and reproduction. Plants are autotrophs and the primary producers in most ecosystems. All other organisms are heterotrophs, the consumers and decomposers in ecosystems.
Herbivores eat plants and release the stored energy.
Material is constantly recycled in the ecosystem, but energy gradually dissipates as heat and is lost.