Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

Scheduled Pinned Locked Moved Uncategorized
49 Posts 23 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bob@feed.hella.cheapB bob@feed.hella.cheap

    @mcc didn't azul systems do a lot of that

    bob@feed.hella.cheapB This user is from outside of this forum
    bob@feed.hella.cheapB This user is from outside of this forum
    bob@feed.hella.cheap
    wrote last edited by
    #5

    @mcc their custom MMU is most famous for having hardware transactional memory but it was tightly integrated into the gc of their jvm

    1 Reply Last reply
    0
    • mcc@mastodon.socialM mcc@mastodon.social

      Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

      cwebber@social.coopC This user is from outside of this forum
      cwebber@social.coopC This user is from outside of this forum
      cwebber@social.coop
      wrote last edited by
      #6

      @mcc No I leave that kind of dreaming to @wingo

      1 Reply Last reply
      0
      • h0m54r@mastodon.socialH h0m54r@mastodon.social

        @mcc No, but I have had similar daydreams about what a compiler could do it it targeted CPU microcode rather than being limited to the x86 instruction set.

        mcc@mastodon.socialM This user is from outside of this forum
        mcc@mastodon.socialM This user is from outside of this forum
        mcc@mastodon.social
        wrote last edited by
        #7

        @h0m54r how do you feel about itanium

        h0m54r@mastodon.socialH 1 Reply Last reply
        0
        • mcc@mastodon.socialM mcc@mastodon.social

          Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

          gutmunchies@dragon.styleG This user is from outside of this forum
          gutmunchies@dragon.styleG This user is from outside of this forum
          gutmunchies@dragon.style
          wrote last edited by
          #8

          @mcc

          not as such but i am interested in hearing your thoughts

          1 Reply Last reply
          0
          • mcc@mastodon.socialM mcc@mastodon.social

            Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

            kasperd@westergaard.socialK This user is from outside of this forum
            kasperd@westergaard.socialK This user is from outside of this forum
            kasperd@westergaard.social
            wrote last edited by
            #9

            What sort of control beneficial to GC cannot be achieved using mmap?

            mcc@mastodon.socialM 1 Reply Last reply
            0
            • h0m54r@mastodon.socialH h0m54r@mastodon.social

              @mcc No, but I have had similar daydreams about what a compiler could do it it targeted CPU microcode rather than being limited to the x86 instruction set.

              kasperd@westergaard.socialK This user is from outside of this forum
              kasperd@westergaard.socialK This user is from outside of this forum
              kasperd@westergaard.social
              wrote last edited by
              #10

              That sounds a little bit like the idea behind RISC. Somehow it wasn't the huge success it was hyped up to.

              1 Reply Last reply
              0
              • mcc@mastodon.socialM mcc@mastodon.social

                Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

                canine3625@mastodon.socialC This user is from outside of this forum
                canine3625@mastodon.socialC This user is from outside of this forum
                canine3625@mastodon.social
                wrote last edited by
                #11

                @mcc years of "lemma theorem proof" computer science has left me comically unprepared to engage with this question

                1 Reply Last reply
                0
                • h0m54r@mastodon.socialH h0m54r@mastodon.social

                  @mcc No, but I have had similar daydreams about what a compiler could do it it targeted CPU microcode rather than being limited to the x86 instruction set.

                  tryst@fedi.imu.liT This user is from outside of this forum
                  tryst@fedi.imu.liT This user is from outside of this forum
                  tryst@fedi.imu.li
                  wrote last edited by
                  #12

                  @h0m54r@mastodon.social Sounds like you might enjoy the belt-oriented https://millcomputing.com/docs/ 🙂

                  @mcc@mastodon.social

                  1 Reply Last reply
                  0
                  • mcc@mastodon.socialM mcc@mastodon.social

                    @h0m54r how do you feel about itanium

                    h0m54r@mastodon.socialH This user is from outside of this forum
                    h0m54r@mastodon.socialH This user is from outside of this forum
                    h0m54r@mastodon.social
                    wrote last edited by
                    #13

                    @mcc I’m sad I never had the chance to use it… but I feel like you’d want to still have access to your complex instruction set for most things, just also be able to drop down a level for hyper optimising your really hot functions.

                    1 Reply Last reply
                    0
                    • kasperd@westergaard.socialK kasperd@westergaard.social

                      What sort of control beneficial to GC cannot be achieved using mmap?

                      mcc@mastodon.socialM This user is from outside of this forum
                      mcc@mastodon.socialM This user is from outside of this forum
                      mcc@mastodon.social
                      wrote last edited by
                      #14

                      @kasperd can modern mmaps result in virtual memory address blocks at a designated address? there's just lots of things you can do if you can rely on comparison between pointers or assuming your memory arena is contiguous.

                      I have not been awake long enough to get a cite but certain VMs are 32 bit instead of 64 bit, eating the 4GB memory limit, just so they can pull shenanigans along these lines with addressing modes

                      mcc@mastodon.socialM 1 Reply Last reply
                      0
                      • mcc@mastodon.socialM mcc@mastodon.social

                        @kasperd can modern mmaps result in virtual memory address blocks at a designated address? there's just lots of things you can do if you can rely on comparison between pointers or assuming your memory arena is contiguous.

                        I have not been awake long enough to get a cite but certain VMs are 32 bit instead of 64 bit, eating the 4GB memory limit, just so they can pull shenanigans along these lines with addressing modes

                        mcc@mastodon.socialM This user is from outside of this forum
                        mcc@mastodon.socialM This user is from outside of this forum
                        mcc@mastodon.social
                        wrote last edited by
                        #15

                        @kasperd Like mmmaaaybbbe I could find a mmap mode where I pre-mmap a 32GB buffer but it doesn't actually assign those pages until I stop using them? I guess? 😕

                        kasperd@westergaard.socialK 1 Reply Last reply
                        0
                        • mcc@mastodon.socialM mcc@mastodon.social

                          Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

                          glyph@mastodon.socialG This user is from outside of this forum
                          glyph@mastodon.socialG This user is from outside of this forum
                          glyph@mastodon.social
                          wrote last edited by
                          #16

                          @mcc does daydreaming of a world where garbage collection is the operating system’s job count

                          mcc@mastodon.socialM driusan@doomscroller.socialD 2 Replies Last reply
                          0
                          • mcc@mastodon.socialM mcc@mastodon.social

                            @kasperd Like mmmaaaybbbe I could find a mmap mode where I pre-mmap a 32GB buffer but it doesn't actually assign those pages until I stop using them? I guess? 😕

                            kasperd@westergaard.socialK This user is from outside of this forum
                            kasperd@westergaard.socialK This user is from outside of this forum
                            kasperd@westergaard.social
                            wrote last edited by
                            #17

                            You can use MAP_FIXED to get a range on a specific address. The address you specify that way does get rounded down to a multiple of the page size, but other than that it's used as is.

                            A zero value for address has a special meaning, so if you absolutely want to map at address 0 you need to ask for address 1 rounded down. Though some kernels won't permit that in the default configuration.

                            You can ask for more memory ahead of time. I am pretty sure the kernel only allocates the physical memory on the first write. However things get a little tricky with respect to over-commitment and such. As I understand it, the kernel will refuse the allocation if there is no way it could ever give you all of that memory. But I think the default is that when there is any doubt the kernel will let the allocation go through and kill the process later if it doesn't have memory after all. (I am not saying that's a good default.)

                            There is also the possibility of allocating a memory range with no permissions and then use mprotect to make parts of the range read and writable later. In that case it would make sense to me if the kernel only updates the count of committed memory once you make it writable, I don't know if that's actually what happens, but it should be easy to test.

                            I have used the approach of using mmap to allocate a range with no read or write permissions and then make a small range in the middle read-write with mprotect. My reason for using it has been to have guard pages around certain buffers as a security measure. It provides an extra layer of protection against buffer overflow vulnerabilities.

                            For some advanced use cases it can make sense to map a range with no privileges and later change the protection of the range from within a SIGSEGV handler when that address is accessed.

                            mcc@mastodon.socialM kasperd@westergaard.socialK knowprose@mastodon.socialK artemist@social.mildlyfunctional.gayA 4 Replies Last reply
                            0
                            • kasperd@westergaard.socialK kasperd@westergaard.social

                              You can use MAP_FIXED to get a range on a specific address. The address you specify that way does get rounded down to a multiple of the page size, but other than that it's used as is.

                              A zero value for address has a special meaning, so if you absolutely want to map at address 0 you need to ask for address 1 rounded down. Though some kernels won't permit that in the default configuration.

                              You can ask for more memory ahead of time. I am pretty sure the kernel only allocates the physical memory on the first write. However things get a little tricky with respect to over-commitment and such. As I understand it, the kernel will refuse the allocation if there is no way it could ever give you all of that memory. But I think the default is that when there is any doubt the kernel will let the allocation go through and kill the process later if it doesn't have memory after all. (I am not saying that's a good default.)

                              There is also the possibility of allocating a memory range with no permissions and then use mprotect to make parts of the range read and writable later. In that case it would make sense to me if the kernel only updates the count of committed memory once you make it writable, I don't know if that's actually what happens, but it should be easy to test.

                              I have used the approach of using mmap to allocate a range with no read or write permissions and then make a small range in the middle read-write with mprotect. My reason for using it has been to have guard pages around certain buffers as a security measure. It provides an extra layer of protection against buffer overflow vulnerabilities.

                              For some advanced use cases it can make sense to map a range with no privileges and later change the protection of the range from within a SIGSEGV handler when that address is accessed.

                              mcc@mastodon.socialM This user is from outside of this forum
                              mcc@mastodon.socialM This user is from outside of this forum
                              mcc@mastodon.social
                              wrote last edited by
                              #18

                              @kasperd Thank you, this is not something I have read up on and is a great basis for future research. Here's an important question: Do *both* Linux mmap and the Windows equivalents offer these capabilities? Because my use cases invariably need to target both 😞

                              knowprose@mastodon.socialK aeva@mastodon.gamedev.placeA kasperd@westergaard.socialK 3 Replies Last reply
                              0
                              • glyph@mastodon.socialG glyph@mastodon.social

                                @mcc does daydreaming of a world where garbage collection is the operating system’s job count

                                mcc@mastodon.socialM This user is from outside of this forum
                                mcc@mastodon.socialM This user is from outside of this forum
                                mcc@mastodon.social
                                wrote last edited by
                                #19

                                @glyph Yes

                                mcc@mastodon.socialM 1 Reply Last reply
                                0
                                • mcc@mastodon.socialM mcc@mastodon.social

                                  @glyph Yes

                                  mcc@mastodon.socialM This user is from outside of this forum
                                  mcc@mastodon.socialM This user is from outside of this forum
                                  mcc@mastodon.social
                                  wrote last edited by
                                  #20

                                  @glyph One thing I wonder is if we'd even need protected memory in that world. Per se. Or if we could throw out process protected memory and use the protected memory capabilities of the CPU for something entirely other

                                  glyph@mastodon.socialG 1 Reply Last reply
                                  0
                                  • kasperd@westergaard.socialK kasperd@westergaard.social

                                    You can use MAP_FIXED to get a range on a specific address. The address you specify that way does get rounded down to a multiple of the page size, but other than that it's used as is.

                                    A zero value for address has a special meaning, so if you absolutely want to map at address 0 you need to ask for address 1 rounded down. Though some kernels won't permit that in the default configuration.

                                    You can ask for more memory ahead of time. I am pretty sure the kernel only allocates the physical memory on the first write. However things get a little tricky with respect to over-commitment and such. As I understand it, the kernel will refuse the allocation if there is no way it could ever give you all of that memory. But I think the default is that when there is any doubt the kernel will let the allocation go through and kill the process later if it doesn't have memory after all. (I am not saying that's a good default.)

                                    There is also the possibility of allocating a memory range with no permissions and then use mprotect to make parts of the range read and writable later. In that case it would make sense to me if the kernel only updates the count of committed memory once you make it writable, I don't know if that's actually what happens, but it should be easy to test.

                                    I have used the approach of using mmap to allocate a range with no read or write permissions and then make a small range in the middle read-write with mprotect. My reason for using it has been to have guard pages around certain buffers as a security measure. It provides an extra layer of protection against buffer overflow vulnerabilities.

                                    For some advanced use cases it can make sense to map a range with no privileges and later change the protection of the range from within a SIGSEGV handler when that address is accessed.

                                    kasperd@westergaard.socialK This user is from outside of this forum
                                    kasperd@westergaard.socialK This user is from outside of this forum
                                    kasperd@westergaard.social
                                    wrote last edited by
                                    #21

                                    If you want to see truly absurd usage of some of the possibilities, there is this video on how one guy managed to achieve 17 592 722 915 310 recursive calls on the stack.

                                    - YouTube

                                    Auf YouTube findest du die angesagtesten Videos und Tracks. Außerdem kannst du eigene Inhalte hochladen und mit Freunden oder gleich der ganzen Welt teilen.

                                    favicon

                                    (www.youtube.com)

                                    1 Reply Last reply
                                    0
                                    • glyph@mastodon.socialG glyph@mastodon.social

                                      @mcc does daydreaming of a world where garbage collection is the operating system’s job count

                                      driusan@doomscroller.socialD This user is from outside of this forum
                                      driusan@doomscroller.socialD This user is from outside of this forum
                                      driusan@doomscroller.social
                                      wrote last edited by
                                      #22
                                      @glyph@mastodon.social @mcc@mastodon.social That's just called shell scripting.
                                      mcc@mastodon.socialM 1 Reply Last reply
                                      0
                                      • mcc@mastodon.socialM mcc@mastodon.social

                                        Do you ever daydream about the incredibly wild optimizations a garbage collector could do if it had the direct control over virtual memory layout an operating system does

                                        joe@f.duriansoftware.comJ This user is from outside of this forum
                                        joe@f.duriansoftware.comJ This user is from outside of this forum
                                        joe@f.duriansoftware.com
                                        wrote last edited by
                                        #23

                                        @mcc i recently saw this, which i thought was a clever use of only userspace-level control over virtual memory layout https://github.com/plasma-umass/Mesh

                                        dysfun@social.treehouse.systemsD 1 Reply Last reply
                                        0
                                        • driusan@doomscroller.socialD driusan@doomscroller.social
                                          @glyph@mastodon.social @mcc@mastodon.social That's just called shell scripting.
                                          mcc@mastodon.socialM This user is from outside of this forum
                                          mcc@mastodon.socialM This user is from outside of this forum
                                          mcc@mastodon.social
                                          wrote last edited by
                                          #24

                                          @driusan @glyph what if shell scripting were good

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups