During the medieval age, one of the main reasons that pushed besieged cities to capitulate was the exhaustion of provisions (foods,water,drugs...) that maintain the every-day life of the city population.
I wonder to what extent could a city generate its own resources by harnessing the little bit of available room and creating farms, small factories and recycling, thus avoiding famine, plague and acquiring what could spare souls...
I konow that someones may argue that there is not enough space to create farms or factories but cities like Byzantium or Cairo were huge and have enough room for that.
Are there any known cities that have been through such an experience, enduring sieges, or was the only hope to smuggle provisions through the enemy lines?