Predators are either carnivores or omnivores. Parasites may also consume other animals in part. Unlike in predators, for whom killing prey is necessary in order to consume it, it is usually undesirable for a parasite to kill its host, on or in which it lives.
Herbivores also consume other species, generally only in part, leaving the organism alive. However, where the prey consists of single-celled algae, the activities of the herbivorous grazer is generally of the same nature as that of a carnivore. As often in ecology there is seldom consensus on the distinctions; some ecologists prefer functional definitions like the one outlined above, others rather look at the ecological dynamics the relationships between the species create. The Lotka-Volterra equations describe a simple mathematical model of the interaction between predators and their prey.
There may be hierarchies of predators; for example, though small birds prey on insects, they may in turn be prey for snakes, which may in turn be prey for hawks. A predator at the top of its food chain (that is, one that is preyed upon by no organism) is called an apex predator; examples include the great white shark, tiger and crocodile and even omnivorous humans (although, given the chance, some predators such as the Australian salt water crocodile will prey on humans). Such predators are often also keystone species, and as such may have a profound influence on the balance of organisms in a particular ecosystem; introduction or removal of this predator, or changes in its population density, can have drastic cascading effects on the equilibrium of many other populations in the ecosystem.
Specialists and generalists
Many predators specialize in hunting only one species of prey. Others are more opportunistic and will kill and eat almost anything. The specialists are usually particularly well suited to capturing their preferred prey. The prey in turn, are often equally suited to escape that predator. This is called an evolutionary arms race and tends to keep the populations of both species in equilibrium.
There is a full spectrum of specialization. Some predators specialize in certain classes of prey, not just single species. Almost all will switch to other prey (with varying degrees of success) when the preferred target is extremely scarce.
While successful predation results in a gain of energy, hunting invariably involves energetic costs as well. When hunger is not an issue, most predators will generally not seek to attack prey since the costs outweigh the benefits. For instance, a large predatory fish like a shark that is well fed in an aquarium will typically ignore the smaller fish swimming around it (while the prey fish take advantage of the fact that the apex predator is apparently uninterested). Surplus killing represents a deviation from this type of behaviour.
It has been observed that well-fed predator animals in a lax captivity (for instance, pet or farm animals) will usually differentiate between putative prey animals who are familiar co-inhabitants in the same human area from wild ones outside the area. This interaction can range from peaceful coexistence to close companionship; motivation to ignore the predatory instinct may result from mutual advantage or fear of reprisal from human masters who have made clear that harming co-inhabitants will not be tolerated. Pet cats and pet mice, for example, may live together in the same human residence without incident as companions. Pet cats and pet dogs under human mastership often depend on each other for warmth, companionship, and even protection, particularly in rural areas.