Announcement

Collapse
No announcement yet.

Why must we wait until it's completely broken before it gets fixed?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Quoth Ben_Who View Post
    The elevators in this building used to be...programmed kind of weird. They seemed to assume that only one person would use the elevator at any given time, treating each command as an entirely separate job.
    It sounds to me as though they were using a stack algorithm rather than the traditional "elevator" algorithm. In other words, it would do whatever it had been told most recently, and then finish off things it had been told earlier. Extremely inefficient.

    The standard elevator algorithm is very simple - it only needs to track the current position of the car, which buttons are currently activated (inside and outside), and a flag which says whether it's currently going up or down. So it will go up, stopping at every floor with the internal button or the external "up" button lit, until it runs out of requests in that direction. Then it will look for the topmost "down" request and service that, continuing down from there until it runs out again. It's so simple that for many years, the elevator controller was the jargon shorthand for an extremely small and limited computing environment.

    There are variations on this theme, some handling multiple shafts efficiently (so two cars don't try to service the same external call at the same time), some which service only "up" or only "down" requests at particular times of day, etc. There are also variants for use on hard disks instead of actual elevators, which allow resetting the direction flag periodically so that processes don't starve each other of data. And then there's the one which disables the buttons entirely on the Jewish Sabbath.

    There are a few new designs which put the numbered floor buttons on the outside, rather than merely allowing you to select a direction. It then directs you to a particular shaft which will service that floor. This allows the system to optimise traffic much better, by having each car stop at fewer floors on the way to the furthest one. This of course works best with several long shafts, so I haven't seen any over here where the buildings are not very tall.
    Last edited by Chromatix; 01-09-2013, 07:46 PM.

    Comment

    Working...
    X