Tech-inzichten door Niek de Greef. Reflecties op technologie, software development en de impact van digitale innovaties op cultuur en maatschappij.

EWD 108 and EWD 116 – about the banker’s algoritm

In EWD 108 and EWD 116 Dijkstra describes the banker’s algoritm to prevent a so-called deadly embrace. This algoritm manages different scarce resources in such a manner that all in need for one or more of the managed resources, are guaranteed to get their hands on the resource at some point in time.

Of course, in computer science, a computer – it’s operating system – manages a number of resources that are required by the processes running on the computer. And how many resources each process needs is not known beforehand (and often dynamically determined).
The analogy used in the paper is that of a banker lending money to clients, with the complicating constraint that clients do not know beforehand exactly how much money they will need. So they can lend more funds later on.

The situation could occur that the banker has only left an x amount to lend out, and a client John comes with a request for an additional amount larger than x. The banker can only hope that one of the other clients will soon finish their business and return their money. Only then can the banker help John. If however none of the other clients however can finish their business without coming to the banker for an additional lending, the banker is in deep trouble. His clients are waiting for eachother to finish their business, but to finish the business they all need some more money which they all hold themselves. A deadly embrace – “dodelijke omarming”.

Paper EWD 108 is a first exploration of the algorithm.
The core of the algorithm is the “trick” that the sum of the amount lended + the maximum amount needed of the last lender accepted is never larger than the amount of money the banker has available. As such the banker can always guarantee that he will get the money back because the last lender can always be satisfied. So the last lender is a sort of clinet of last resort. She can always guarantee return to a safe state is possible. An because for that state the algorithm also guarantee (inductively) that: “the sum of the amount lended + the maximum amount needed of the last lender accepted is never larger than the amount of money the banker has available”. (All my words.)

EWD 108 describes a small banker’s algorithm in pseudocode. The algorithm is somewhat clumsily written, and (because it )holds a goto (!) (goto consideren harmful). 
In EWD 116 the algorithm is refined, and no longer presented in pseudocode.The algorithm EWD 108 requires the claims for money to be sorted, the algorithm in EWD116 has removes this constraint.

Also in EDW 116 Dijkstra make a remark about different type of claims (in banker’s term, different currencies, for example). Apparently someone has made remarks that there may be different types of resources that need to be managed by the operating system – or Dijkstra himself thought it necessary to add this nuance. Dijkstra writes the algorithm is only applicable for a single type of resource (currency).

From a technical perspective the paper is interesting from an algorithmic perspective, and a story-telling perspective – it illustrates Dijkstra great use of metaphors from the mundane world to explain complex problems. 

Also from a historical computing perspective the paper is remarkable. Dijkstra totally discards the possibility of pre-emptive scheduling – that is: have the banker tell one of his clients to pause his business until other clients have returned their money. In not even very modern computing this is very common: processes can be “pre-emptively” put to rest to make sure other processes can progress. Apparently at the time of writing, which we do not know for sure (both EWD’s are not dated; somewhere before 1964?) pre-emptive scheduling was to be invented (or Dijkstra would have been aware for sure).

Dijkstra in EWD68: plain English unfit for programming

Edsger Dijkstra portrait

In 1961, Edsger Dijkstra wrote EWD 68, a short but powerful critique of the idea of using natural language for computer programming. His objections are still relevant today, especially in discussions about AI and “natural” interfaces.

What is EWD68 about?

In EDW68 Dijkstra expresses his concerns about a project reported by researcher H.J. Gawlik to create a compiler based on a combination of mathematical notation and plain English. Dijkstra’s concern lies not so much due in the fact the idea was raised, but that it still existed after the 2,5 year that passed since he first heard about it.

Gawlik was a researcher in the Royal Armament and Development Establishment, a UK Defense R&D organisation. (I tried to retrieve some personal data on Personal data on Gawlik but the Internet failed me).

Why natural language doesn’t work for programming

According to Dijkstra, plain English, or in general language used for human to human communication, is full of nonsense (humor, sloppiness, incompleteness, contradictions, etc.). What is expected from human to computer communication should be precise and unambiguous.
Therefore plain language is unfit for the purpose Gawlik aims to use it for, it “is obviously unfit to express what has to be expressed now”.

Dijkstra was right, 50 years later

I guess Dijkstra was proven right. Programming languages based on natural languages are nowhere to be found. The approach from Gawlik is a bit like adding human characteristics to AI systems nowadays: it makes the basically as sensitive to erroneous reasoning as human beings themselves.

Gawlik has written a response in which I sense he argues Dijkstra has not understood the goal of what Gawlik was trying to achieve, but unfortunately I can not find the full article and do not wish to may 19$ for it on ACM (goodness, why?).

OBS Studio

OBS Studio is een geweldig tool om video opnames te maken van je computer. Ik gebruik het om trainingsmateriaal te maken, veelal voor software tooling.

OBS

Met OBS Studio kan je je scherm opnemen, tegelijk met het gelijk dat je kan inspreken zijdens het maken van een instructie.  Ook kan je de schermopname live streamen. Het tool is van professionele kwaliteit. Het is zeer stabiel en heeft vele mogelijkheden, zoals verschillende broninstellingen en uitvoermogelijkheden. 

By readers

The Long(er) Tail from Chris Anderson inspired my to build a ExecPgm.org website which aims gather to knowledge, tools, shareables on mainframe technology, anything that is useful knowledge for the mainframe crowd out there. Without any minimal or maximum sophistication level. Not sure where it will go but if nothing else it is a nice (WordPress) learning experience for me.

Who is Atanasoff – and The Dawn of Software Engineering

In The Dawn of Software Engineering by Edgar Daylight (researching Dijkstra) I stumbled upon the name of an early computer scientist called John Atanasoff. Unfamiliar with this name I decided to look him up. Atanasoff, I found out, was the inventor of the digital computer! And I was not aware of his name (or must have worryingly forgotten). 

The Internet tells me Atanasoff invented and constructed the first digital computer already in the 1930s! It was called the ABC (Atanasoff Berry Computer).

According to The Internet he spent much of the second half of his career in a courtcase with Sperry-Rand, who claimed that ’their’ Eckert and Mauchly divised the digital computer and Honeywell had used their patent. In 1972 federal court in the US came to a conclusion:

“The subject matter of one or more claims of the ENIAC was derived from Atanasoff, and the invention claimed in the ENIAC was derived from Atanasoff. “

“Eckert and Mauchly did not themselves first invent the automatic electronic digital computer, but instead derived that subject matter from one Dr. John Vincent Atanasoff.”

Auch for my ignorance.

Some links with more about him:

https://history-computer.com/People/AtanasoffBio.html

https://history.computer.org/pioneers/atanasoff.html