CS 134 OS-7: Memory-Mapped Files

Sdílet
Vložit
  • čas přidán 7. 09. 2020
  • Day # of Harvey Mudd College Operating Systems class

Komentáře • 21

  • @decomodus
    @decomodus Před 3 lety +5

    This is the best explanation I've seen so far. Straight to the point
    NICE

  • @oleholgerson3416
    @oleholgerson3416 Před 2 lety

    thank you so much for your videos!

  • @miladin4023
    @miladin4023 Před 3 lety

    Neil thank you so much for this!

  • @rosarioscavo6791
    @rosarioscavo6791 Před 3 lety

    Great explanation!

  • @zeeshanparvez5235
    @zeeshanparvez5235 Před rokem

    Amazing explanation

  • @mikgol81
    @mikgol81 Před 2 lety +4

    You're like the Clint Eastwood of programmers

  • @federicopueblalarregle5791
    @federicopueblalarregle5791 Před 9 měsíci

    I understand that you can optionally `msync` your write if you want to ensure it's written back to disk, but as you mentioned otherwise is up to the kernel to decide when to write it back to disk. For this same reason, I understand that database engines try to avoid `mmap` since it could result in dirty writes or write before a transaction completes (if the kernel decides to write back to disk).
    Do you know what alternatives do they have to map files to memory without having to worry on the kernel writing them back to disk when the engine doesn't want to yet?
    Thanks in advance.

  • @MrXperx
    @MrXperx Před 3 lety

    very nice professor

  • @JulienBertozzi
    @JulienBertozzi Před 3 lety

    Thanks !

  • @tsunghan_yu
    @tsunghan_yu Před 2 lety

    Does mmap increase a process' address space? If not, which segment is it stored in the memory?

    • @NeilRhodesHMC
      @NeilRhodesHMC  Před 2 lety +1

      There's a flat address space and mmap must map somewhere within that address space. Before the mapping, trying to access memory at that address will cause a page fault (assuming it's unmapped). Afterwards, access will succeed.

  • @AugerHybrid
    @AugerHybrid Před 3 lety +1

    Thanks for helping me on my programming course! Did you really write that all on glass and mirrored the video?

    • @NeilRhodesHMC
      @NeilRhodesHMC  Před 3 lety +8

      Yes. See czcams.com/video/S-rDH4O5CsI/video.html for a "Making of" video that shows the process in detail.

    • @lucassivolella
      @lucassivolella Před 2 lety +1

      @@NeilRhodesHMC Loved this video format!

  • @sword013
    @sword013 Před 3 lety +3

    Sir how is this faster than directly writing onto the file on disk ? Here you page it in, then write on physical memory and then it eventually has to write back in disk, so how is this faster ?
    Sorry if this is a dumb question and I understand the queuing part but, in both cases, you need to move the disk read/write heads which is going to take up time. So ain't this more indirect and should take more time ?

    • @NeilRhodesHMC
      @NeilRhodesHMC  Před 3 lety +2

      The only speed increase is due to the fact that changes to the file don't require a system call. However, you're right that the pages need to be both read in and written out whether or not the file is memory-mapped.
      It provides a different interface for the application that may be more convenient. It can sometimes reduce the amount of copying that's done as well.

    • @maboesanman
      @maboesanman Před 2 lety

      There are other benefits, like for example if you mount the file to the same address space every time, you can store self referential pointers directly in a file, and they’ll stay valid on subsequent loads of the file

  • @nexa7606
    @nexa7606 Před rokem

    5head

  • @dingxu4557
    @dingxu4557 Před 2 lety +1

    If only there were Chinese subtitles

  • @esmanlitebriz
    @esmanlitebriz Před 3 lety +2

    hey uncle where does your voice coming from?I cant hear anything..pfff.lol