Can technology help avoid stampedes?
It seems the cruellest and most unnecessary of deaths - to be crushed in the midst of a crowd.
But even in the 21st Century such deaths are still common, as a stampede at a recent Hindu festival in India, which killed about 115 people, proved all too sadly.
Horror quickly turned to anger as the Indian media reported that better crowd management could have prevented the tragedy.
But can technology also play a role in making sure that such disasters are not repeated?
At the Hajj pilgrimage, the world's largest Islamic gathering, which takes place in October, the authorities now use live crowd analytics software, which can not only spot problems in the crowd but also claims to be able to predict where overcrowding is likely to happen.
Live data feeds come into a large operations room where they are analysed by military personnel, the police and other crowd managers.
The software provides accurate and real-time data on crowd numbers, densities, distributions and flows.
"Crowds can be dangerous places. Whether triggered by factions within the crowd, by natural disasters or misguided crowd managers, there is a long history of crushes, stampedes and failed evacuations," said Fiona Strens who co-founded CrowdVision, the firm behind the software.
"It spots patterns of crowd behaviour that indicate potential danger such as high densities, pressure, turbulence, stop-and-go waves and other anomalies."
As large-scale events go the Hajj is one of the biggest and it has a pretty bad track record; over the years thousands of lives have been lost.
One of the worst incidents occurred in 2006 when a stampede on the last day of the pilgrimage killed at least 346 pilgrims and injured another 200.Crowd behaviour
As part of his PhD research, CrowdVision co-founder Dr Anders Johansson analysed the CCTV images of the pilgrims before and during the crush in 2006, and realised that there were patterns of behaviours that, spotted early enough, could have prevented it.
In 2007, his system was installed in Mecca and it has been monitoring the pilgrimage every year since.
While the company doesn't like to tempt fate, since its involvement, no fatalities have occurred.
That isn't entirely down to the technology though, admits Ms Strens.
"In recent years the Mecca authorities have invested in better infrastructure, planning and technology to assure pilgrim safety but we play a very important role providing the real-time data and insights needed to inform operational decision-making," she said.
For their part, the Saudi authorities are pleased to have such a technology partner.
"The live crowd analysis greatly improves safety of pilgrims," said Dr Salim al Bosta, crowd management expert, at the ministry of municipal and rural affairs.
But crowd scientist Keith Still, who was special adviser on the Hajj from 2001 and 2005, is more sceptical about how much technology can help in such places.
"Any technology has to be coupled with a crowd management plan," he told the BBC.
In fact he thinks that technology installed at the Hajj in 2006 - before CrowdVision's involvement - actually contributed to the tragedy that unfolded.
"Tech firms offered the Saudis new systems and there was an over-reliance on technology. There was lots of digital signage put up to direct the crowds but it was just a mess," he said.
He is also sceptical about whether the technology used by CrowdVision can work in a live situation.
"It spots shockwaves in the crowd but if these are happening then you are already at a point where people could be crushed or seriously injured. Whoever is in control has fundamentally lost control of the situation by then," he said.
"It could become an exercise in futility."
For him, the value of CrowdVision lies more in its ability to precisely count how many people are at an event.
"If you need to track capacity such tools are great but it is a long way away from being a risk management system," he said.Street protests
Cities around the world are getting more and more overcrowded. By 2050 the UN expects the world's population to top nine billion, with nearly 70% of them living in towns.
And people are spending more time in crowds. Large-scale music and sporting events are commonplace, as are big screens that beam events to public places to allow those outside of venues to watch the action.
Spontaneous street protests are also on the rise, thanks to the proliferation of social media and smartphones.
Technology that can monitor crowds is going to become increasingly important, thinks Ovum analyst Joe Dignan.
"Understanding how people move through a city will help develop smart transport systems and keep people safe in times of danger whether natural or manmade," he said.
Whether crowds gather to protest, to party or just to be entertained, things can turn ugly in an instant.
Heat maps created by CrowdVision to show how people behaved during a practice evacuation of a city skyscraper illustrate how danger points can build up even when the crowd is flowing well and is relatively calm.
The maps showed that even when the crowd was re-entering the building after the evacuation, there were some dangerous queues building up.
Nowhere is crowd control more important than at a music festival and the software developed by CrowdVision suggests that organisers may be making fundamental errors by posting stewards at the front of crowds.
"The maps suggested the problems were actually in the middle of the crowd," said Ms Strens.
"If the stewards had tablets with real-time information on them, they could see exactly where they needed to be," she added.
Such a solution may not have been realistic for Madhya Pradesh, the Indian state where the recent stampede occurred.
It seems likely the stampede was sparked by panic, following rumours a bridge people were crossing was about to collapse.
The bridge had itself been built in response to a stampede at the same temple some seven years earlier, when attendees had been crushed crossing the river.
It illustrates that, however carefully planned an event is, there is often no accounting for human behaviour.
Technology may help but it is only ever going to be part of the solution, according to Prof Still.
"The best way to avoid this in the future is education on crowd safety," he said.