I’ve been using queues and queueing theory for over 50 years now, but I’ve recently realized something new.
At Nottingham they taught us queueing theory, about how a server (eg at a shop counter) handles randomly timed requests for service – which turned out to be very relevant when considering online system handling high demands on heavily loaded servers.
Later when designing systems I found there are two sorts of queue.
Type 1 is the First In – First Out Stack (FIFO). This is what you typically get in a shop waiting to be served. Each new person joins the end of the line, and gets served when it is their turn, and it works in exactly the same way in a computer system. If the system gets overloaded then someone has a long wait.
Type 2 is the Last In – First Out Stack (LIFO). This is what you get for example in a canteen or a chinese buffet, when a pile of plates is put on a spring loaded shelf so that only the top one or two can be seen. Add another to the stack, and the whole thing goes down a little bit, take it off again and the stack rises to display the next plate. This is how computers typically handle interruptions, and so do we. I’m quietly writing a story on my PC when one person rings with a website problem. So I leave my story and start to sort it out. Halfway through the door bell rings, so I break off to answer that, then go back to the website, and so on. If the system gets overloaded, then basically the bottom task never gets done.
What I’ve learned in hospital is that there’s a another sort of queue:
Type is the Nurses’s Stack (NS). This is like the LIFO stack, but with one difference. You are the patient and you need something (a bedpan perhaps). So you ask a passing nurse. She says yes, and goes to get one. Halfway there she gets called by another patient, with another request (jug of water), so she stacks your request for a bedpan and goes to get a jug. On the way Sister asks her to do some other urgent task, and this is where the Nurses Stack begins show. She is after all a human being, and she simply cannot stack more than a certain number of interrupts. If the interrupt level gets beyond a certain number, then the bottom (the oldest) requests just get lost – she forgets them.
This is becoming more obvious with the increasing demands on the NHS, and it became clear to me during my last stay that any patient making a request of a nurse should make a note of the time the request was made, then if the request is not responded to within say 30 minutes, you must time it out and ask again. It is important not to set the timeout too low, or you will be perceived as a pushy nagging nuisance, but do it right, and nobody is offended, and you get your bedpan. What could be nicer.
Except of course when you really can’t wait 30 minutes – but that’s another problem.