In what king of application, in which we insert or delete objects, we always delete the oldest one (the least recently stored, more precisely which was the first object stored) ?


closed as unclear what you're asking by David Richerby, cody, Ran G., Rick Decker, vonbrand Aug 8 '15 at 19:01

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ What research have you done? Where did you look? Can you be more specific about what you consider an application, since you used the databases tag only. One obvious example is the LRU (for Least recently used) page replacement algorithm. This is also used in cache systems in general, and specifically for databases. $\endgroup$ – babou Aug 8 '15 at 15:06
  • $\begingroup$ In any application that uses a queue. $\endgroup$ – babou Aug 8 '15 at 15:11

There are plenty such applications. To give some examples:

  • (windowed) data streams: Assume a sensor that sends new data every second. You want to know the average of the last minute. You keep the latest 60 elements. Every time you get a new element, the 61-st old element belongs to the previous minute, and you then delete it.

  • queue: when each elements is a task, and you service them in a FIFO manner, then each time you service a task you delete it. The FIFO ordering guarantees you always deletes the oldest task.

  • staleness: when space is limited (e.g., in cache memory), when you wish to remove old items in order to make room for a new one, a good heuristic is to remove the oldest accessed element, as it got "stale" and has low probability to be accessed again.

I'm sure there are plenty other examples, but your question is too general to answer. Feel free to edit it if you wish a more specific answer.

  • $\begingroup$ Thanks for your answer. Your first example is OK for me. I'm looking for an application in which we delete the oldest object stored. $\endgroup$ – user7060 Aug 9 '15 at 18:38

You do not define what you mean by oldest. In a cache system, the oldest object may be the one that was first to be introduced in the cache, or the the least recently updated, or the least recently used. This is a fair interpretation since an item that is used is to be loaded when used, if not already in.

So a possible answer would be a cache operating under the LRU strategy, for "Least recently used". It may be a virtual memory cache, or a web cache for example.

Obvious answers are all systems using a FIFO memory, i.e. a queue.

An other example could be a running average on some function, for example when you control the noise bandwidth by averaging the $n$ last measurements, according to some formula.

Another possible example, though probably not best, is a backup systems where you keep only the most recent version.

  • $\begingroup$ Thanks. This is your first example " the oldest object may be the one that was first to be introduced in the cache" which interests me ! $\endgroup$ – user7060 Aug 9 '15 at 18:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.