What do i and Number represent in the Bakery Algorithm?

I am studying the bakery algorithm, and I am unsure of what the variable i represents in it. I understand that Entering represents a bool value to protect Nummber while it is updating, but I'm having a hard time finding clear explanations as to what variable is doing what.

Is Number an array of threads? Is i a particular thread? Or the value being updated?

1. What do i and Number actually represent?
2. What is passed in via Thread(integer i)? The value we are locking? Or a thread ID number?
3. Is there a value that represents a value being locked?

For reference, here is the Bakery Algorithm I am referencing, from Wikipedia:

   // declaration and initial values of global variables
Entering: array [1..NUM_THREADS] of bool = {false};
Number: array [1..NUM_THREADS] of integer = {0};

lock(integer i) {
Entering[i] = true;
Number[i] = 1 + max(Number[1], ..., Number[NUM_THREADS]);
Entering[i] = false;
for (integer j = 1; j <= NUM_THREADS; j++) {
while (Entering[j]) { /* nothing */ }
// Wait until all threads with smaller numbers or with the same
// number, but with higher priority, finish their work:
while ((Number[j] != 0) && ((Number[j], j) < (Number[i], i))) { /* nothing */ }
}
}

unlock(integer i) {
Number[i] = 0;
}

while (true) {
lock(i);
// The critical section goes here...
unlock(i);
// non-critical section...
}
}

• Where did you get this presentation of the algorithm from? Doesn't the text around the algorithm in that source answer your question? – David Richerby Feb 25 '17 at 23:14
• As I mentioned, I got the algorithm information from from Wikipedia which explains some stuff, but it's still unclear to me what is what. – The Fluffy Robot Feb 25 '17 at 23:23
• Sorry -- I didn't notice the link. But, as I suspected, the text around the algorithm on the Wikipedia page explains what both number and i are. – David Richerby Feb 25 '17 at 23:29

According to the analogy, the "customers" are threads, identified by the letter i, obtained from a global variable.