Push Down Stack

plates-0Maybe you’ve been in a cafeteria and seen those spring-loaded plate dispensers. It’s a big stack of plates in a tube with a spring. As plates are removed, the lower ones are pushed up into sight. Pez dispensers and most gun magazines operate with a similar principle.

Sometimes someone comes along and dumps a new bunch of plates on top of whatever is in the stack at the time. One thing about a stack like this: if you do keep putting new on top of old, the old is never used. In some cafeterias, there might be a plate on the bottom of some stack that’s been there since the place opened in 1958!

One formal term for such a dispenser is a Push Down Stack.

The name is entirely descriptive. With plate and Pez dispensers, and with gun magazines (ammo dispensers!), you fill them by pushing new items down onto the stack of old items.

pez

Awesome Pez!

The pushing part is optional. A stack of plates sitting on a table, say at a buffet, uses the same principle. The push-down part of the metaphor helps to carry the idea that — except for the top item — the other items are out of sight and inaccessible.

It’s that last word that really matters. In a push-down stack, you can only access the top item. To get at the second (or any other item), you have to remove the top item(s).  There’s no cheating or look-ahead in a strict push-down stack.

It’s this inaccessibility property that makes cafeteria plate stacks, Pez dispensers and gun magazines good metaphors. In all three cases, you only can get at the top item. That stack of plates sitting on the buffet table? I could take a plate off the bottom. I could lift half the plates off, take a middle plate,.. you get the idea.

But if everyone at the buffet is well-behaved, the plate stack works the same way, including that new plates cover old plates. This property of stacks has two technical names that mirror each other. Either name is correct; neither is more correct than the other, although you hear the first one most often.

plates-1

LIFO (aka FILO)

The first name is Last In, First Out. The second — mirror — name is First In, Last Out. We abbreviate these LIFO and FILO (and pronounce them “lie-foe” and “fie-low“). The names are precise descriptions of how these stacks work. The last plate put on the stack is the first item taken off. Conversely, that first plate put on back in 1958 will be the last one out.

At this point you might wonder two things. Firstly, is a “stack” and a “push-down stack” the same thing? The short answer: yes. (If anyone wants the long answer, ask, and I’ll answer in the Comments.) Secondly, if there is such a thing as a LIFO, is there a FIFO (or LILO)? Same short answer, although they aren’t called “stacks” anymore, they’re called “queues.” You’ve probably stood in a few.

queued

FIFO (aka LILO)

Actually, you might wonder three things, the third being what is the point of this article. I’m not sure blog posts have to have a point, but this one does. The (LIFO) stack is a metaphor we encounter in life outside of cafeterias, candy stores and gun shops. (You encounter FIFO queues every time you stand in line!)

The very process of our day-to-day lives can have stack-like qualities. (It’s kind of cute that LIFO and “life” are 75% the same word.)

Things we put aside are covered by new things we put aside until there are layers — strata upon strata — of discarded intentions and goals. In the smaller scope, our desks or work areas can take on stack-like properties, buried layer upon buried layer.

I know my life and my work areas get stack-like, both virtually and — in many cases — literally. As one example, I’ve learned it’s almost futile to save cool links for later because, if you get into that habit, all that results is an ever-growing list of links you’ll never, ever follow (or by the time you do, the link has died).

fresh cake

Fresh Cake!

The best time-management tip I ever got was the idea of “one touch” with tasks and, in particular, documents (such as bills). I had a habit of opening bills and then setting them aside for later. The “one touch” practice requires completing a process once begun; no setting aside allowed. (Exceptions: skull fractures, shoe fires, imminent asteroid impacts, fresh cake.)

This single practice has saved me hundreds of dollars in late fees (as I tend to be absent-minded and forget to return to the bills in time). As it stands, I haven’t paid a late fee in years!

[I’m a clean, but very, very untidy person. I do own a set of awesome organizational skills, but I can never remember where I put them, and even when I can find them, they usually need new batteries. Kidding aside, it appears all that goes into my work, which is OCD-level tidy. There’s none left over for bed making or folding laundry.]

The stack metaphor also applies to another life process: interruptions. When another task demands your immediate attention, you “push” your current task “onto the stack” and turn to the new task. When you have handled the interruption, you “pop” your previous task “off the stack” and resume from the point where you were interrupted.

interrupting againNow consider what happens if you’re interrupted by an even more important task during the important task. You can push the one and turn to the other. And if you’re then interrupted by a critical task, you can push and turn again. And once more if interrupted by a super-critical task… and so on.

The hope is that you can “unwind” the layer of tasks, progressively returning to the last task, completing that and returning to the one before that. (It makes me think of the movie, Inception!)

This model of pushing a task, turning to a new task, completing it and popping back the first task is exactly how computers work internally. It isn’t just interruptions (every keystroke and mouse move interrupts the computer); it’s the need to handle sub-tasks to complete a task. For example, if you’re making a cake, you might have a sub-task of separating egg whites. Or when telling a story, you might need a sub-task to explain some point.

[The kind of work I do has many properties that make it challenging. Two big ones are: Tasks have lots of sub-tasks, and the sub-tasks have sub-sub-tasks, and so forth for an awful lot of sub-sub-subs. And, because I can be deep into sub-tasks that all have to be unwound, interruptions are disastrous! A lot of the bugs I find in my code clearly come from interruptions that “blew up my stack” and caused me to forget to return to some task.]

work interruptionThe stack in the computer is strict; the computer must unwind tasks in the exact (reverse) order it stacked them. The top plate always has to pop off first. In real life, you can bounce around among tasks. You can even “time slice” tasks (that is: allocate small bits of time to work on them all progressively in parallel).

How you approach a task depends very much on your work style. And different problems require different approaches.

I’ve told the story of opening the door to my artistic side. Ever since then the pile of notes and ideas has grown. In some cases neatly in notebooks, in other cases pieces of paper in boxes. There are ages, eras of interest. For example, before the software era was the hardware (electronics) era: lots of circuit designs from that time.

disturbedMore recently, blogging presents an active outlet for ideas, but they still come faster than I can (or care to) write about them. So the stack grows and grows. I have blog ideas from years ago that I haven’t gotten to because new ideas keep interrupting me. One of my goals for 2014 is to try to clear my blog idea stack.

Let’s see how that goes! The thing is, those new ideas keep coming. Yesterday I put three new ones on the stack: “Power, Politics & Rational Decision Making”, “The Web: Style vs Content” and “Sequelitus: Our Addiction to the Same Old Shit Over and Over.” And worse, all these ideas vie with a big one: Why am I bothering to write a blog almost no one reads?

But that’s been asked and answered. It’s time to start making babies. Or sausage.

interruptions

About Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts. View all posts by Wyrd Smythe

2 responses to “Push Down Stack

  • Lady from Manila

    Hey, you just got to share those three new blog ideas with us. Didn’t you just write in your recent post that “readers were never the main point; documenting was?”

    I used to implement the FIFO, LIFO, LILO, FILO systems in managing inventories of supplies, stocks, and goods of a company when I was still an accountant.
    Then a joke went around as to what disposal method to use if one has multiple girlfriends or boyfriends. 😀

    Have a grand week ahead, Wyrd.

    • Wyrd Smythe

      Indeed, a FIFO queue is a standard stocking protocol. The article was long enough that I didn’t mention it, but a LIFO stack is a terrible stocking protocol if the stock is perishable (unlike that cafeteria plate from 1958).

      So what was the joke? You can’t mention a joke and then not tell it!

And what do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: