But, what is Virtual Memory?

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ค. 2024
  • 🎬 Introduction to Virtual Memory 🎬
    Let's dive into the world of virtual memory, which is a common memory management technique used in computer's operating system. It sits at the boundary of software and hardware, and it's the main reason why we can play video games and listen to the music at the same time without worrying about spotify crashing our Diablo 4.
    🔑 Key Topics discussed in the video
    📌 Understand the problems
    📌 Understand the core principles behind virtual memory and how it solves these problems
    📌 Understand how virtual memory is implemented
    📌 Discuss various optimization techniques
    🚀 If you found this video helpful, don't forget to like, share, and subscribe for more tech tutorials!
    🔗 If you enjoy this video, please like, share, and subscribe for more enlightening tutorials.
    📖 The Linux Programming Interface: Must read book about Linux kernel (affiliate link): www.amazon.com/Linux-Programm...
    🌐 SiteGround: the hosting solution I like (affiliate link): www.siteground.com/index.htm?...
    🔗 Connect with me:
    Support me on patreon: / techwithnikola
    LinkedIn: / nikola-stojiljkovic-67...
    Join my discord: / discord
    Visit my blog: techwithnikola.com
    Follow me on Instagram: / techwithnikola
    Follow me on Twitter: / techwithnikola
    Timecodes
    00:00 - Intro
    00:19 - Problem: Not Enough Memory
    01:17 - Problem: Memory Fragmentation
    02:20 - Problem: Security
    03:10 - Key Problem
    04:42 - Solution: Not Enough Memory
    05:58 - Solution: Memory Fragmentation
    06:32 - Solution: Security
    07:30 - Virtual Memory Implementation
    09:49 - Page Table
    10:40 - Example: Address Translation
    11:54 - Page Faults
    13:28 - Recap
    14:18 - Translation Lookaside Buffer (TLB)
    15:46 - Example: Address Translation with TLB
    16:57 - Multi-Level Page Tables
    18:48 - Example: Address Translation with Multi-Level Page Tables
    19:58 - Outro
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 221

  • @therelatableladka
    @therelatableladka 2 หลายเดือนก่อน +148

    Hey if you are seeing this, let me tell you, this is the best video in TH-cam if you want to understand the concept of virtual memory, and others in simple and sweet. Perfect! ❤

    • @TechWithNikola
      @TechWithNikola  2 หลายเดือนก่อน +2

      Thank you! :)

    • @siegfriedbarfuss9379
      @siegfriedbarfuss9379 หลายเดือนก่อน +1

      Not really. He forget that OS claims RAM too

    • @Chemest_a
      @Chemest_a 25 วันที่ผ่านมา

      @@siegfriedbarfuss9379 3:54

    • @Hyp3r8Sniper
      @Hyp3r8Sniper 22 วันที่ผ่านมา +8

      ​​​​@@siegfriedbarfuss9379 Why is that relevant to this demonstration? You could just generalise an OS as another program? It's also shown at 3:58...

  • @BigBoiTurboslav
    @BigBoiTurboslav หลายเดือนก่อน +146

    Holy crap. TH-cam algorithm finally came through. This is some amazing content.

  • @viking420
    @viking420 หลายเดือนก่อน +24

    Fantastic video. I'm taking a OS course at university and we have a virtual memory assignment. The hand out documents left me feeling confused and a bit lost, but then this 20-minute video made all concepts clear as day. Thank you for putting effort into making these videoes, you earned a new subscriber!

    • @TechWithNikola
      @TechWithNikola  หลายเดือนก่อน +1

      I’m glad it was helpful. You’re welcome, and thank you for taking the time to comment.

  • @jansustar4565
    @jansustar4565 7 หลายเดือนก่อน +37

    Thank you for the video. The explanation was clear, structured and concise, better than most other explanations on youtube.

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +3

      Thanks a lot for the kind words and for taking the time to leave the comment. I'm so happy to hear that you've liked the video!

  • @diegorodriguezv
    @diegorodriguezv 22 วันที่ผ่านมา +8

    This is amazing! More detail than most Operating System courses in 20 minutes. Awestruck!

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thanks. Glad you think so! I’ll try to make more videos on similar topics in the future.

  • @69k_gold
    @69k_gold หลายเดือนก่อน +52

    There's a quite good reason 4 KB is used as a standard page size. In most disk partitioning software the minimum data you can read/write to is 4KB, so it can move it in one swoop

    • @ethos8863
      @ethos8863 29 วันที่ผ่านมา +5

      yeah i figured this was the reason and was wondering why he didn't say so

    • @TechWithNikola
      @TechWithNikola  28 วันที่ผ่านมา +9

      Thanks. I didn’t know that. Do you have any material or references that provide motivation for 4KB page size? I read some articles that suggest it was chosen empirically long time ago, but I’d like to learn more about it.

    • @mc-not_escher
      @mc-not_escher 23 วันที่ผ่านมา

      This is simply untrue if you grew up during the 80’s or 90’s (or, shoot, even later). Research something called a “filesystem”. Also while you’re at it, check out an article on “Solid State Drives” or “Flash Memory” or “NVRAM” if you’re wondering why 4K is the block size. 😂😂😂

    • @rodrigodoh
      @rodrigodoh 22 วันที่ผ่านมา +6

      @@TechWithNikola They probably choose it because 0x1000 is pretty nice to type. ARM macs use 16kb pages I think.

    • @yaroslavpanych2067
      @yaroslavpanych2067 14 ชั่วโมงที่ผ่านมา

      It has nothing to do with disc sector/cluster size, like at all.
      And yeah, 64 bit osses use 32k pages.

  • @TendresseExige
    @TendresseExige 23 วันที่ผ่านมา +7

    This might be the best content I have found on TH-cam this year. You explained these concepts in ways my teachers couldn’t, and you did it for free too ! You have my respect , and subscription haha !

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา +1

      I’m so glad that you like my content. It means a lot to me when people leave comments and subscribe, so thank you.

  • @clodomirvianna6350
    @clodomirvianna6350 8 วันที่ผ่านมา +1

    Thank you for this amazing video! It's truly refreshing to encounter such well-scripted and nicely illustrated content. It makes really enjoyable trying to learn such complex concepts.

  • @jameslai322
    @jameslai322 14 วันที่ผ่านมา

    Excellent description on how cpu/memory/os are working together! Well done!

  • @danielabildgaard6137
    @danielabildgaard6137 4 วันที่ผ่านมา

    Wow, I was really surprised! I was just relaxing on TH-cam to fall asleep and came across your video. I thought it might be trash, but it turned out to be very good with excellent detail and explanation. Great job!
    Best video on youtube so fare 🎉🎉🎉

  • @dusanstojancevic-creativel5309
    @dusanstojancevic-creativel5309 7 หลายเดือนก่อน +26

    Amazing explanation, always wanted to know core knowledge. Thanks, keep up with these videos!

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +1

      Thank you Dusan. I'm glad you've enjoyed it :)

  • @adnaneachahbar287
    @adnaneachahbar287 18 วันที่ผ่านมา +4

    I had a course back when i was in engineering school, the professor did a horrible job explaining memory and virtual memory, I ended up hating the class and i never really understood how it worked. until this day when I watched your video, you did an excellent job, I wish youtube had something like this before. Fast forward today, I work as a sysadmin/infra engineer and i really didn't have an idea how virtual memory works, again until I watched your video, thank you for the effort you put here, I am sure many will watch it and gain valuable informations.

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thank you for the comment. I’m glad you’ve found it useful!

  • @harshilldaggupati
    @harshilldaggupati 2 หลายเดือนก่อน +1

    That's a very good, high quality production with a top notch explanation! Keep making more.

  • @jamaluddin9158
    @jamaluddin9158 7 หลายเดือนก่อน +7

    Wow! Clear, concise and very neat animations! Subscribing to a channel after a long time!

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน

      Thank you for the sub!

  • @threshhold8278
    @threshhold8278 17 วันที่ผ่านมา

    This video is really good, the way that you simplified Virtual Memory is amazing!

  • @tylercoombs1
    @tylercoombs1 23 วันที่ผ่านมา

    Dude, you're videos are so helpful, thanks so much!!!

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา +1

      Glad you like them! Thanks for taking the time to comment.

  • @yash-xx2pu
    @yash-xx2pu 2 หลายเดือนก่อน +3

    the graphics really helped me visualize how this works! youre a lifesaver ^^

    • @TechWithNikola
      @TechWithNikola  หลายเดือนก่อน +2

      I'm glad! Graphics are a great tool for explain IMO :-)

    • @godnyx117
      @godnyx117 19 วันที่ผ่านมา

      ​@@TechWithNikola It's not just your opinion. It's a FACT! Graphics for complicated ideas are a must!
      And thank you, your video was amazing!

  • @chopper3lw
    @chopper3lw 29 วันที่ผ่านมา

    What an excellent overview. Nice job. It clarified a few things i was unclear about.

    • @TechWithNikola
      @TechWithNikola  29 วันที่ผ่านมา

      Thanks a lot. Glad it clarified things :-)

  • @ThePsychoMessiah
    @ThePsychoMessiah 14 วันที่ผ่านมา +11

    "Programs used to crash in the 1950s or so"? Calm down, it hasn't been that long since Windows XP would ask you to "send an error report".

  •  7 หลายเดือนก่อน +8

    An excellent, succint and illustrative explanation :)

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +1

      Thanks a lot Andrej!

  • @amj864
    @amj864 6 หลายเดือนก่อน +3

    This is awesome, made things so clear to me. Thank you.

    • @TechWithNikola
      @TechWithNikola  6 หลายเดือนก่อน

      You're welcome. Glad it helped!

  • @marwanradwan7727
    @marwanradwan7727 22 วันที่ผ่านมา +2

    I wanna thank the youtube algorithm for recommending this video. This is absolute gem for explaining the Virtual Memory concept.

  • @Usopper.D
    @Usopper.D 4 หลายเดือนก่อน

    Wooow this video is awesome! Great work on the animations and examples 🤝😎

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน

      Thank you so much! I'm glad to hear that you've liked it.

  • @duduwe8071
    @duduwe8071 15 วันที่ผ่านมา

    Great video ! I am preparing for my master degree and found this gold in TH-cam. I believe I can ace my upcoming OS class.
    I have liked your video and subscribed to your channel.
    Thanks a lot for the video. Greatly appreciate it.

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thanks a lot for taking the time to comment, as well as like and sub. It means a lot to me.
      I’m glad that the video was helpful. Good luck with acing your classes!

  • @vishalkarna3763
    @vishalkarna3763 15 วันที่ผ่านมา

    Wonderful illustration of Virtual Memory. Good Job !

  • @godnyx117
    @godnyx117 18 วันที่ผ่านมา

    I have to words! That video is amazing! You won yourself a new subscriber, my friend! ❤

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา +1

      Welcome aboard! I’m glad you’ve liked it, and thank you for taking the time to comment.

    • @godnyx117
      @godnyx117 8 วันที่ผ่านมา

      @@TechWithNikola My pleasure! Have a lovely day!

  • @knode1993
    @knode1993 7 หลายเดือนก่อน +6

    please never stop, really good video

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +1

      Thank you! I'm glad you've enjoyed it. I'll keep making them for sure :)

  • @bingtingwu8620
    @bingtingwu8620 2 หลายเดือนก่อน

    Very clear! It helps a lot, thank you very much!😀

  • @OhNoooooooooo
    @OhNoooooooooo 7 หลายเดือนก่อน +3

    Svaka cast burazeru. Ovo sam na faksu radio, ali si dosta bolje objasnio.

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน

      Hvala :) Drago mi je sto cujem da je dobro objasnjeno.

  • @user-kw5qv6zl5e
    @user-kw5qv6zl5e 14 วันที่ผ่านมา

    Im just sitting here fascinated...and it makes sense.. knowing just the basics... nice work...a dumb thing to say but this is relaxing...straight to the point ..ask a question ...then answer it... terrific

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thanks. I’m glad you like this style.

  • @avivb4598
    @avivb4598 11 วันที่ผ่านมา

    Thank god I found this gem before my exam!

  • @iPhoneCyric
    @iPhoneCyric 7 หลายเดือนก่อน

    watched the first video in this channel, subbed!

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน

      Thank you for the sub. I'm so glad to hear that you've liked it!

  • @tahir95soyalcom
    @tahir95soyalcom 4 หลายเดือนก่อน +1

    Thank you for providing such valuable content. The examples you shared have greatly enhanced my understanding of the working principles of virtual memory.

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน

      I’m very happy to hear that. Thank you for taking the time to comment.

  • @ilushamain4740
    @ilushamain4740 25 วันที่ผ่านมา

    Your explanations are amazing
    Thank you, I hope to see more

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thank you. Yeah, definitely, I’ll try to find some time to make more videos soon

  • @kamism770
    @kamism770 26 วันที่ผ่านมา

    This is a very good, concise and clear explanation, please keep the work's up, I really enjoyed it : )
    PS: can you make a video about how compression algorithms work?

    • @TechWithNikola
      @TechWithNikola  26 วันที่ผ่านมา +1

      Glad to hear that, and you thank you for taking the time to comment. :-)
      Yeah, some compression algorithms are in my queue, but it will take a while before I get some free time to make them. Stay tuned!

    • @kamism770
      @kamism770 24 วันที่ผ่านมา

      @@TechWithNikola I'll be waiting 4 sure :3

  • @tomhekker
    @tomhekker 28 วันที่ผ่านมา

    Thanks! You explained this better than any professor did when I was still in university. Much appreciated, will be sending this video to people who ask me about this 😅

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา +1

      Glad to hear that you’ve found it useful, and thank you for sharing the video :-)

  • @dreamdrunk539
    @dreamdrunk539 27 วันที่ผ่านมา +2

    8:06 Correction: A word is two bytes in size, not 4. A double word (DWORD) is 4 bytes. And cpu's don't work with words necessarily, but general purpose registers of x32 bit cpu's are 32 bits in size. And 64 bits for x64 gprs.

    • @bleesev2
      @bleesev2 25 วันที่ผ่านมา +1

      The size of a word depends on the architecture, there is no "correct" word size.
      For example you are correct that a word in an x86 processor is 2 bytes, but a word in an ARM processor is 4 bytes.

    • @dreamdrunk539
      @dreamdrunk539 25 วันที่ผ่านมา +1

      @@bleesev2 Didn't know that thank you :)

  • @carloshenriquedesouzacoelho
    @carloshenriquedesouzacoelho 14 วันที่ผ่านมา

    From Aritmetic concepts , the virtual memóry obeys bijective function (injective and surjective ) about Domain and Image .
    It is unbelievable !

  • @kanario99
    @kanario99 5 หลายเดือนก่อน

    thank you, this video was very clarifying.

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน

      You’re welcome. I’m glad to hear that.

  • @Foreverexhailingegodeath
    @Foreverexhailingegodeath 7 หลายเดือนก่อน +1

    I like this video, shows the more "technical side" of virtual memory and how it does its thing. Thanks.

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +1

      I'm glad you've liked it, and you're welcome! :)

  • @obaydasarahneh236
    @obaydasarahneh236 18 วันที่ผ่านมา +1

    Can u make a video for registers, What are they used for…
    in a way that we can understand the assembly language

  • @jimmy1681000
    @jimmy1681000 18 วันที่ผ่านมา

    Wow, good video. Good job and thanks for sharing.

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thank you! You’re welcome.

  • @badnaf207
    @badnaf207 2 หลายเดือนก่อน

    bro you are amazing, love your energy

    • @TechWithNikola
      @TechWithNikola  2 หลายเดือนก่อน

      Thanks. I appreciate that!

  • @ismaelgrahms
    @ismaelgrahms 26 วันที่ผ่านมา

    Very well explained

  • @feazysil2707
    @feazysil2707 3 หลายเดือนก่อน

    such a good video, you are the man !

  • @ahmedghallab5342
    @ahmedghallab5342 18 วันที่ผ่านมา +1

    شكرا thanks 👍 it was helpful

  • @lhard123l
    @lhard123l 25 วันที่ผ่านมา +5

    Oh Juniors, 1GB is huuuuge for old-school guys

    • @godnyx117
      @godnyx117 18 วันที่ผ่านมา +3

      I still consider it a lot of memory and I think that modern software (especially closed source and web browsers) are unoptimized garbage!

  • @_VishalPrajapati
    @_VishalPrajapati 25 วันที่ผ่านมา

    Superb...! Love it..❤

  • @matepozzo
    @matepozzo 4 หลายเดือนก่อน +1

    clear as water, thanks!

    • @TechWithNikola
      @TechWithNikola  3 หลายเดือนก่อน +1

      Great to hear that :) Thank you!

  • @reanwithkimleng
    @reanwithkimleng 20 วันที่ผ่านมา

    Very helpful ❤❤

  • @user-yr1uq1qe6y
    @user-yr1uq1qe6y 27 วันที่ผ่านมา +1

    Starting off with the “bad old days” only being 4GB definitely lets me know I’m old! Just like running out of 32bit address space “must” have been back in the 1950s or something 😂

  • @Yazan_Majdalawi
    @Yazan_Majdalawi 4 หลายเดือนก่อน

    Liked, subbed, turned on all notifications.

  • @ankitatripathi1548
    @ankitatripathi1548 7 หลายเดือนก่อน

    Greate Video. Thanks

  • @bruceinraleigh9999
    @bruceinraleigh9999 27 วันที่ผ่านมา +1

    Finally ... a proper explanation!
    I say this because countless self-made experts get it wrong. You see, Microsoft seems to have invented the misuse of the term "virtual memory" around the time of Windows 95. They used the term VM to describe what is really demand paging. Microsoft publications at the time did NOT make this mistake. (See Jeff Richter's excellent book describing the internals of Windows NT, published at the time.)
    But in the settings UI ... I guess "virtual memory" sounded more appealing to Microsoft than "demand paging". So they misused the term ... and misled generations of self-made CS people who subsequently grew up unaware of the misuse.
    They often claim that VM size can be adjusted. (It cannot be.)
    They believe that the disk swap/paging space is virtual memory. (It is not.)
    You see, virtual memory was created as a MAPPING PROCEDURE that solved the long-standing problem of mapping a program binary into the run-time address space of a computer.
    It was preceded by address space paging (remember the early 80x86 paging registers?). This was present in minicomputers as far back as the late 1960s.
    Paged memory was, in turn, preceded by run-time relocation ... a tedious run-time editing of a binary to "patch" all of the code addresses and data addresses within a program binary before execution could begin.
    VM is superior to both of those methods.
    Meanwhile some systems implemented something called swapping ... a predecessor of demand paging. When swapping, a program's ENTIRE memory consumption is swapped to disk to make way for another program. This mechanism allows the system to get around memory size limitations ... but it performs a lot of disk swapping!
    Demand paging goes one better by swapping only small blocks of memory. And even better, it loads only portions of a program when needed. No need to load an entire program when most of that program code won't be executed any time soon. It's all quite efficient.
    Virtual memory is not demand paging, and demand paging is not virtual memory.
    And you don't have to use VM with demand paging. And you don't have to use demand paging with VM.
    But the two appeared at a similar time in computing history ... and they work hand in hand to improve performance.
    So you always see both of them together.
    This video correctly presents a unified view of demand paged/virtual memory. Nice work!

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Thanks a lot for taking to time to write such a good comment. I agree, and I’m also very happy to hear that this video met your expectations.
      Apologies for the late reply.

  • @obaydasarahneh236
    @obaydasarahneh236 18 วันที่ผ่านมา

    I'm already at about 10 minutes and have about 80% understanding. What do you recommend I look for? Or if you have some resource/s I would be grateful

  • @samirneupane7563
    @samirneupane7563 2 หลายเดือนก่อน +1

    Thank a lot.

  • @shakepudding3902
    @shakepudding3902 26 วันที่ผ่านมา

    nice video bro!

  • @oneloveafrica8860
    @oneloveafrica8860 12 นาทีที่ผ่านมา

    it was so good

  • @theomoreau8282
    @theomoreau8282 25 วันที่ผ่านมา

    Bravo !

  • @tarikabdelhadibenaouda
    @tarikabdelhadibenaouda 22 วันที่ผ่านมา

    Well explained

  • @RamsesAldama
    @RamsesAldama 2 หลายเดือนก่อน +2

    Great video. So you mention that physical address is the "memory RAM". You also mention the "page tables" are store in the "memory RAM" and how there are difference level of page tables and some can be store in disk. Is virtual memory also store in the "memory RAM"?. I know I have to rewatch this video and keep studying to fully understand and that I have gaps in my knowledge. So in a high level the OS has to do a mapping between virtual memory and page tables. And then between page tables and physical address? Thanks.

    • @TechWithNikola
      @TechWithNikola  28 วันที่ผ่านมา +2

      Hi, apologies for the late response.
      So virtual memory on its own doesn’t exist really. It’s just a number, for example from 0 to 2^32-1. As such, it is not stored anywhere.
      It only becomes interesting when we talk about translating that number to its physical counterpart. This translation is stored in page tables, and page tables are stored in RAM. It you rewatch the video you will see the exact details on how the translation works, but in a nutshell the first part of the address is remapped via page tables, and the last 10 bits are copied (called an offset).
      The mapping is actually happening in the MMU (memory management unit) which you can think of as a small chip on the CPU. You are right that OS plays an important role, and specifically, OS programs the memory management unit and specifies how to do the mapping.
      Does that make sense?

    • @RamsesAldama
      @RamsesAldama 28 วันที่ผ่านมา

      Yes, thanks for the reply

  • @jamespilcher5287
    @jamespilcher5287 2 วันที่ผ่านมา

    I've written some 6502 assembler for the BBC Master, where the most complicated it got was having to write to a memory-mapped hardware register to switch banks of RAM so that you can access 128Kb with a 16bit address bus. It's a bit mind-boggling to think about all this indirection that goes on in modern memory systems. All this back and forth would bring 8bit systems to their knees!

  • @kmalnasef1512
    @kmalnasef1512 26 วันที่ผ่านมา

    Perfect.
    you did great job here, this topic became very easy after that sweet explanation
    but I need u to correct my info if I am wrong!
    in old days we know that
    byte is 8 bits
    word is 2 bytes = 16 bits
    dword is double words = 4 bytes = 32 bits
    so, is it changed those days as you claim in this video here 8:08 !!! is word become 32-bits ?
    thank you

  • @poiofrito4722
    @poiofrito4722 4 หลายเดือนก่อน +1

    thank you man

  • @whtiequillBj
    @whtiequillBj 14 วันที่ผ่านมา

    @0:54 and before that there were 16 bit CPUs that could only address which was only 64 Kilobytes.
    In the early days it was more around the problem with memory collisions rather then accessing something that is out of range.
    In the 1960s you wouldn't find the kind of problem you're talking about because the processing power was too expensive to have that kind of problem.
    Paper Tape and Punch Cards don't have the same problems with accessing memory out of range.

  • @dims5647
    @dims5647 19 วันที่ผ่านมา

    Truly amazing

  • @chaitanyaagrawal6534
    @chaitanyaagrawal6534 5 วันที่ผ่านมา

    Can you also call a programm a process with threads etc. or are those two seperat things?

  • @huxinzhao3689
    @huxinzhao3689 5 หลายเดือนก่อน +3

    11:38 I’m wondering when you copy the last 12bits to the physical memory, why the number changes from 0110 0111 1000 to 010110011110

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน +2

      Oh that’s a good catch! It’s a bug in the animation. Sorry about that. It should remain unchanged.

    • @huxinzhao3689
      @huxinzhao3689 5 หลายเดือนก่อน

      @@TechWithNikola Thank you very much! Your videos are really helpful!!!

  • @soumyajitdas4433
    @soumyajitdas4433 15 วันที่ผ่านมา

    Is Page Table update and TLB update treated as 1 atomic operation? If yes, how do we maintain atomicity? If no, how do we handle scenarios where the TLB has stale entry?

  • @I2ealTuber
    @I2ealTuber 22 วันที่ผ่านมา

    Can you next teach us about deditated WAM?

  • @krishnapraveen777
    @krishnapraveen777 15 วันที่ผ่านมา

    Hey man, can you make same video with gpu and cpu? Your explanation is so good

    • @TechWithNikola
      @TechWithNikola  8 วันที่ผ่านมา

      Hey, thanks for the suggestion. This is one of the topics in my queue, but since I do this as a hobby I don’t get much free time to work on videos. I will be working on this but cannot promise that it will be soon

    • @krishnapraveen777
      @krishnapraveen777 6 วันที่ผ่านมา

      @@TechWithNikola Thanks man, you are doing god’s work

  • @Serhii_Volchetskyi
    @Serhii_Volchetskyi 26 วันที่ผ่านมา

    0:35 As far as I understand, 4Gb of memory means less than 4Gb of RAM. CPU thinks that ROM and south bridge devices are memory as well.

  • @gappujimast
    @gappujimast 3 หลายเดือนก่อน +3

    great video.
    i didnt get 2^32 adreess for each byte = 2 ^ 30 words

    • @TechWithNikola
      @TechWithNikola  2 หลายเดือนก่อน +1

      Thanks.
      I’ll try to elaborate.
      There are 2^32 addresses. Each address references one byte of memory, which is 4GB in total.
      Now, a CPU works with so called words. 32-bit CPU works with 4-byte long words.
      How many 4-byte words are there in 4GB RAM? We can divide 2^32 bytes (4GB) by 4, which gives us 2^30 words.
      Hopefully this makes more sense. Let me know if it’s still unclear.

    • @gappujimast
      @gappujimast 2 หลายเดือนก่อน

      @@TechWithNikola got it thanks 😊

  • @naruhitoabiku9451
    @naruhitoabiku9451 3 หลายเดือนก่อน +1

    you are a legend

  • @user-mr3mf8lo7y
    @user-mr3mf8lo7y 14 วันที่ผ่านมา

    Quite good video. Just a minor comment. You use the word 'Security' in sections but I would call it 'Liability'. Thanks,.

  • @RafaelRodrigues-ug1lt
    @RafaelRodrigues-ug1lt 10 วันที่ผ่านมา

    Me traga mais sugestões assim de canal algoritmo do TH-cam, very good

  • @su5k
    @su5k 7 หลายเดือนก่อน +1

    is there a chance that a virtual page does not map to eithjer the disk or the physical page? what happens in that case? 12:45

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +4

      Yes, that's technically possible. Virtual page doesn't really say the data is on DISK. Instead, it has a bit that says whether the mapping is valid or not, valid meaning it's somewhere in RAM. When it's invalid, the MMU will raise a page fault. For invalid mappings, the OS can use the remaining bits to store additional information that will help find the data on a device. It's up to the kernel to interpret these bits, which may mean the data is on SSD, USB flash, or somewhere else, and then load the data back into RAM. So we can use any device as a backing storage.
      Linux has a struct called swap_info which stores information about devices used for paging. Actually, it has an array of such structs, each identifying a device (potentially the same) and some metadata. Linux then uses PTEs to store an index into this array, as well as some other metadata. I'm not too familiar with the internals of how linux does this myself, but this is the general idea.

  • @stachowi
    @stachowi 2 หลายเดือนก่อน

    Very good

  • @art4eigen93
    @art4eigen93 24 วันที่ผ่านมา

    TH-cam suggesting me at 2 am here. thank god it did. I can sleep well now.

  • @abdullah.alkheshen
    @abdullah.alkheshen 7 หลายเดือนก่อน +1

    Your channel is a masterpiece!
    The Discord link is invalid or expired.
    Would you please comment it here?
    Thank you

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน +2

      Thank you.
      Ah sorry about that. I've updated it now and set to never expire: discord.gg/cEjDP4WK

  • @kurosshyu2621
    @kurosshyu2621 7 หลายเดือนก่อน +1

    subbed.

  • @overpercent
    @overpercent 25 วันที่ผ่านมา

    Subscribed immediately 👍🏾🫡… thank you sir

  • @zuowang5185
    @zuowang5185 4 หลายเดือนก่อน

    does page table also handle swap, putting memory onto hard disk?

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน

      Hi, the page table itself doesn't handle swaps. Swapping is done by the OS. For example, if a program wants to access some (virtual) memory address, but that address is on disk (which can indicated by some bits in the address), the OS moves the inactive page to disk. If the page is needed again, the OS loads the page from disk into RAM.

  • @nitilpoddar
    @nitilpoddar 6 หลายเดือนก่อน

    Kindly make part 2 for DP

    • @TechWithNikola
      @TechWithNikola  6 หลายเดือนก่อน

      I'm working on it, it just takes time to figure out what to speak about, but I'm hoping to have it in a couple of weeks.

  • @user-ku4me6nl4j
    @user-ku4me6nl4j 4 หลายเดือนก่อน +2

    how to make this animation?

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน +2

      Hi, which one are you referring to exactly? I have used a combination of powerpoint, keynote, Manim (python library) to make all these animations. Hope that helps!

  • @TheAluminus
    @TheAluminus 16 วันที่ผ่านมา

    10:39 All pages are 4096 long except Pages 2, is that a correct?

  • @IvanGeorgiev
    @IvanGeorgiev 2 หลายเดือนก่อน

    Can you recommend some books that deep dive into how Linux works with CPU, memory and disc access

    • @TechWithNikola
      @TechWithNikola  2 หลายเดือนก่อน

      I’ve personally learned a lot from the Linux Programming Interface. There are other books out there but I’ve only read this one. Let me know if you come across any other good reads.

  • @suyogpatil-cb7td
    @suyogpatil-cb7td 5 วันที่ผ่านมา

    How to make (edit ) this type of content? Can anybody share software name or any youtube playlist to learn

  • @jooonmantv
    @jooonmantv 2 หลายเดือนก่อน

    amazing

  • @rohithbhandari7836
    @rohithbhandari7836 28 วันที่ผ่านมา

    @12:17 He says cpu does not know how to read it from RAM should not it be Disk ?

    • @TechWithNikola
      @TechWithNikola  28 วันที่ผ่านมา

      Good catch. I think that my intent was to say “CPU cannot read it from RAM” (because it’s not there), but you’re also right that CPU doesn’t know how to read it from disk

  • @charliesumorok6765
    @charliesumorok6765 5 หลายเดือนก่อน

    1:00 Wouldn't the memory address wrap around and not crash immediately?

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน

      I don’t think so but I could be wrong. I guess it depends on the implementation details and I can see both being done during the time before virtual memory was a thing. In either case, neither behaviour is ideal.
      I would argue that crashing is potentially better than wraparound because it highlights a problem whereas wraparound would continue working with a potentially silent error.
      Have you come across any references that discuss this? I’m interested to learn more

    • @charliesumorok6765
      @charliesumorok6765 5 หลายเดือนก่อน

      @@TechWithNikola Ben Eater's 65c02 based computer has the most significant address bit (A15) disconnected, causing a wraparound behavior.

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน

      Got it, thank you for that. I’ll read more about it.

  • @silloo2072
    @silloo2072 13 วันที่ผ่านมา

    Commenting for the algorithm 😅

  • @nickcooley8358
    @nickcooley8358 4 หลายเดือนก่อน

    amazing. u say program. is this referring to a process?

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน +1

      Thanks. Yes, I mean process.

    • @nickcooley8358
      @nickcooley8358 4 หลายเดือนก่อน

      thnx not trying to be anal, just #justschoolthingz @@TechWithNikola

  • @sumitdhiman9026
    @sumitdhiman9026 26 วันที่ผ่านมา

  • @aryakadam7892
    @aryakadam7892 4 หลายเดือนก่อน

    great

  • @verdibahnsen
    @verdibahnsen 18 วันที่ผ่านมา +1

    Isn’t a word 16bits and a dword 32?

  • @rohithbhandari7836
    @rohithbhandari7836 28 วันที่ผ่านมา

    Is TLB same as cache ?

    • @TechWithNikola
      @TechWithNikola  28 วันที่ผ่านมา

      It depends on what do you mean by “same as cache”. Let me try to elaborate.
      TLB is a special type of memory cache that stores recent translations of virtual memory to physical memory addresses. Its primary role is to speedup this translation.
      However, this is different from the common usage of word cache which refers to a memory layer that stores copies of data and instructions closer to CPU. Usually, we refer to them as L1, L2, L3 caches.
      Hopefully this makes sense.

  • @TraceursMonkey
    @TraceursMonkey 7 หลายเดือนก่อน

    Discord link is invalid

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน

      Thanks. Sorry about that, I've updated it now and set to never expire: discord.gg/cEjDP4WK

    • @daessell4671
      @daessell4671 4 หลายเดือนก่อน

      @@TechWithNikola link expired again '-'

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน

      Thanks@@daessell4671 . I must have forgotten to use the permanent link on this video. The one in the basic channel info is permanent. I have now updated it for this video as well.

  • @charliesumorok6765
    @charliesumorok6765 5 หลายเดือนก่อน

    4:50 The virtual memory system doesn't know that it is on disk, it just knows that it is inaccessable to the program.

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน +4

      Correct. It actually knows a bit more than that. I have written some additional info in one of the comments. I’ll copy the contents here (let me know if this seems wrong):
      From another comment:
      Virtual page doesn't really say the data is on DISK. Instead, it has a bit that says whether the mapping is valid or not, valid meaning it's somewhere in RAM. When it's invalid, the MMU will raise a page fault. For invalid mappings, the OS can use the remaining bits to store additional information that will help find the data on a device. It's up to the kernel to interpret these bits, which may mean the data is on SSD, USB flash, or somewhere else, and then load the data back into RAM. So we can use any device as a backing storage in theory.
      Linux has a struct called swap_info which stores information about devices used for paging. Actually, it has an array of such structs, each identifying a device (potentially the same) and some metadata. Linux then uses PTEs to store an index into this array, as well as some other metadata. I'm not too familiar with the internals of how linux does this myself, but this is the general idea.

  • @user-eo7qk7jm9e
    @user-eo7qk7jm9e 21 วันที่ผ่านมา

    where are you from? just for the accent. (English learner)