Are segments so bad?

By: Jukka Larja (roskakori2006.delete@this.gmail.com),
Room: Moderated Discussions
Brendan (btrotter.delete@this.gmail.com) on January 21, 2020 5:04 pm wrote:
>
> Jukka Larja (roskakori2006.delete@this.gmail.com) on January 21, 2020 6:01 am wrote:
> > Brendan (btrotter.delete@this.gmail.com) on January 20, 2020 11:43 am wrote:
> > > Jukka Larja (roskakori2006.delete@this.gmail.com) on January 20, 2020 4:54 am wrote:
> > >
> > > > With oracle telling us that the end is near, these are practical approaches (not on consoles
> > > > in my opinion, but on general purpose system). Unfortunately we don't have oracle.
> > >
> > > Would you like me to write an oracle that "predicts" that a previous call to malloc()
> > > returned NULL, that a previous call to "mmap()" returned -1 (with errno set to ENOMEM),
> > > or that a previous attempt to create a new object resulted in "std::bad_alloc"?
> > >
> > > It seems to me that for all cases the oracle can be a macro that does literally nothing (or maybe
> > > just a line of white space inside a "try to allocate and free cache if you need to" wrapper).
> >
> > This is pointless. You are talking about some toy programs where freeing (some mysterious) cache can
> > be done at any point and no one will care.
>
> No, the same approach can/will work for anything that has any kind of cache, regardless of the complexity.
>
> > Any such memory in our game engine is such that it can't
> > be freed before the operation using it is done.
>
> If none of the memory can be freed because it's being used then your game engine has no cache/s.

What's the point of cache if no-one can touch it, except to free it?

> > That may be OK, if that operation itself faces OOM
> > and can abort, but that's unlikely. Much more likely the OOM will happen in some other thread. And
> > when you get one, you'll probably get several more soon. That's why the oracle is needed.
>
> You don't need an oracle to do this. E.g. you can inform other threads that they need
> to reduce the amount of memory they're currently using (and wait until the other threads
> inform you that they have); without any attempt to predict the future.

How?

> > And you are running your toy programs on some mysterious system that seems to be constantly running out
> > of memory. I mean, why else would you spend so much time trying to handle OOMs without crashing?
>
> I (try to) handle every possible problem that might happen, regardless of how likely/unlikely it is;

That's extremely stupid engineering. Seems like you have infinite programmer resources, but lacking hardware.

> Note: For previous work (operating systems) I don't even assume hardware works
> (e.g. I've probably spent 6 months just researching/prototyping "software/kernel
> based RAM fault detection and correction" for systems that don't have ECC).

You do understand how utterly irrelevant that is for current discussion, on so many levels?

> The software I'm currently working on is half "collaborate real-time editor" (see https://en.wikipedia.org/wiki/Collaborative_real-time_editor
> ). Basically; users log in to the server, select a project/s they want to work on, then edit the project/s
> (while many other users may also be editing the same project/s). If the server crashes all users get annoyed
> (then probably try to reconnect before server comes back online, then realize they have no idea how long server
> will be down for and probably take a coffee break); then (after the server comes back online) all users log
> back in and have to try to figure out how much of their work was lost from which file/s, then users have to
> redo the work that was lost. If you assume (as a crude estimate for design goal purposes) there will be 100
> users and the disruption costs each user an average of 20 minutes (e.g. auto-save every modified file every
> 5 minutes); then it'd add up to about 33 hours of lost productivity, and you might be able to say it'll costs
> about $1000 each time the server crashes (despite auto-saves).

Sounds like it would be much better to spend some money on more memory than implementing crazy OOM survival strategies.

-JLarja
< Previous Post in ThreadNext Post in Thread >
Thread (397 posts)
TopicPosted ByPosted
Nuances related to Spinlock implementation and the Linux SchedulerBeastian
  Nuances related to Spinlock implementation and the Linux SchedulerMontaray Jack
    Nuances related to Spinlock implementation and the Linux SchedulerMontaray Jack
  No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Beastian
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Malte Skarupke
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)dmcq
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)smeuletz
          Do not blame others for your unfinished jobsmeuletz
            Where did all the experts come from? Did Linus get linked? (NT)anon
              PhoronixGabriele Svelto
                PhoronixSalvatore De Dominicis
            Do not blame anyone. Please give polite, constructive criticismChester
              Do not blame anyone. Please give polite, constructive criticismsmeuletz
                Do not blame anyone. Please give polite, constructive criticismChester
                  Do not blame anyone. Please give polite, constructive criticismsmeuletz
                    Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                      Do not blame anyone. Please give polite, constructive criticismGionatan Danti
                        Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismGionatan Danti
                          Do not blame anyone. Please give polite, constructive criticismJohn Scott
                          Do not blame anyone. Please give polite, constructive criticismsupernovas
                            Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismGDan
                            OracleAnon3
                      Do not blame anyone. Please give polite, constructive criticismsmeuletz
                        Do not blame anyone. Please give polite, constructive criticismSimon Farnsworth
                        Do not blame anyone. Please give polite, constructive criticismEtienne
                          Do not blame anyone. Please give polite, constructive criticismsmeuletz
                            Do not blame anyone. Please give polite, constructive criticismMichael S
                      Not deprecating irrelevant API: sched_yield() on quantum computers?smeuletz
                      Do not blame anyone. Please give polite, constructive criticismmagicalgoat
                        Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismAnon3
                  Do not blame anyone. Please give polite, constructive criticismrwessel
                Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                  Do not blame anyone. Please give polite, constructive criticismGabriele Svelto
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Howard Chu
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)president ltd
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Emil Briggs
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
            No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
              FUTEX_LOCK_PI performanceJörn Engel
                FUTEX_LOCK_PI performanceLinus Torvalds
                  FUTEX_LOCK_PI performanceJörn Engel
                    FUTEX_LOCK_PI performanceRichardC
                      FUTEX_LOCK_PI performanceLinus Torvalds
                  FUTEX_LOCK_PI performanceGabriele Svelto
                    FUTEX_LOCK_PI performancexilun
                    FUTEX_LOCK_PI performanceKonrad Schwarz
                      FUTEX_LOCK_PI performanceGabriele Svelto
                      FUTEX_LOCK_PI performanceSimon Farnsworth
                      FUTEX_LOCK_PI performancerwessel
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstar
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Charles Ellis
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Richard
          It's hard to separateMichael S
            It's hard to separaterainstared
              It's hard to separateDavid Kanter
                It's hard to separateAnon
                  It's hard to separatenone
                    It's hard to separateAnon
                      It's hard to separatenone
                        It's hard to separategallier2
                          It's hard to separateAnon
                            It's hard to separateAdrian
                              It's hard to separategallier2
                                It's hard to separateAdrian
                            It's hard to separategallier2
                        It's hard to separateAdrian
                        It's hard to separateAnon
                          It's hard to separategallier2
                          It's hard to separateDavid Hess
                            It's hard to separateAdrian
                              It's hard to separateDavid Hess
                                It's hard to separateAnon
                                  It's hard to separateAdrian
                                    It's hard to separateBrett
                                      Zilog Z8000Brett
                                        Zilog Z8000David Hess
                                          Zilog Z8000Adrian
                                            Zilog Z8000David Hess
                                              Zilog Z8000Ricardo B
                                                Zilog Z8000Ronald Maas
                                                  Zilog Z8000Ricardo B
                                                    Zilog Z8000Anon
                                                      Zilog Z8000Jose
                                                        Zilog Z8000gallier2
                                                          Zilog Z8000Jose
                                                            Zilog Z8000rwessel
                                                              Zilog Z8000David Hess
                                                                Zilog Z8000Simon Farnsworth
                                                                  Zilog Z8000Michael S
                                                                    Zilog Z8000Simon Farnsworth
                                                                      Zilog Z8000David Hess
                                                                  Zilog Z8000David Hess
                                                                Zilog Z8000rwessel
                                                                  286 16 bit I/OTim McCaffrey
                                                                    286 16 bit I/ODavid Hess
                                                      Zilog Z8000Ricardo B
                                                        Zilog Z8000Anon
                                                          Zilog Z8000David Hess
                                                            Zilog Z8000rwessel
                                                              Zilog Z8000David Hess
                                                          Zilog Z8000someone
                                                            Zilog Z8000Anon
                                                          Zilog Z8000Ricardo B
                                                  Zilog Z8000Simon Farnsworth
                                                    Zilog Z8000Tim McCaffrey
                                                      Zilog Z8000Simon Farnsworth
                                                    Zilog Z8000Ricardo B
                                                      Zilog Z8000Anon
                                                        Zilog Z8000Ricardo B
                                                          Zilog Z8000Anon
                                                            Zilog Z8000Ricardo B
                                                              Zilog Z8000Anon
                                                                Zilog Z8000David Hess
                                                                Zilog Z8000Ricardo B
                                                                  Zilog Z8000Anon
                                                                    Zilog Z8000Ronald Maas
                                                                      Zilog Z8000Anon
                                                                    Zilog Z8000Ricardo B
                                                                      Zilog Z8000Anon
                                                                        Zilog Z8000Ricardo B
                                                                          Zilog Z8000gallier2
                                                                    Zilog Z8000David Hess
                                                            Zilog Z8000David Hess
                                                          Zilog Z8000gallier2
                                                      Zilog Z8000Simon Farnsworth
                                                        IBM PC successEtienne
                                                        Zilog Z8000Ricardo B
                                                          Zilog Z8000Brett
                                                            Zilog Z8000David Hess
                                                          Zilog Z8000David Hess
                                                    Zilog Z8000David Hess
                                            Zilog Z8000Maxwell
                                              Zilog Z8000David Hess
                                                Zilog Z8000Maxwell
                                                  Zilog Z8000Ricardo B
                                                    8086 does NOT have those addressing modesDevin
                                                      8086 does NOT have those addressing modesRicardo B
                                                        8086 does NOT have those addressing modesAnon
                                                          8086 does NOT have those addressing modesgallier2
                                                            8086 does NOT have those addressing modesAnon
                                                              8086 does NOT have those addressing modesRicardo B
                                                          8086 does NOT have those addressing modesMichael S
                                                            Zilog Z8000Ronald Maas
                                                              Zilog Z8000Anon
                                                          8086 does NOT have those addressing modesRicardo B
                                                            8086 does NOT have those addressing modesrwessel
                                                              8086 does NOT have those addressing modesDavid Hess
                                                                8086 does NOT have those addressing modesrwessel
                                                                  8086 does NOT have those addressing modesDavid Hess
                                                          8086 does NOT have those addressing modesDavid Hess
                                            Zilog Z8000rwessel
                                              Zilog Z8000Brett
                                                Zilog Z8000rwessel
                                                  Zilog Z8000Brett
                                                    Zilog Z8000rwessel
                                                      Zilog Z8000Brett
                                                    Zilog Z8000James
                                              Zilog Z8000Adrian
                                                PDP-11Michael S
                                                Zilog Z8000rwessel
                                              Zilog Z8000Ronald Maas
                                            Zilog Z8000Konrad Schwarz
                                              Zilog Z8000Adrian
                                                Zilog Z8000konrad.schwarz
                                                  Zilog Z8000Adrian
                                    It's hard to separateDavid Hess
                                  It's hard to separateDavid Hess
                                It's hard to separateAdrian
                                  It's hard to separateDavid Hess
                                It's hard to separategallier2
                                  It's hard to separatenone
                        It's hard to separaterwessel
                        It's hard to separateDavid Hess
                          It's hard to separaterwessel
                  It's hard to separateAdrian
                    It's hard to separaterwessel
                      It's hard to separateAdrian
                    It's hard to separateDavid Hess
                      It's hard to separatenone
                  Are segments so bad?Paul A. Clayton
                    Yes, they are terrible (NT)Anon
                    Are segments so bad?Adrian
                      Are segments so bad?Etienne
                        Are segments so bad?gallier2
                          Are segments so bad?Adrian
                            Are segments so bad?Adrian
                              Are segments so bad?Etienne
                        Are segments so bad?Adrian
                          Are segments so bad?gallier2
                      Are segments so bad?Anon3
                        Are segments so bad?Adrian
                          Are segments so bad?Brendan
                      Are segments so bad?Anon
                        Are segments so bad?Adrian
                          Are segments so bad?Jukka Larja
                            Are segments so bad?Brendan
                              Are segments so bad?Jukka Larja
                                Are segments so bad?Brendan
                                  Are segments so bad?Jukka Larja
                                  Are segments so bad?anon
                                    Are segments so bad?Brendan
                                      the world sucks worse than you're aware ofMichael S
                                        the world sucks worse than you're aware ofBrendan
                                        the world sucks worse than you're aware ofGabriele Svelto
                                      Are segments so bad?Jukka Larja
                                        Are segments so bad?Brendan
                                          Are segments so bad?Jukka Larja
                                            Are segments so bad?Brendan
                                              Are segments so bad?Anne O. Nymous
                                                Are segments so bad?Brendan
                                                  actor of around 200?Michael S
                                                  Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                    Not overcomitting leads to more OOMs, not lessBrendan
                                                      Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                        Not overcomitting leads to more OOMs, not lessAnon
                                                          Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                            Not overcomitting leads to more OOMs, not lessAnon
                                                              Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                                Not overcomitting leads to more OOMs, not lessAnon
                                                                  Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                        Not overcomitting leads to more OOMs, not lessMichael S
                                                          Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                            Not overcomitting leads to more OOMs, not lessMichael S
                                                              Not overcomitting leads to more OOMs, not lessJukka Larja
                                                        Not overcomitting leads to more OOMs, not lessJukka Larja
                                                          Thanks for the info (NT)Gabriele Svelto
                                                      Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                        OOM killer complainsAnon
                                                          OOM killer complainsanon
                                                        Not overcomitting leads to more OOMs, not lessBrendan
                                                          Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                            Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                              Not overcomitting leads to more OOMs, not lessDoug S
                                                                Not overcomitting leads to more OOMs, not lessDoug S
                                                Are segments so bad?rwessel
                                              Are segments so bad?Jukka Larja
                                                Are segments so bad?Brendan
                                                  Are segments so bad?Jukka Larja
                                                    Are segments so bad?Brendan
                                                      Are segments so bad?Brett
                                                      Are segments so bad?Jukka Larja
                                                  Are segments so bad?Gabriele Svelto
                                            Specifying cost of dropping pagesPaul A. Clayton
                                              Specifying cost of dropping pagesrwessel
                                                Specifying cost of dropping pagesGabriele Svelto
                                          Are segments so bad?anon
                                            Are segments so bad?Brendan
                                          Are segments so bad?Gabriele Svelto
                                            Are segments so bad?Brendan
                                              Are segments so bad?Gabriele Svelto
                                                Are segments so bad?Anon
                                                  Are segments so bad?Jukka Larja
                                                Are segments so bad?Etienne
                                                  Are segments so bad?Jukka Larja
                                                    Are segments so bad?Gabriele Svelto
                                                      Are segments so bad?Jukka Larja
                                                Are segments so bad?Brendan
                                                  Are segments so bad?Gabriele Svelto
                                                    Are segments so bad?Brendan
                                                      Are segments so bad?Jukka Larja
                                                        Are segments so bad?Brendan
                                                          Are segments so bad?Jukka Larja
                                                            Are segments so bad?Brendan
                                                              Are segments so bad?Jukka Larja
                                                                Are segments so bad?Brendan
                                                                  Are segments so bad?Brett
                                                                    Are segments so bad?Brett
                                                                  Are segments so bad?Gabriele Svelto
                                                                  Are segments so bad?Jukka Larja
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Jukka Larja
                                                                        Are segments so bad?Brendan
                                                                          Are segments so bad?Jukka Larja
                                                                            Are segments so bad?Brendan
                                                                              Are segments so bad?Jukka Larja
                                                      Are segments so bad?rwessel
                                                      Are segments so bad?Gabriele Svelto
                                                        Are segments so bad?Brendan
                                                          Are segments so bad?Gabriele Svelto
                                                            Are segments so bad?Anon
                                                              Are segments so bad?Gabriele Svelto
                                                            Are segments so bad?Brendan
                                                              Are segments so bad?Gabriele Svelto
                                                                Are segments so bad?Michael S
                                                                  Are segments so bad?Gabriele Svelto
                                                                    Are segments so bad?Jukka Larja
                                                                    Are segments so bad?Michael S
                                                                      Are segments so bad?Gabriele Svelto
                                                                Are segments so bad?Brendan
                                                                  Are segments so bad?Michael S
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Simon Farnsworth
                                                                        Are segments so bad?Anon
                                                                          Are segments so bad?Simon Farnsworth
                                                                      Are segments so bad?Michael S
                                                                  Are segments so bad?Gabriele Svelto
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Gabriele Svelto
                                                                        Are segments so bad?Brendan
                                                                          Are segments so bad?Jukka Larja
                                                                            Are segments so bad?Brendan
                                                                              Are segments so bad?Jukka Larja
                                                                                Are segments so bad?Brendan
                                                                                  Are segments so bad?Jukka Larja
                                                                                    Are segments so bad?Brendan
                                                                                      Are segments so bad?Jukka Larja
                                                                                        Are segments so bad?Brendan
                                                                                          Are segments so bad?Jukka Larja
                                                                                            Are segments so bad?Gabriele Svelto
                                                                                              Are segments so bad?Jukka Larja
                                                                                                DDS assets and MipMap chainsMontaray Jack
                                                                                      Are segments so bad?gallier2
                                                                                        Are segments so bad?Jukka Larja
                                                                                  Are segments so bad?Anne O. Nymous
                                                                            Are segments so bad?Anon
                                                                              Are segments so bad?Anne O. Nymous
                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Anne O. Nymous
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Etienne
                                                                              Are segments so bad?Gabriele Svelto
                                                                                Are segments so bad?Michael S
                                                                                Are segments so bad?Jukka Larja
                                                                                  Are segments so bad?Gabriele Svelto
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Jukka Larja
                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Gabriele Svelto
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Gabriele Svelto
                                                                                        Are segments so bad?Anon
                                                                                          Are segments so bad?Gabriele Svelto
                                                                                            Are segments so bad?Anon
                                                                                              Are segments so bad?Gabriele Svelto
                                                                                                Are segments so bad?Anon3
                                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Jukka Larja
                                                          Are segments so bad?Jukka Larja
                                Are segments so bad?Anne O. Nymous
                                  Are segments so bad?Jukka Larja
                            Are segments so bad?rwessel
                          Are segments so bad?Anne O. Nymous
                      Are segments so bad?Ricardo B
                        Are segments so bad?Adrian
                          Are segments so bad?Michael S
                            Are segments so bad?Adrian
                          Are segments so bad?Ricardo B
                            Are segments so bad?Anon3
                            Are segments so bad?Brendan
                      Are segments so bad?Paul A. Clayton
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstared
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Foo_
            No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)dmcq
            changes in contextCarlie Coats
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstar
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Montaray Jack
    Suggested reading for the authoranon
      Suggested reading for the authorab
        Looking at the other side (frequency scaling)Chester
          Looking at the other side (frequency scaling)Foo_
          Why spinlocks were usedFoo_
            Why spinlocks were usedJukka Larja
            Why spinlocks were usedSimon Cooke
            Why spinlocks were usedRizzo
          Looking at the other side (frequency scaling)ab
    Cross-platform codeGian-Carlo Pascutto
      Cross-platform codeMichael S
        Cross-platform codeGian-Carlo Pascutto
          Cross-platform codeMichael S
            Cross-platform codeNksingh
              Cross-platform codeMichael S
              SRW lock implementationMichael S
                SRW lock implementationNksingh
                  broken URL in Linux source codeMichael S
                    broken URL in Linux source codeTravis Downs
                      broken URL in Linux source codeMichael S
                        broken URL in Linux source codeTravis Downs
                  SRW lock implementation - url brokenMichael S
                    SRW lock implementation - url brokenTravis Downs
                      SRW lock implementation - url brokengpderetta
                        SRW lock implementation - url brokenTravis Downs
                      SRW lock implementation - url brokenLinus Torvalds
                        SRW lock implementation - url brokenTravis Downs
                          SRW lock implementation - url brokenLinus Torvalds
                    SRW lock implementation - url brokenKonrad Schwarz
                    SRW lock implementation - url brokennksingh
      Cross-platform codeLinus Torvalds