Structure and functions of an ecosystem:

The structure of an ecosystem consists of  both biological communities and abiotic components. The two basic components of an ecosystem are i. The autotrophic component and ii) the heterotrophic component.
The autotrophic components include the autotrophs which convert the radiant energy of the sun into chemical energy and stored as complex organic molecules. The heterotrophs feed on the food manufactured by the autotrophs. The heterotrophs recover the energy by breaking down the complex organic molecules.
An ecosystem comprises of : 1. Abiotic, 2. Producers, 3.Consumers and 4. Decomposers. The nonliving substances called abiotic include factors like light, temperature,   pressure, soil, water, carbondioxide, pH, mineral and chemical compounds. The physical and chemical components of an ecosystem constitute its abiotic structure which includes soil, geographical, climatic factors, energy, nutrtients and toxic substances. The producers are to autotrophs mainly green plants, algae, etc., and they are further sub-divided into i)micro vegetation and ii)macrovegetation. Producers can make their own food by using the carbon dioxide in the atmosphere, water and sunlight and chlorophyll in the leaves through the process of photosynthesis. They are also called as photo autotrophs. Some microorganisms can produce organic matter through oxidation of certain chemicals in the absence of sunlight. They are called as chemosynthetic organisms or chemo-autotrophs. At ocean depths, chemoautotrophic bacteria using the heat available at earth core to convert dissolved hydrogen sulphide and carbon dioxide into organic compounds.
The consumers are mainly heterotrophs like animals that feed on other organisms. They are further sub-divided into micro-consumers and macro-consumers. Herbivores or primary consumers feed directly on producers. Carnivores or secondary consumers feed on herbivores and if they feed on other carnivores known as tertiary carnivores. Omnivores feed on both plants and animals. Detritivores feed on the parts of dead organisms and wastes of living organisms.  The Decomposers are heterotrophs which include mainly bacteria and fungi which derive their nutrition by decomposing and breaking down the complex organic molecules to simple organic compounds and ultimately into inorganic nutrients. The biotic structure prevails in most of the ecosystems. In forests and agroecosystems primary producers predominate whereas in deep ocean decomposers predominate.
Both the biotic and abiotic components influence each other and are linked through energy flow and matter recycling. The flow of energy and matter take place through the food chains.