Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

grinder (1100)

  (email not shown publicly)
Yahoo! ID: perlgrinder (Add User, Send Message)

Editor of p5p summaries, member of the p5p peanut gallery.

Journal of grinder (1100)

Sunday August 25, 2002
05:07 PM

Stalling the pipeline in the checkout queue

[ #7299 ]
I was in the supermarket the other day after work. I had a number of essentials in my basket and I was itching to get home.

Big problem: which queue to choose? Having learnt about Queuing Theory at school, and knowing that single queue-multiple consumer is as efficient as it gets, it's always an agonizing decision. You have to balance a number of factors: how many people in the queue, how many items do people want to buy, do they look impatient or vagued out. It's better to be behind a person buying 10 of one thing, than one item of ten different things. And, although it pains me to admit it, old people are Bad News. Statistically, you'll waste 30 seconds to five minutes with them in front of you.

So I was pondering this the other day, and reflecting on my worldview, how I tend to algorithmatise things (figuring out the shortest path between the four shops I need to go to, establishing contigency plans in case a shop doesn't have a product I need, that sort of stuff. When house-cleaning I try to keep my hands full. I hate going into room A to fetch something for room B, and realising there was something in room B which should be tidied away in room A). Geeking out, basically.

And as I stood there ruminating on this, I was idly watching the woman at the front of the line, and became more and more alarmed. She was just stacking up the products that the cashier swiped...but not putting them into bags. I couldn't figure out what she was doing, but figured it was bad news for me. And on and on it went, until the cashier had checked out every last item. Then she handed over her credit card, had it swiped, punched in her pin, and only once she had received her docket did she begin to bag up the stuff she'd bought. And I thought "You f5cking moron: can't you deal with asynchronous events?" Because the cashier couldn't start checking out the items of the next person until she'd cleared the decks. Which took a non-trivial amount of time, during which no other work could be done.

Meantime I note that the people who were at the ends of the other queues are now close to being served, and I've still got two people in front of me. But I'm in too deep at this point to bear the cost of cutting my losses and requeuing on another line.

The next person went through without a hitch: a few items, had cash ready, out straight away.

Then the person in front of me went through. Seemed to be okay: started bagging up the goods as soon as they came through, but she had a fair number of things to buy. Then it turns out that she has a Method. All the fruit goes together, the stuff that requires Refrigeration goes together, tins kept apart from packets and so on. And the cashier is done quickly and announces the price. But does she do anything? Noooooooooo! She just keeps putting stuff in bags. And the cashier, who is polite (the Customer is always Right and all that) says nothing.

At this point I just take a deep breath and resign myself. The people who were at the ends of the other queues are all long since gone. At times like this I can't help thinking that a lot of what we learn in Computer Science is applicable to the Real World. And one of the cardinal sins is stalling the pipeline. When you have people queued up to do something, you want to get in and get out as fast as possible, just like an instruction on a CPU. Because wait states are just time lost. Gone, never to come back.

I really, really hate when that happens.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • The thing that truly irritates me is the way that most people think that life's better if you just kind of doddle along, letting things happen to you, and how dare you try to get on with your life at the expense of moving around them.

    I can't live like that, and I can't really understand how people even try. Every once in a while someone will say, "Stop doing things, just relax." I have a tendency to come back with the Erdos answer "There will be time to rest in the grave."

    I don't know. Maybe some peo


    You are what you think.
  • Let me start by saying that it is never easy!

    View each queue and make mental notes as to the following:

    1. How many people are in each queue?
    2. What are their ages?
      • Older people are slower*. As the body (and mind) get older, people slow down.
    3. What are their sexes?
      • Women are slower*. Why? Most women are more cost conscience and therefore watching the price as each item is rung up (and correcting the cashier when there are mistakes).
    4. Are they married or single?
      • Check for a ring**. Married people are
    • Check for a ring**. Married people are slower*. Why? Wives make sure that their husbands are more cost conscience. (See #3.)

      I'm usually cost conscience before getting to the checkout. After which I can't remember what the price of something is. If I think it should've been cheaper (and I think it's worthwhile), I'll go check the price myself after checkout, and if I'm right, I'll bring it to customer service where you get a FULL REFUND for the item(s) (that's the policy :-). My favorite was when several

  • That was a very amusing and interesting read. Your mind works a lot like mine, apparently. My solution is SIMD -- amortize the time spent in line by buying more food at once. I go grocery shopping as infrequently as I can bear and fill my cart as much as it can bear, or sometime two carts if the whole family comes along.

    Time of day matters too. At night, the ratio of customers to cashiers is much higher. Although the total number of customers is smaller so the shopping is easier, the longer time spent