Windows API Memory Mapped Files Explained

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • In this video I will demonstrate how memory mapped files can be used to share memory between processes by making a simple local chat example
    Code:
    github.com/nir...

КОМЕНТАРІ • 30

  • @theoriginalneckbeard
    @theoriginalneckbeard 6 місяців тому +10

    Hey, Nir.
    I wanted to thank you, simply because you're my favorite programming related channel right now and make me having hope in serious, high quality and non click-bait-y content on UA-cam again.
    Its informational and educational, quality over quantity and I appreciate exactly this in these days and times, where most channels point their focus on generating the most possible traffic through being striking and superficial.

    • @nirlichtman
      @nirlichtman  6 місяців тому +1

      Thanks, I appreciate this :)

  • @minnoxzmozzesmx8915
    @minnoxzmozzesmx8915 6 місяців тому +2

    I've known mmap for a long time, but not understand the practical use of it. Thanks for the tutorial.

    • @itsdrdy5551
      @itsdrdy5551 6 місяців тому +1

      mmap in windows is VirtualAlloc, not a mapped file

  • @jorgerias262
    @jorgerias262 6 місяців тому

    Thanks, currently learning this in my OS class, but it's super insightful and useful to see someone program it.

  • @harunsarpnar3428
    @harunsarpnar3428 6 місяців тому +3

    high quality content congrats👏👏

  • @oracleoftroy
    @oracleoftroy 6 місяців тому +3

    This seems like it has some pretty serious race conditions. Without knowing exactly what the guarantees for the shared condition variable are in windows off the top of my head, I think you would want to not autoreset so that the file won't be written to while you are reading it, and only reset once the read is finished. And you probably want to make sure it is false before the server writes new data,.. assuming we want every write to be followed by a read. (Something else would need to be done otherwise.)
    Still, pretty neat seeing how easy it is to set this up. I haven't needed something quite like this before and didnt realize that it doesn't take much code ro get it working.

  • @ISAK.M
    @ISAK.M 5 місяців тому

    This was so well explained thank u man

  • @rian0xFFF
    @rian0xFFF 6 місяців тому +22

    Next video: Making a simple GPT-4 AI in C on Windows

    • @nirlichtman
      @nirlichtman  6 місяців тому +18

      😂 "Minimalist" AI

    • @holiamusic
      @holiamusic 6 місяців тому +1

      xD@@nirlichtman

    • @ngokhanh7291
      @ngokhanh7291 6 місяців тому +3

      AI that predicts the age based on an input age

  • @3bdo3id
    @3bdo3id 5 місяців тому

    Great work, I loved it

  • @Pipe0481
    @Pipe0481 6 місяців тому +2

    I'd love to see the Linux equivalent of this

    • @ryonagana
      @ryonagana 6 місяців тому

      on linux. pipe/socket is the only way

    • @dimi144
      @dimi144 6 місяців тому +1

      mmap has an fd parameter that lets you map a file into memory

  • @angelffg
    @angelffg 6 місяців тому

    Excellent video!
    Nir, does this apply to applications between 2 or more computers on an internal network or does it only work for communication between programs on the same computer?
    Thanks for supporting!

    • @nirlichtman
      @nirlichtman  6 місяців тому +3

      Thanks! It only works for communication between programs on the same computer, I mostly used this example to demonstrate basic usage of memory mapped files

    • @angelffg
      @angelffg 6 місяців тому

      @@nirlichtman Thanks Nir, excellent content!

  • @maartenofbelgium
    @maartenofbelgium 6 місяців тому

    Love the simplicity!

  • @thisisnotok2100
    @thisisnotok2100 6 місяців тому

    Very cool. I've had an interest in how vpn clients "hijack" traffic to encrypt and reroute it to the the VPN server. Could you do a simple demonstration of an application that does something like this?

    • @nirlichtman
      @nirlichtman  6 місяців тому +1

      Thanks! Could you give an example about this? I am pretty sure the VPN clients just work by changing the network settings on the computer and set up the traffic to go through the VPN server

  • @justinnamilee
    @justinnamilee 6 місяців тому

    NIce.

  • @GooogleGoglee
    @GooogleGoglee 6 місяців тому

    Very high quality, I think I have got lost 😅
    Why not using 'nc' ?

    • @nirlichtman
      @nirlichtman  6 місяців тому +1

      The idea is to demonstrate how to work with shared memory on Windows

    • @GooogleGoglee
      @GooogleGoglee 6 місяців тому

      @@nirlichtman it was very neat 👍🏻

  • @EnLopXf
    @EnLopXf 6 місяців тому

    Please make another tutorials about WinAPI

    • @nirlichtman
      @nirlichtman  6 місяців тому +1

      More Win32 vids are planned :)

  • @kheirou1990
    @kheirou1990 6 місяців тому

    More assembly please

    • @nirlichtman
      @nirlichtman  6 місяців тому +1

      More Assembly planned :)