I wasn't sure which forum was most appropriate for this. It seems a little too specific (and possibly too technical?) for general discussion, and it isn't necessarily limited to one mode or the other. Since Future of the Fortress is reserved for current development, it's technically a suggestion?
It's also kind of rambly and perhaps not as focused as a proper question should be, so just fair warning there.
So I'm relatively aware of what people seem to want, or complain about, in terms of wanting their dwarves to prioritize jobs more efficiently. Most of this seems to be hard-coded at the moment. I recall a Dwarf Fortress Talk where Toady spelled out a basic hierarchy of dwarven needs... Avoid Danger > Find Child > Drink > Eat > Sleep > Job, or something like that.
Now, I'm not sure exactly how the jobs are broken down here. This seems to be under the purview of the Job Priorities thread on the Eternal Suggestions board. I can assume the jobs have a hardcoded priority, with Rescue Wounded somewhere near the top, Produce Item somewhere in the middle, and Haul Item somewhere near the bottom.
What I want to know is, how do dwarves keep track of their jobs? Do they store them in a stack? Or can they only remember one thing at a time, like a goldfish? When a dwarf gets interrupted, say, by a monster, or by a desire for booze, when that interruption is resolved, does the original task come back, or do they have to receive a "new" request to do that job?
I suspect that they really can only remember one thing at a time, and my evidence is largely anecdotal and based on casual observation. Most of the time, it doesn't factor in, as the job is constantly pinging for a dwarf to do it (like a designation) and they will get re-pinged when it is time, or else some other dwarf takes care of it in the interim. Also, because of notification spam.
I just wonder what it would be like if every dwarf kept a priority-sorted queue of tasks. With this, it would be nice if "distance to the task" was factored in to the priority calculation, and if the priorities were recalculated every-so-often. And time-sensitive tasks could slowly increment in priority, leading to much more natural decision-making.
I'm thinking of a situation where a dwarf is tasked with constructing a wall. Maybe there are some blocks at the construction site, but some are still down by the mason's workshops deep in the earth. How it works currently, the dwarf is as likely as anything to pick a very inconvenient time to decide s/he wants to get something to drink. S/he will stop what s/he is doing, walk all the way to the food storage area, drink some booze, and walk all the way back. All because this need to drink crossed some arbitrary threshold, making it the most important thing in the dwarf's world.
What if that "drink" job was always in the dwarf's head, so long as they weren't completely quenched, but it had such a low priority that they just usually never thought about it? They would slowly get thirstier and thirstier, and eventually it would be an overwhelming compulsion, yes, but what if, at some point when they were just moderately thirsty, they could compare the distance to their current job and the distance to the booze, and decide that now would be a convenient time to step over and have a drink? You could potentially see a dwarf, on the way to the job site, step over and grab a quick drink before continuing the journey, instead of waiting until they were totally dying of thirst and downing a whole gallon at once.
Maybe something like this is already in place, but if not, it seems to me to be the way to do it. Dwarves would make decisions based on convenience, like real people do, rather than jerked along by the chain of global job priorities, distance be damned.
tl;dr: ITT: why are dwarves doing things?