MS-DOS Memory Management on x86

Поділитися
Вставка
  • Опубліковано 13 тра 2024
  • I review the history and evolution of memory management in MS-DOS on x86 PC architecture.
    0:00 Introduction/terminology.
    0:53 Origins of MS-DOS.
    1:33 8086, 80286, 80386 memory model. Real/protected modes.
    3:17 PC address space. DOS address space and memory terminology.
    6:46 Expanded memory.
    8:26 Extended memory.
    10:18 DOS Extenders.
    11:35 Microsoft moves to Windows.
    12:21 Conclusion.
  • Наука та технологія

КОМЕНТАРІ • 115

  • @SweetBearCub
    @SweetBearCub 7 місяців тому +14

    Talk about a blast from the past! When I was a teenager (pre-internet), I remember fighting with DOS and reading deep into manuals to squeeze out every free byte of RAM for my games. It could be quite intricate, and it took a while. It was almost like a game itself to find the right combinations.

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

      I agree it felt like dark wizard magic. Now I just use some configuration files from Phils computer lab. It was finally able to get some games working I never did.

  • @pepe6666
    @pepe6666 7 місяців тому +10

    this is neat. this was the explainer i needed 20 years ago. this is a summary of my decades of confusion and learning and 'eventually sorta getting it'. its great to see this all summarized in this way. it really is the top of the pyramid for an explanation of all of this history.

    • @chillruns6221
      @chillruns6221  7 місяців тому +1

      I'm very glad it's valuable to you, and that makes it worth having produced. I was able to get around pretty well to do the things I wanted to do, but I didn't have as much info at the time either; no WWW yet.

  • @bendono
    @bendono Рік тому +25

    Great video. This is so nostalgic. I fondly remember messing with himem.sys, TSRs etc. as a kid. At the time, I didn't really know much about real vs. protected mode though. I hope to see more like this.

    • @andrejrockshox
      @andrejrockshox 11 місяців тому +2

      yeah, exactly my thoughts now, but at the time it was a pain in the ass to free up enough convetional memory for really old games. also had selection menus at boot for different configs, depending on which game i will play. the problems was restarting whole PC when you needed different config for another game.

    • @keigezellig
      @keigezellig 7 місяців тому +1

      @@andrejrockshox So true, i had once 5 different boot floppies to play certain games :D

    • @chillruns6221
      @chillruns6221  7 місяців тому

      I'm glad you enjoyed it. Is there anything in mind you'd like me to cover?

  • @knghtbrd
    @knghtbrd 7 місяців тому +5

    First time I've ever heard someone unironically say "mebibyte", but good high-level explanation of a low-level topic. High level because questions segment/offset and selector/offset weren't discussed, nor why some things require you NOT run EMM386 but might work if you had an EMS card installed, how DOS could see memory above 1MB in real mode, why load order mattered as much as memory locations for where drivers went in memory when running memmaker, etc? That sort of thing …
    For how "simple" it is, MS-DOS memory management was a BIG topic. Might be too low-level for your audience though.

    • @chillruns6221
      @chillruns6221  7 місяців тому +7

      The evolution of the x86 CPUs and the DOS memory model around it makes the topic big, as I found when I was researching this. It was a lot of work to maintain accuracy and reduce the details down to an introductory video. The details you mentioned could be interesting topics for videos of their own. I agree with your assessment of the video as a high-level explanation, and appreciate it, because I was going for that. As for my audience, my content is targeted at people who appreciate low-level computing topics; see my OS development and disassembly stream videos.
      I've gotten a big influx of subscribers and comments on this video lately. No idea what the source of it is, but I appreciate it. I haven't 100% found my focus for this channel yet, but I am still working on content for it.

  • @fintux
    @fintux 7 місяців тому +10

    Windows 3.1 still ran fine in 286 mode. It would even default 286 mode if you did not have much RAM, and at least with not much memory, it would actually run faster in the 286 mode (I know that because we had a computer with 2 MiB RAM). But you did not get the full features, like virtual memory and pre-emptive multitasking of DOS applications.

    • @ctvxl
      @ctvxl 7 місяців тому +2

      Windows 3.1 used cooperative multitasking. Win 95 was the first Microsoft OS to use preemptive

    • @fintux
      @fintux 7 місяців тому +2

      @@ctvxl note that I specifically said DOS applications. Windows applications used cooperative multitasking until Win95, like you said, but DOS programs in 386 mode were running virtualized in Win 3.1, and they were executed with preemptive multitasking. This might sound a bit weird, like the DOS programs being executed in a sense in a more "modern" way, but DOS programs were not implemented with multitasking in mind, so the solution needed to be a bit more involved.

    • @ctvxl
      @ctvxl 7 місяців тому +3

      @@fintux Yes, true. Dos apps running in Windows 3.1 were indeed virtualized and preemptively multitasked against each other. I actually had forgotten that. I learned about it many years ago when I became MCP certified on Windows 95. The course I took explained that factoid when comparing multitasking in Win 3.1 to 95. It's been a VERY long time :)

    • @fintux
      @fintux 7 місяців тому

      @@ctvxl yeah, I had to relearn that recently myself, too :)

  • @adrianolopes_sp
    @adrianolopes_sp 7 місяців тому +2

    Loved the video. Thanks for sharing your knowledge

  • @RetroTechChris
    @RetroTechChris 7 місяців тому +1

    Really enjoyed this, and learned a lot! Thank you!!

  • @jesseessej
    @jesseessej 7 місяців тому +3

    What a nice stroll down memory lane, pun intended.

  • @michaelturner2806
    @michaelturner2806 7 місяців тому +4

    "What about one eighty-s-"
    "Shhh, we don't talk about 80186."

    • @0LoneTech
      @0LoneTech 7 місяців тому +2

      In this context (IBM PC compatibles), the 80186 is quite uninteresting; it has a couple of new instructions, and the same 16-bit data bus as the 8086, but no new addressing capability. It was also rather rare, with some other chips like NEC V20 being far more common.

    • @nickwallette6201
      @nickwallette6201 7 місяців тому +2

      "The 186 never existed."
      "Yeah it did, there were a few computers that had----"
      *"THE 186 NEVER EXISTED."*

    • @g8ymw
      @g8ymw 2 місяці тому

      Used with the Acorn BBC Master as a co-processor.
      The Master 512

  • @DOAHunt3r
    @DOAHunt3r 7 місяців тому +6

    Personally I don’t mind the use of MiB and similar terminology to be clear that you’re talking about base 2. Even if it is the HDD manufacturers’ fault we live in a world where MB and KB is ambiguous now.

    • @cigmorfil4101
      @cigmorfil4101 7 місяців тому

      ​​​@@SnakebitSTI
      Really?
      Back in the 1970s 8-bit micro era of computing a computer with 32kilobytes of RAM had 32,768 bytes of RAM.
      The processors (6502, 8080, Z80, etc) could access up to 64 kilobytes, or 65,536 bytes of memory.
      Then you had floppies[1] of 180 kilobytes, 360 kilobytes, 720 kilobytes, 1.44 megabytes all with the capacity based on 1 kilobyte = 1,024 bytes, 1 megabyte = 1024 kilobytes.
      The manuals for the GEC 41xx processors of the 1980s refer to accessing 64 kilobytes (65,536 bytes) of memory (in four 16 kilobyte (16,384 byte) segments).
      In every case (in the computing world) it was understood that 1 kilobyte = 1,024 bytes.
      That is until HDD manufacturers came along and decided to use the base-10 prefixes to bytes, despite bytes not being a base 10 unit - a byte is of 8 bits and can store a value between 0x00 and 0xff (0 and 255).
      [1] the unformatted, raw, capacity was higher, but bits _[sic]_ of that raw capacity is needed to mark the sectors, etc. Thus a 2Mb floppy only gave 1.44Mb when formatted, a 4Mb floppy only gave 2.88 Mb formatted to IBM/DOS capacity; a 4MB floppy gave 3.2Mb formatted capacity on QL quad density drives.

    • @olegscherbakov5984
      @olegscherbakov5984 3 місяці тому +1

      I can't get used to it. In DOS years it was kB, MB and so on. For me MiB stands for Man in Black )

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

    this is a great video, subscribed

  • @tmilker
    @tmilker 2 роки тому +27

    It's kinda weird to see the use of the kibi- & mebi- prefixes in a DOS video since these weren't a thing then and primarily a construct by the hard drive industry given (il)legitimacy by the IEC to redefine the kilo-, mega- etc. prefixes.

    • @chillruns6221
      @chillruns6221  2 роки тому +13

      I also find they're pretty awkward to vocalize. But they're the best way to avoid any ambiguity, to my knowledge. Time will tell if I'll persist with this approach.

    • @thewhitefalcon8539
      @thewhitefalcon8539 7 місяців тому +8

      Redefine? Kilo is an SI prefix that always meant 1000. Programmers tried to redefine it because 1024 is "close enough" to 1000, and it's fine for casual speech, but this attempt had no legitimacy at the SI.

    • @majorramsey3k
      @majorramsey3k 7 місяців тому +11

      @@thewhitefalcon8539 Everyone understood that a kilobyte was 2^10. Much of the industry still abides by this. HDD manufacturers liked to over advertise their capacity. RAM companies did not.

    • @thewhitefalcon8539
      @thewhitefalcon8539 7 місяців тому +4

      @@majorramsey3k Everyone understood that kilo was 1000. Much of the industry still abides by this. RAM manufacturers liked to confuse people. HDD companies did not.

    • @whophd
      @whophd 7 місяців тому +3

      @@thewhitefalcon8539I think KB and MB were defined distinctly, at least at the later point when KiB and MiB were defined.
      Anyway it’s news to me that DOS had a limit of 640 KiB not 640 KB.

  • @matthewday7565
    @matthewday7565 7 місяців тому +4

    Popped up recently for me too.
    I don't think HIIMEM or 286 can do UMB mapping though, that needs EMM386/QEMM and the v86 capability of the 386.
    I might be misremembering, but I think expended memory or LIM EMS (Lotus Intel Microsoft) was originally intended to allow bigger 123 spreadsheets
    RAM on an ISA card was mapped into (original spec, a 64k page frame of 4x 16k pages) similar to the way 8 bit home computers mapped extra ROM and RAM.

  • @BlackEpyon
    @BlackEpyon 7 місяців тому +2

    The difference between the 8086 and 8088 is that the 8086 has 16 of it's address pins duplexing as data pins, while the 8088 only has 8 of them duplexing as data pins, but they are otherwise identical. This means that the 8086 is capable of accessing it's memory 16-bits at a time instead of 8-bits like the 8088. What I'm curious about is whether or not any motherboards actually implemented this. Given that the 8086 was more popular among business-oriented machines, I'm guessing somebody did, but I'm not familiar with any specifically.

  • @dmac7128
    @dmac7128 7 місяців тому +1

    From my experience the memory area above 640 Kb was only available as RAM when a memory manager program like 386MAX or QEMM was installed. DOS 5.0 and higher has a similar memory manager included. Plus you could only do this on a 386 or higher CPU. There were some DOS games that needed this because they needed 600 Kb+ of RAM to run. These memory manager programs also supported the EMS memory interface in software by reserving a 64 Kb UMB area. They also scanned the entire upper memory area to map all free UMB's which included unused areas that were reserved for the system BIOS Typically these programs would load device drivers and TSRs into these recovered UMBs.

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

    1:58 you forgot the 186
    2:33 the 286 was only mostly compatible, it didn't roll over at the 1MB limit like the 8086/8088 and 186, which is why the A20 gate was needed
    3:00 the 386 can run real-mode apps in protected mode using virtual 8086 mode

  • @johng.1703
    @johng.1703 27 днів тому

    I remember back in the day having a 20MB 386 that was tricked out, and having to have a multiple choice config / autoexec depending on what I needed as I didn't have enough base / umb / himem to get all of the drivers in and be able to run a half decent dos game.
    one config also had a 16MB ram drive that copied games I would play into it and run the game from ram. it was a long copy time, but games ran fast.

  • @magnum333
    @magnum333 3 місяці тому +1

    8:45 "Extended Memory - XMS maps extended RAM to UMBs". What UMBs does XMS use? or does it use conventional memory?

  • @CameronHuff
    @CameronHuff 7 місяців тому +2

    "We'll never need more than 640K " - some guy that was completely wrong.

    • @shallex5744
      @shallex5744 11 днів тому

      if you're referring to Bill Gates, there's no evidence that he ever actually said that

  • @stephenkennedy6358
    @stephenkennedy6358 7 місяців тому

    What does the address space look like if you did not have 1MB of Memory , specificaly if you only had 156k of memory; where does the BIOS, expansion ROM and Video?

    • @dutchcanuck7550
      @dutchcanuck7550 7 місяців тому +1

      They are still located between 640K and 1Mib. Their addresses -- as accessed by the DOS kernel, the BIOS and device drivers -- do not change and are still valid, regardless of how much physical RAM is installed. If you had 156K of RAM, there is simply no valid address between 156 and 640. They are empty, and any attempt to access them will result in an error, and possibly a frozen computer.

    • @chillruns6221
      @chillruns6221  7 місяців тому +2

      Adding to @dutchcanuck7550's response, this is a common scenario for machines of this era. Rather than configuration differences changing the addresses of resources, you might end up with "holes" in the address space, or an area of it where the memory map of a device is repeated in more than one place.
      Broadly, a CPU with address and data buses lets you select an address and read or write from it. The CPU doesn't know or care what's at the other end of the address, it just asserts the signals on the address and data lines. There may be a logic circuit, called the address decoder, in between the CPU's address lines and the various components of the computer. The circuit routes the signals of the address lines based on the selected address. One address may connect you to RAM, another to a video card, and so on. The decoder understands that other devices are not to be addressed, so activation signals don't go to them. That way, the data bus can be shared across multiple devices; only the addressed device will assert or receive the data. The address decoder could even change the map, removing one device from it and putting another in its place. The address decoding logic is specific to the architecture of the computer we use.
      A "memory mapped device" can refer to something that may or *may not* be purely memory in the address space. For example, a video card may have both its video memory and its registers in the address space. Writing a value to a register might make the card change the video mode. Both storage and decision-making logic elements are involved.
      A computer has "memory mapped I/O" when *all* resources are mapped into the address space. I believe the C64 is an example. Again, the CPU doesn't know or care what's on the other end of its address and data buses. I'd prefer another term like "address mapped device", but "memory mapped" is the convention we have.
      The memory map is not the only way a CPU can do I/O to devices. The 6502 has no dedicated I/O; memory mapped I/O is the only option. I8088 and Z80 have dedicated I/O ports which can be connected to peripherals. A CPU with dedicated I/O ports can also do memory mapped I/O, so a computer could have some combination of the two.
      Fortunately, complete logic diagrams of many computers are available for study.
      IBM PC: archive.org/details/IBMPCXTTechnicalReference1502237/page/n531/mode/2up
      Commodore 64: www.monkeyspeak.com/c64_hardware_details/
      Garth Wilson has a complete primer on the 6502 CPU, including a complete circuit for a minimal 6502 computer. I have built one very similar using his work. All the material on his web site is very valuable: wilsonminesco.com/6502primer/addr_decoding.html
      @BenEater has a few videos on address decoding and visualizes it well. ua-cam.com/users/results?search_query=address+decoding

  • @8088argentina
    @8088argentina 7 місяців тому

    no, el 8088 es una variante del 8086, mas economica, el 8086 es de 1976 y el 8088 es de 1979

  • @pelimies1818
    @pelimies1818 7 місяців тому +2

    To get Falcon3.0 with expansion packs running.. you needed to know all this shiet in this video - front and back.

  • @supercompooper
    @supercompooper 7 місяців тому +4

    Bah humbug, I think no one needs more than 64k 😂

  • @skagon_
    @skagon_ 7 місяців тому +1

    Nobody who used a computer in that time would call a megabyte "mibibyte".

    • @chillruns6221
      @chillruns6221  7 місяців тому

      I used computers then and called it a megabyte at that time. I use computers now and chose the term mebibyte in this video.

    • @skagon_
      @skagon_ 7 місяців тому

      @@chillruns6221 How about you get back in touch with reality and stop using idiotic made-up crap that were meant to fix a problem that never existed?

  • @iwanttocomplain
    @iwanttocomplain 7 місяців тому

    You just have to know your config.sys and autoexec.bat files.

  • @ArneRagnarsson
    @ArneRagnarsson 7 місяців тому +3

    I* was interested to watch this movie. But when I herad the computer voice, i stop watchin after 11 sec

    • @mentaldemise
      @mentaldemise 7 місяців тому

      Listening to it say "Meh beh byte" instead of "Mega Byte" is painful.

    • @chillruns6221
      @chillruns6221  7 місяців тому +1

      The computer voice is you hear is my human voice. I was slowing down intentionally to read my voice-over. I was doing that to make it easier for newcomers to understand, since it's information-dense. In retrospect, I do think it sounds unnatural and will try it differently going forward.

  • @assholeyeng
    @assholeyeng 7 місяців тому

    ms tres

  • @judmcc
    @judmcc 7 місяців тому

    I remember using this - it was a nightmare!

  • @Taras-Nabad
    @Taras-Nabad 19 днів тому

    QEMM

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

    Mebibyte... Ugh.

  • @hamesparde9888
    @hamesparde9888 7 місяців тому +9

    Isn't this mebibyte stuff just made up by HDD manufacturers? Why not just use megabytes like everyone else. No one thinks a megabyte is 1000 kilobytes!

    • @majorramsey3k
      @majorramsey3k 7 місяців тому +3

      I agree, I'd rather put a pen in my eye than pronounce mebibyte. A Megabyte is 2^20 bytes.

    • @whophd
      @whophd 7 місяців тому

      Bigger number looks bigger, that’s why

    • @nmmm2000
      @nmmm2000 7 місяців тому +2

      When you buy 9 TB disk, you think is 10 TB :)

    • @majorramsey3k
      @majorramsey3k 7 місяців тому +1

      @@nmmm2000 They shouldn't be labeling a 9TB drive as 10TB.

    • @majorramsey3k
      @majorramsey3k 7 місяців тому +2

      @@SnakebitSTI That's incorrect. A kilobytes was always defined as 2^10. Everyone in computer science fields knew this definition. That's why the Commodore 64 is not called the Commodore 65.536

  • @andrewlankford9634
    @andrewlankford9634 7 місяців тому

    What memory management?
    Who in their right mind cares about DOS 6.22 in the year 2023?

    • @arnolduk123
      @arnolduk123 7 місяців тому +2

      LOL...yeah I'm still using DOS 5.0 so I'm not happy either.

    • @nickwallette6201
      @nickwallette6201 7 місяців тому +1

      If you don't already know the answer to that question, what happened with the algorithm to present this video to you?

    • @arnolduk123
      @arnolduk123 7 місяців тому

      The DOS is still very much part of Windows today, your console operates a more modern version. But I guess there are more DOS 6.22 users than there are vegetarians today.

    • @technicalfool
      @technicalfool 7 місяців тому

      Anybody interested in making old games work, even if via DOSbox or a VM.
      "This application requires at least 570,000 bytes of conventional memory available."

  • @der.Schtefan
    @der.Schtefan 7 місяців тому +2

    Saying MiB instead of MB kinda makes you sound like you have a speech impediment, although I know you try to be as accurate as possible.

    • @hamesparde9888
      @hamesparde9888 7 місяців тому +6

      IDK I feel like the only people who care about this are HDD manufacturers. I don't think it's inaccurate to say Megabyte. Every knows you don't mean 1000 kilobytes. I don't know the history of the terms, but even if it is historically accurate I still think it's stupid. You wouldn't go around saying cracker when you mean hacker.

    • @thewhitefalcon8539
      @thewhitefalcon8539 7 місяців тому

      ​@@hamesparde9888hard drive manufacturers also don't think it's a problem that mega means million. Why should we trust you over them?

    • @thewhitefalcon8539
      @thewhitefalcon8539 7 місяців тому

      ​@@hamesparde9888nowadays "black hat hacker" is common

    • @hamesparde9888
      @hamesparde9888 7 місяців тому +1

      @@thewhitefalcon8539 because the term mebibyte was only introduced in 1998! Just because the prefix mega usually means 1 million doesn't mean it can't have a different definition in different fields. Everyone knows 1 megabyte is 1024 kilobytes. It's a widely accepted definition and has been for long before the term mebibyte even existed. HDD manufactures like this redefinition because it allows them to advertise HDD sizes that are smaller than what many people who are unaware of this new terminology realise. Not to mention that the term has been introduced from the top down.

    • @hamesparde9888
      @hamesparde9888 7 місяців тому +5

      @@thewhitefalcon8539 It's interesting that memory manufactures don't use this new redefinition. 🤔

  • @Erlisch1337
    @Erlisch1337 7 місяців тому +1

    the good old days of messing with autoexec.bat and config.sys to to free up memory to maybe run a game

  • @schifoso
    @schifoso 7 місяців тому

    The first KB was not occupied by the BIOS. It was RAM and was the BIOS Data Area (BDA); the values were populated by the BIOS. The first KB was actually the Interrupt Vector Table (IVT), then came BDA values for items such as COM/LPT port addresses, memory size, keyboard buffer, soft reset behavior, etc. MS-DOS boot sector would load initial code to 0:7C0, and would use 70:0 as the DOD data area.

    • @chillruns6221
      @chillruns6221  7 місяців тому

      I don't go into that level of detail in the video, but had intended all those things, not only BIOS code, to be included in what I call BIOS. What you say is true, of course. Thank you for specifying.