text
stringlengths
0
2.46k
**Leslie Lamport:** Right. And if you want to talk about absolute time, you don't build it into your movie camera.
**Jerod Santo:** \[laughs\]
**Leslie Lamport:** You simply have a clock in your movie.
**Jerod Santo:** Right.
**Leslie Lamport:** And it doesn't make any difference to that clock whether there's one step between one second and the next, or 1,000 steps between one second and the next. And what that does is it makes the math so much simpler. And simplicity is the key to being able to deal with complexity. We have to have a reall...
**Jerod Santo:** Was this idea in the bakery algorithm? It sounds like it was in there.
**Leslie Lamport:** No, no, no. It's separate from that.
**Jerod Santo:** It's separate. Real quick, describe your bakery algorithm. I'll try to contextualize it, but... It seems like this, at least time insensitivity, or -- I don't know. Explain it first, and then I'll explain why I'm trying to tie it together.
**Leslie Lamport:** \[50:11\] I'll say this problem is stuttering insensitivity. You don't need it when you're just looking at a single system. So if I'm only going to be looking at an hour/minute clock, I don't have to worry about adding steps in which the minute doesn't change. It's only when I have this hour/minute ...
**Jerod Santo:** Because of the algorithm, or because of the circumstances it is trying to solve?
**Leslie Lamport:** Because of the circumstances, just looking at this. If wanted to combine the bakery algorithm with something else, then stuttering insensitivity, then I want to make sure that I describe my algorithm the way that's stuttering-insensitive. Now, the thing about TLA is you don't have to think about it,...
**Jerod Santo:** Right. It doesn't take much.
**Leslie Lamport:** Right. So when you're writing the specification, you're not thinking about stuttering insensitivity, you're thinking about the system you're describing. If I'm thinking about an hour/minute clock, what I'm thinking about is hour and minutes; I don't have to worry about anything else. But when you wr...
**Jerod Santo:** Right. It's a property of the implementation of the system that TLA provides for you. And as long as you're thinking about a singular system, then I guess in that case it's irrelevant. So let's look at this bakery algorithm. This is one of the six bullet points of which they say the reason for your Tur...
**Leslie Lamport:** Paul Johnson and Robert Thomas. But that wasn't the bakery -- they didn't influence the bakery.
**Jerod Santo:** Oh, I'm sorry.
**Leslie Lamport:** That was the time clocks paper.
**Jerod Santo:** My bad.
**Leslie Lamport:** No, the bakery algorithm happened when -- actually, that was the first concurrent algorithm that I wrote.
**Jerod Santo:** Oh, wow.
**Leslie Lamport:** I became a member of the ACM, and started getting the communications of the ACM. It's the first computer science journal that I ever looked at... Actually, I wasn't even aware that there was such a thing as computer science, because that was in 1972, and there really wasn't computer science in those...
**Jerod Santo:** News to you. Yeah.
**Leslie Lamport:** But anyway, so they had this algorithm for solving mutual exclusion. Mutual exclusion is the problem that if you have a bunch of processes running, and say some process wants to use the printer - well, if you had two processes trying to print at the same time, and you get the output interleaved on t...
\[53:50\] And the problem was recognized as being important and introduced by Edsger Dijkstra, I think it was in 1965. At any rate, it lead to a whole bunch of algorithms, mutual exclusion algorithms, which had better and better properties in some sense... And so I read this paper of this algorithm, but it seemed awful...
**Jerod Santo:** \[laughs\] A challenge.
**Leslie Lamport:** And I came up with the bakery algorithm. And I don't think I'll bother describing it here, but when I had written it, when I wrote the correctness proof, I realized that that algorithm had a remarkable property. All these algorithms work by processes for communicating by shared memory. One process w...
And the beautiful thing about that algorithm is that if a reader reads while the value is being written, it doesn't matter what value that read gets. So if I'm changing the value of the variable from 99 to 100, and you come and read it, you might get 4,933 or 0, and the algorithm still works.
**Jerod Santo:** Did you know that at the time, or you've discovered this later?
**Leslie Lamport:** I discovered it when I wrote the proof.
**Jerod Santo:** You did. Okay.
**Leslie Lamport:** That's one example of being a mathematician.
**Jerod Santo:** That's why proofs are good, right?
**Leslie Lamport:** Well, actually, I went on to formalize the way I was writing those proofs in a way that I think is really nice, and gives you a nice way of thinking about concurrency, but is not a practical way of writing the kinds of specifications that I was talking about in the real world. The bakery algorithm i...
\[57:59\] Nowadays, we write specifications - think of it as pseudocode, in a way - where we assume that reads and writes are separate actions that can't happen at the same time as one another... And so we don't worry about it, and we leave it to the implementation to figure out how to do that.
**Jerod Santo:** Right. So I heard you describe that particular algorithm as a) your favorite, but I also heard you describe it as one that you said you discovered; not the inventor, but the discoverer... Which I thought was kind of interesting and somewhat poetic... And I'm just curious, not necessarily to distinguish...
**Leslie Lamport:** I cannot tell you what happens in the microsecond where something happens.
**Jerod Santo:** \[laughs\] I want to know about that moment of inspiration.
**Leslie Lamport:** Well, it wasn't a moment, in a sense... The reason it's called the bakery algorithm is when I was a kid, there was a bakery - these days, it would be called the deli algorithm - where a bunch of people went to get served, and you have this machine that gives out tickets, it gives out numbers... And ...
You first get the obvious problem, "Well, what happens if two people chose the same number?" And then, in that case, you serve people in the alphabetic order of their names. So that's a problem that's easy to solve. And so I wrote this algorithm, and the obvious way of writing it gave a bug, and I saw that bug pretty q...
**Jerod Santo:** Right.
**Leslie Lamport:** But fixing that bug, it worked. So that's how it got discovered. There was no moment, other than perhaps that moment that brought back the memory of that bakery, because that was the only store in the neighborhood that used this way of giving out tickets.
**Jerod Santo:** Yeah, we have one of those still here in our local town where you get a ticket. It's parallel, they've got some concurrency going on, because they have multiple strings of numbers going on, because we're always sitting there, trying to -- it's a very popular place. Like, I'm 275 -- because you're wonde...
So when you've got the solution all figured out, did you then take it back to that editor, the one who had sent you the bugs?
**Leslie Lamport:** Well, I resubmitted it to the ACM journal.
**Jerod Santo:** That had to feel good. What happened next? Was it like immediately --
**Leslie Lamport:** \[01:02:10.15\] Well, it went through the reviewing process and got published.
**Jerod Santo:** Simple as that.
**Leslie Lamport:** But the thing is, there are various -- you know, studying that algorithm, and also... Well, both the method of reasoning that I developed based on it, and... I'd say the next three years or so, three or four years of what I did was all, based on that algorithm, and studying that algorithm.
For example, if you read my number while I'm writing it, and I'm writing it from 9 to 10, and you get a million - which is possible, and then you write that - well, numbers might start increasing very fast. So you don't want that. So what I did is I devised an algorithm that if I'm changing it from 9 to 10, it will gua...
**Jerod Santo:** Refinements for -- that's for performance reasons, and...