It’s no secret that some of our favourite foods are the handiwork of microbes. Cheeses, breads, beers, yoghurts, pickles – maybe even truffles – all owe their distinctive characters to invisible bacteria, yeasts, and other fungi. Some foods rely on the critters that just happen to be in the vicinity – kimchi fermentation, for example.

But many involve microbes grown on an industrial scale by specialised companies. These bugs are the world’s tiniest farm animals, in a sense – hundreds of thousands of tons of them are reared every year. To learn more about the process, I spoke to Karen Fortmann, a post-doctoral researcher who works at White Labs, a company that cultivates the brewer’s favourite friend: yeast.

The first thing to know about these industrial cultures is that some of them are ancient. Companies store their stock in freezers, the microbial equivalent of cryogenic freezing. Fortmann says that some of White Labs’ strains are much older than even the company, which has been around for 20 years. To produce yeast for clients to use, they thaw a thimbleful of the creatures and feed them on a malt-based solution, moving them into larger receptacles as they multiply.

White Labs grows primarily the yeast called Saccharomyces cerevisiae, the brewer’s stalwart. They also grow S. pastorianis, a yeast used in lagers. But they do provide stranger varieties for homebrewers and other folks looking to experiment. “Now that people are starting to play around a little more,” says Fortmann, “we have crazier types.” One is Brettanomyces, a yeast long used in the making of lambic beers and Belgian ales that generates vinegar when fermented.

The company is cultivating some strains of bacteria, too, because beers made with them – sour beers – are growing in popularity. The results can be pretty funky: some compare the smell of these bacterial brews to the whiff of gym socks. They were an acquired taste for her, Fortmann admits. But some people love them.

Once White Labs’ clients get the yeasts in the mail, they add them to their vats of soon-to-be beer. And then something interesting happens. Yeasts will stay the same forever in a freezer, but when they are deprived of oxygen to force fermentation to take place they start to evolve. The stress makes them creative, and after somewhere between 10 and 30 bouts of brewing, the yeast has changed so much that it’s time to put in an order for fresh organisms to be delivered, Fortmann says.

Food producers have to keep a close eye on what their cultures are up to – bacterial cultures, for instance, can be invaded by other organisms

Some of the mutations result in dead yeast, so fermentation grinds to a halt. Others change the way the yeast clumps together in the fermentation process so much that the beer turns cloudy and has to be strained or centrifuged to get them out. Still others will change the way the beer tastes. “A couple of compounds produced during fermentation, yeast will take them up and make a tasteless, smell-less compound,” Fortmann explains. “But they lose that ability to clean up their own mess” over time.

Problems like this will happen with any microbial culture after it leaves the freezer and starts to do its job. Food producers have to keep a close eye on what their cultures are up to – bacterial cultures, for instance, can be invaded by other organisms floating around in the environment. They can even catch viruses, called phages.

The company Danisco makes bacterial cultures that it sells to yoghurt makers. And it turns out they’ve been using their knowledge of Crispr, a system now famous as a gene-editing tool, to vaccinate their bacteria against viruses for years.

Crispr is originally derived from a natural bacterial defence against phages. When infected, bacteria incorporate pieces of the viral genome into their own, transcribe them for inspection by their immune system, and then destroy anything they encounter that looks like that. Researchers have published experiments showing it’s possible to expose bacteria to a variety of phages in a controlled environment, allowing them to pick up pieces of the viral genome, known as Crispr elements, so that they’ll be protected from the phages in the future. As Kerry Grens writes at The Scientist, that’s essentially what Danisco has done, though the details are not all public. They use more than 6,000 phages to vaccinate their cultures, she reports.

Though Crispr is known mainly for its gene-editing power – it allows researchers to swap DNA of their choice into a genome instead of viral DNA – this particular usage doesn’t involve genetic engineering by the company. It’s just a way to protect the tiniest creatures that help make our food by building up their immune systems – one virus at a time.

Join 500,000+ Future fans by liking us on Facebook, or follow us on Twitter, Google+, LinkedIn and Instagram.

If you liked this story, sign up for the weekly features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.