Category Archives: History

Software Transaction Memory Risks

Output stream has a detailed and entertaining review of handling concurrency with software transaction memory (STM).

Suppose I have a small bank with only two accounts, and all that can happen at this bank is money can be transferred from one account to the other. A “correct” program…[is] when a single thread is performing the transfers, but when multiple threads are performing the transfers, bad things happen.

Imagine standing in a queue in England before WWII. Everyone would fight and pick their way to the teller in order to get service. Any group approaching a crowd in size would get so wildly out of control even the French and Italians complained about barbaric behavior of the English. During the hard times of war, however, the orderly queue was introduced with much propaganda to prevent inefficient riots and fights over scarce resources.

English orderly queuing behavior evolved into a common rule still present today, enforced by others waiting their turn. What happens if people decide to abandon the rule? The old race conditions, incorrect sync, and deadlock would return, as explained in a presentation by Brian Goetz.

STM, instead of trying to enforce concurrency controls offers an isolation boundary for transactions, like moving transactions from an open teller queue into a private office at a bank. Transactions are behind a closed door instead of subject to interruption and blocking.

STM is an alternative to lock-based synchronization. In essence it places a guard around a specified memory location (in our example we’ve placed it around the “accounts” map). The guard is called a Ref. You can only gain access to the memory location by initiating a transaction with an atomic block. Once inside the atomic block, you can gain access to the data in the memory location through the Ref and make modifications. Modifications are isolated, so changes can only be seen within the scope of the atomic block. When the transaction ends, an attempt is made to update the memory location atomically. However, it may be that another thread has committed a transaction before the attempt. If this is the case, the logic inside of an atomic block is retried until an update can be made.

Of course the boundary also has rules to reduce risk for STM. Once inside, bad things can still happen from dependencies, races and interruptions:

  • disallow side-effects
  • disallow changes
  • use independent business logic

The End of the Economist

I admit I used to be a huge fan of the Economist. There were days when I would sit in the library and pore over editions from the early 1940s and marvel at the lengths they would go to offer analysis without bias. If you ever have a chance to do it I recommend it highly. It was spooky to see how accurate their writers were in predicting the future.

Things have changed a lot for them in the past twenty years let alone over sixty. I find their writing less compelling and less informed as time goes on, as if they are looking at the world through a shrinking scope. They seem to just be lazily writing their opinion, without any bother to research or read the data available. Take the recent article “Coming Full Circle“, for example.

They make a fair point about the impact of big media and industrialization in the West, but they also give a lopsided history of print and social networks from a pseudo-Western lens:

Until the early 19th century there was no technology for disseminating news to large numbers of people in a short space of time. It travelled as people chatted in marketplaces and taverns or exchanged letters with their friends. This phenomenon can be traced back to Roman times, when members of the elite kept each other informed with a torrent of letters, transcriptions of speeches and copies of the acta diurna, the official gazette that was posted in the forum each day. News travelled along social networks because there was no other conduit.
[…]
In early 1518 Martin Luther’s writings spread around Germany in two weeks as they were carried from one town to the next. As Luther and his supporters argued with his opponents over the following decade, more than 6m religious pamphlets were sold in Germany.

Uh, ok, a timeline from the Romans to the Germans?

That does not sound like a proper student of British education. Perhaps it is an American writer, unfamiliar with the Schoyen collection in London. I mean how ironic and strange for a British publication to glorify the technology of the Romans and the Germans!

Moreover, they completely miss the obvious fact that the Song (960-1279) dynasty China was widely distributing inexpensive printed books made with movable type. This, of course, was possible due to block printing used previously during the Tang (618-906) dynasty when printing cloth shifted to making Buddhist scrolls.

How do these fit the Economist’s “there was no technology” claim for information dissemination until the 19th century? Perhaps they are using a very specific and narrow definition of “dissemination” and a very specific and narrow definition of “short space of time”? Yes, Twitter did not exist until Twitter existed. Great analysis of “little distinction between producers and consumers of information” — social media.

The Economist missed a great opportunity to reference the “Diamond Sutra” (“stolen” by the British), which was printed on the 11th May 868 AD according to the British Library and starts with the words

“Reverently made for universal free distribution…”

They also missed the opportunity to explain the rapid transition in technology from elite use to common, such as the period soon after Empress Shotuku of Japan in 764 AD printed a million scrolls of the Hyakumanto Darani and distributed them to celebrate the suppression of Rebellion led by Emi no Oshikatsu.

I guess I also could go on and bring up pre-historic fire/smoke non-elite communication systems (that influenced Bronze Age relics still evident in Ireland and England), or birds like the Pigeon Post, or the hydraulic semaphore system used in Britain by Francis Whishaw in the 1800s, not to mention the talking drum…but I guess for the time being I’ll just have to seek other sources of news to find an informed and introspective analysis.

2011 BSidesLV: A Cloud Odyssey

I will be presenting at the 2011 BSidesLasVegas conference:

“2011: A Cloud Odyssey”

When: August 3 or 4, 2011
Where: The Artisan Hotel, 1501 West Sahara Avenue, Las Vegas, NV 89102
Cost: Free (as always!)

Are you ready to fly into the clouds? This presentation takes the audience on a humorous review of technology and progress since the 1968 American epic science-fiction film by Stanley Kubrick and Arthur C. Clarke. It explores a philosophical evolution as it relates to technology and proposes some surprising new answers to four classic questions about managing risk:

  1. What defines human nature
  2. How can technology change #1
  3. Does automation reduce total risk
  4. Fact, fiction or philosophy: superuser

2011 a cloud odyssey

This is the next installment in my series of 1960s-film themed presentations. The last one (“Dr. Stuxlove”) was at BSidesSF 2011.

Copy of Presentation: 2011acloudodyssey.75dpi.PDF

The Last Mountain

Movie PosterThe official selection of the 2011 Sundance Film Festival now is open in select cities. It will only play for a few days.

The Last Mountain documents the effects of coal companies on the environment, health and jobs in America.

  • Almost half of the electricity produced in the U.S. comes from the burning of coal.
  • In the last decade the coal mining industry spent more than $86 million, the railroad industry spent $350 million, and coal burning electric utilities spent more than $1 billion on political campaigns and lobbying.
  • Each year emissions from coal-fired power plants contribute to more than 10 million asthma attacks, brain damage in up to 600,000 newborn children, and 43,000 premature deaths.
  • The health and environmental costs associated with mining, transporting and burning coal, as reported by a new Harvard Medical School study, are estimated to be $345 billion annually – or more than 17¢ per kilowatt hour. These costs are often referred to as “externalities” since they are costs borne by the public which are not reflected in the price of coal-fired electricity.
  • Per the Harvard Medical School report noted above, the cost of coal electricity goes up by approximately 17¢ per kilowatt hour, totaling 23.1¢ – or nearly three times that of wind – if you include the following costs borne by the public: Air Pollution Illnesses, Mercury Poisoning, Health Damages from Carcinogens, Public Health Cost to Appalachia, Climate Change Impact.

Wow, coal costs triple when you account for impact on health? And it’s linked to criminal activity?

Over the past 10 years they’ve destroyed 1.4 million acres illegally. They’ve flattened 500 of the biggest mountains in West Virginia. They’ve illegally buried 2,200 miles of rivers and streams. They detonate the equivalent explosive power every week of the Hiroshima bomb, just in West Virginia.

The data being compiled brings to mind the movement that eliminated coal in London, England.

That city used to think that it had a naturally heavy fog, until they realised that it was a toxic cloud from burning coal. Change really came only after catastrophe, like the deadly winter of 1873

London is famous for its smoky, dirty skies and “pea-soup” nights wrapped in heavy fog. For many, the fog provides a romantic setting for mystery and intrigue, but even Sir Arthur Conan Doyle’s famous character, Dr. Watson, describes the fog as a “greasy, heavy brown swirl…condensing in oily drops upon the window panes.” During this winter, the fog lasted from November to February. In the week following the worst of it, deaths rose 75%.

Then there was the deadly winter of 1952

…a toxic mix of dense fog and sooty black coal smoke killed thousands of Londoners in four days. It remains the deadliest environmental episode in recorded history.

The so-called killer fog is not an especially well-remembered event, even though it changed the way the world looks at pollution. Before the incident, people in cities tended to accept pollution as a part of life. Afterward, more and more, they fought to limit the poisonous side effects of the industrial age.

[…]

Everyone in London walked blind for the next four days. By the time the smog blew off on Tuesday Dec. 9, thousands of Londoners were dead, and thousands more were about to die. Those who had survived no longer spoke of London’s romantic pea-soup fog.

Killer Coal in London

The effect of coal on London was captured by artists and writers of the time. Their work has become a reference point that still shows up today when discussing pollution, as found in a recent article by the New York Times:

There is a Dickensian feel to much of the region. Roads are covered in coal tar; houses are coated with soot; miners, their faces smeared almost entirely black, haul carts full of coal rocks; the air is thick with the smell of burning coal.

There are growing concerns about the impact of this coal boom on the environment. The Asian Development Bank says it is financing pollution control programs in Shanxi because the number of people suffering from lung cancer and other respiratory diseases in the province has soared over the past 20 years.

The difference in America clearly (pun not intended) seems to be that killer coal effects are being spread out over rural communities (the last mountains, lakes, streams) instead of cities and so it is hidden — taking much longer to be accounted for and traced to human decision.

Obvious lessons from history, such as Dickensian London or even a more recent Kathmandu, apparently are not enough to motivate the US to properly regulate coal, reduce harm and seek less costly (e.g. cleaner) alternatives.

“You won’t believe that this is America….and now it’s what we imagine Hell to be.” — Emmylou Harris