This question already has an answer here:
My question is something of a scheduling problem. I'd like to know what algorithm to use to find the top k items in a fixed length queue in which the values of the items change dynamically.basically a long running online top k selection
I imagine that operating systems do this all the time, but not being a systems guy, I don't know what terms to search for. Thanks in advance.