Hi
So, I have a question about our beloved Disk Operating System: What happens with COMMAND.COM, when you start another program? I know that the new program is loaded at memory address 0x100 and then a "call" happens to that location, but what happens to the already loaded program (COMMAND.COM in this example) at 0x100? It's not completely gone, since your program can return to the previous running application. Is it loaded elsewhere? Does DOS move every program to another memory location when they start another app and then reload them to 0x100 when the sub-programs exits?
DOS - What happens with the shell when a program is started
-
- Posts: 3
- Joined: Sun Dec 16, 2018 6:18 am
Re: DOS - What happens with the shell when a program is star
The program is indeed loaded to 0x100. But the segment for that 0x100 is a different one each time. COMMAND.COM stays in memory, where it was before it called another program.
This is less wasteful than it could have been, since segments overlap a lot.
This is less wasteful than it could have been, since segments overlap a lot.
Carpe diem!
-
- Member
- Posts: 771
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: DOS - What happens with the shell when a program is star
COMMAND.COM has two parts. There is the resident portion of COMMAND.COM. Usually this is in low part of conventional memory before the programs but can be loaded in the HIGH Memory Area (HMA) Between 1MiB and 1MiB+65520 if you are running HIMEM.SYS on a 386+. The second part of COMMAND.COM is the transient portion. This part usually sits at the top of the DOS free memory pool (usually below the top of conventional memory under the EBDA (and other hidden data/code). This part of COMMAND.COM is considered free memory and may be given to the program by the DOS loader or requested by the program that requests more memory. When a program exits, DOS determines if the transient portion of COMMAND.COM has been overwritten and then reloads it. If it hasn't been overwritten then it can be reused as is.
Re: DOS - What happens with the shell when a program is star
Even though DOS doesn't work this way, the very earliest single-tasking versions of what became UNIX could only have one process in memory at a time. They had a special mechanism to re-load the shell whenever another process terminated.
Of course, this was on a system with only about 4KB of memory and was replaced by a better mechanism pretty quickly...
The early single-tasking versions of Mac OS (then simply known as the "Macintosh System Software") did something similar with their graphical "Finder" shell, since even having one GUI application resident in 128KB was difficult, having multiple was out of the question.
Of course, this was on a system with only about 4KB of memory and was replaced by a better mechanism pretty quickly...
The early single-tasking versions of Mac OS (then simply known as the "Macintosh System Software") did something similar with their graphical "Finder" shell, since even having one GUI application resident in 128KB was difficult, having multiple was out of the question.