Open Library - an open library of educational information. Stages of loading operating systems


When you start an application, the system opens its executable file and determines the amount of code and data of the application. It then reserves a region of the address space and marks the physical memory associated with that region as the EXE file itself. Instead of allocating some space from the page file, the system uses the actual contents or image of the EXE file as a reserved region of the program's address space. Thanks to this, the application loads very quickly, and the page file size can be significantly reduced.

An image of an executable file (i.e., an EXE or DLL file) located on the hard drive and used as physical memory for a particular region of the address space is called a memory-mapped file. When loading an EXE or DLL, the system automatically reserves a region of the address space and projects the file image onto it. In addition, the system allows (using a group of Win32 functions) to project data files onto the address space region. (We'll talk about memory-mapped files in Chapter 8.)

When an EXE or DLL file is loaded from a floppy disk, Windows 95 and Windows NT allocate all the memory in the page file for it. Next, the system copies the file from the floppy disk to RAM and to a page file; in this case, the page file effectively serves as a copy of the contents of RAM. So, in particular, programs that install applications on the computer are downloaded.

Usually the installation program is launched from the first floppy disk, then inserted one by one the following discs, which actually contains the application being installed. If the system needs some piece of code from the EXE or DLL module of the installation program, it is, of course, not on the current floppy disk. But, since the system copied the file into RAM and into the page file, it will have no problem accessing the necessary installer code. Well, at the end of its work, the system will free up the RAM and the memory allocated in the page file.

56. Transferred and reserved memory

The address space allocated to the process at the time of creation is almost all free(not reserved). Therefore, in order to use any part of it, you need to cast certain regions in it by calling the Win32 function VirtualAlloc (for more information, see the chapter. The operation of selecting a region is called reservation (reserving).

When making a reservation, the system necessarily aligns the beginning of the region to an even address and takes into account the so-called resource allocation granularity (allocation granularit The last value, in principle, depends on the type of processor, but for those considered in the ksh (x86, MIPS, Alpha and PowerPC) it is the same and amounts to 64 KB. The concept of “granular resource allocation” is used in the system to simplify the service record storing information about the regions reserved in the address space of your process, and also to reduce the degree of fragmentation of regions in this space.

If you try to reserve a 10 KB region, the system will automatically round the value you specify to the next higher even multiple. This means that x86, MIPS and PowerPC processors will be allocated a region of 12 KB in size, and on the Alpha process - 16 KB. And the last thing in this regard. When a reserved region of address space is no longer needed, it should be returned to shared resources systems. This operation is liberation (releasing) region - carried out by calling the function VirtualFree.

To practically use a reserved region of address space, you need to allocate physical memory and map it to that region. This operation is called transfer of physical memory (committing physical storage). To transfer physical memory to a reserved region, you still use the same function VirtualAlloc. By transferring physical memory to regions, there is no need to allocate it to an entire region. You can, say, reserve a 64 KB region and transfer physical memory

aonly its second and fourth pages. In Fig. Figure 5-3 provides an example of what a process's address space might look like. Note: the structure of the address space depends on the processor architecture. So, in Fig. Figure 5-3 on the left shows what happens to the address space on x86, MIPS and PowerPC processors (4 KB pages), and on the right - on the DEC Alpha processor (8 KB pages).

When the physical memory allocated to the reserved region is no longer needed, it is released. This operation is return physical memory (decommitting physical storage) - performed by calling a function VirtualFree.

We hope that you have a good understanding of the organization of book storage in the library and, accordingly, the procedure for finding the desired book by its code from the catalog. Transfer your understanding of this to the way you store files on the disk and organize access to it.

Access- a procedure for establishing communication with memory and a file located in it for writing and reading data.

The logical drive name that appears before the file name in the specification specifies the logical drive on which to search for the file. On the same disk there is a directory in which complete file names, as well as their characteristics: date and time of creation; volume (in bytes); special attributes. Similar to a library's cataloging system, the full name of a file registered in a directory will serve as a cipher by which the operating system finds the file's location on disk.

Catalog- a directory of files indicating their location on the disk.

There are two directory states - current (active) and passive; MS DOS remembers the current directory on each logical drive.

Current (active) directory- the directory in which the user's work is performed at the current computer time.

Passive directory- directory with which this moment time there is no connection.

The operating system adopts a hierarchical directory organization structure. Each disk always has a single master (root) directory. It is located at the 0th level of the hierarchical structure and is denoted by the symbol "\". The root directory is created when formatting (initializing, partitioning) the disk, has a limited size and cannot be deleted using DOS. The main directory may include other directories and files that are created by operating system commands and can be deleted by appropriate commands.

Rice. 9.1. Hierarchical directory organization structure

Parent directory- a directory with subdirectories.

Subdirectory- a directory that is included in another directory.

Thus, any directory containing lower-level directories can be, on the one hand, parent to them, and on the other hand, subordinate to the top-level directory. As a rule, if this does not cause confusion, the term "directory" is used, meaning either a subdirectory or a parent directory, depending on the context.

File system- part of the operating system that controls the placement and access to files and directories on the disk.

Closely related to the concept of a file system is the concept disk file structure, which is understood as how they are placed on the disk: the main directory, subdirectories, files, operating system, as well as what volumes of sectors, clusters, and tracks are allocated for them.

Driver- a program that expands the capabilities of the operating system.

Device driver- an operating system program for controlling the operation of peripheral devices: disk drives, display, keyboard, printer, mouse, etc.

    1. Loading OS into RAM from disk

        1. Operating system loading algorithm

The operating system is stored in external memory usually on a hard disk, less often on a floppy disk. For normal operation The computer requires that the main modules of the operating system be in RAM. Therefore, after turning on the computer, the operating system is automatically rewritten (loaded) from the disk into RAM.

After turning on the computer, you watch the numbers change on the screen. These numbers reflect the RAM testing process BIOS program. If a fault is detected in the RAM cells, a message will be displayed.

The operating system is stored in external memory, usually on a hard disk, less often on a floppy disk. For normal operation of a computer, it is necessary that the main modules of the operating system be in RAM. Therefore, after turning on the computer, the operating system is automatically rewritten (loaded) from the disk into RAM. The most important aspects of this loading are depicted in the form of an algorithm in Fig. 9.13.

Rice. 9.13. Algorithm for loading the operating system from disk into RAM

After turning on the computer, you watch the numbers change on the screen. These numbers reflect the process of testing RAM by the BIOS program. If a fault is detected in the RAM cells, a message will be displayed.

After successfully completing the hardware testing, the drive with floppy disk A is accessed, and the indicator light next to it lights up. If you are loading the operating system from a floppy disk, then before or during testing you must insert the system disk into drive A. Otherwise, if there is no operating system on disk A, the hard disk is accessed, as evidenced by the indicator light next to it.

Reading into the RAM of the 0th sector of the 0th side of the disk in which the bootloader is located (BOOT RECORD) begins. Control is transferred to the bootloader, which checks for the presence of the IO.SYS expansion module and the MSDOS.SYS base module on the system disk. If they are in their designated place (cm. rice. 9.10), then it loads them into RAM, otherwise a message about their absence will be displayed. In this case, it is recommended to re-download. The reboot signal transfers control to the permanent BIOS module, which again writes the block from the disk into RAM bootstrap etc.

Remember! For reboot the operating system press the keys simultaneously into memory .

After successfully loading the IO.SYS expansion module and the MSDOS.SYS base module into the RAM, the COMMAND.COM command processor is loaded and the CONFIG.SYS configuration file, which contains connection commands, is processed necessary drivers. This file may be missing if you are happy with the base version of the operating system.

The batch file AUTOEXEC.BAT is then processed. Using this file you can configure the operating environment parameters. For example, create virtual disk, ensure changing printing modes, download auxiliary programs, etc.

Attention! Files with the extension .BAT are played when working in system environment special role. They contain a set of operating system commands or names executable files. After running a file with the .BAT extension, all commands written in it are executed automatically one after another.

A file with the standard name AUTOEXEC.BAT differs from other files of the .BAT type in that the execution of commands placed in it begins automatically immediately after the operating system boots.

If the AUTOEXEC.BAT file is missing, you will be prompted to enter the date and time:

if you press enter, then as current dates and time the so-called system parameters, which are determined by a computer timer;

if you want to reinstall system dates and time, then when prompted, enter the values ​​in one of the provided forms, for example:

10-25-1997 (month day year)

7:30:10.00r (hours:minutes:seconds)

After the AUTOEXEC.BAT file has finished running, or if this file is not found, a prompt will be displayed on the display screen system disk, For example C:\>. This indicates that the boot process has completed normally and you can begin working by entering the application name or operating system command.

A long time ago, when I was little, I worked in an institute laboratory at big computer SM-3 (something like the famous PDP-11), bootstrapping (loading) the computer looked like this. A short paper tape with a boot program punched on it was inserted into the photo reader, the reading process was started, and then... depending on your luck.

The fact is that the paper tape gradually wore out, began to be difficult to read, and the computer might not start the first time. In this case, the process had to be repeated, sometimes several times, until the bitter end. When the tape completely failed and the machine did not want to “come to life”, it was necessary to temporarily enter the boot program manually using the switches located on the front panel. The main thing here was to take your time and not make mistakes.

IN modern computers The download process is mostly automated, but that doesn't mean it's not worth getting to know.

Basic definitions and stages of loading an operating system

Turning on the computer, POST, BootMonitor

The initial stage of loading the operating system after turning on the computer begins in the BIOS (Basic Input/Output System - basic system input/output). IN BIOS settings we specify the boot device, or row boot devices in order of their priority. Possible various options loads and their combinations: with hard drive, CD/DVD disks, USB flash drives and others.

Immediately after passing POST (Power-On Self-Test - self-test after switching on) Computer BIOS will begin to search through the specified boot devices one by one until it finds a suitable special entry on one of them, which contains information about further actions.

Level 1 loader. Master Boot Record

Master Boot Record - main boot record, located in the first physical sectors bootable storage devices. It contains a Partition Table and executable code.

The main task of the program written in the MBR is to search for the active system partition of the disk and transfer control to its boot sector. Thus, this stage can be called preparatory, due to the fact that the OS itself is not directly loaded yet.

The system partition is usually called the partition of the disk (storage device) on which the operating system files responsible for the OS boot process are located (the operating system itself can be located in another partition). Basically, system partitions there may be several, so one of them is marked as active. This is what the program loaded from the MBR is looking for.

Level 2 bootloader. Partition Boot Sector

The next step in booting the computer is transferring control executable code, recorded in PBS (Partition Boot Sector - boot sector active partition). PBS is located in the first sector(s) of the corresponding disk partition. The PBS code specifies the name of the operating system loader file, to which control is transferred at this stage.

The initial stage of loading the operating system. OS boot manager

Initially, the boot loader in Linux was LILO (Linux Loader). Due to the shortcomings it had, the main one of which was the inability to understand those used in Linux file systems, later the GRUB (GRand Unified Bootloader) bootloader began to be used, in which the shortcomings of LILO were corrected.

If we are talking about Windows versions before Vista, for example Windows XP, then Ntldr will be loaded. It, in turn, reads information from text file Boot.ini, which contains information about installed operating systems Oh.

Loading the operating system kernel

The final stage of loading the operating system is loading the OS kernel and transferring control to it.

Several years ago there was such a funny case in my practice.

I was asked to help a man buy and organize a computer for his home. This friend had just retired at that time, and before that he worked as a boss and saw the computer, for the most part, from afar, on his secretary’s desk. After retirement, he had the time and desire to master the computer. Well, I think that's great. We found him an inexpensive, but high-quality computer with a good monitor, for those times. I installed and configured some programs and showed them how to use them. The gentleman acquired a book from the series “ Something for dummies“And we parted absolutely satisfied with each other.

About a week later, my ward called me on the phone and, almost crying, told me that everything was gone and the computer no longer worked. Fortunately, he did not lock himself away and honestly told how it happened. And it was like this. A friend went to explore the contents of his computer and found several suspicious and “unnecessary” files, in his opinion, in the root of the C:\ drive. He decided to free up space and simply deleted these files. I think that everyone had already guessed that it was boot.ini, ntldr, ntdetect, etc. It wasn’t difficult to correct the situation, except that I had to go to him again.

By the way, in order to get problems with loading Windows XP, it was possible not to erase anything, but to slightly “correct”, for example, boot.ini.

Apparently Microsoft somehow found out about this case and in the next version of its OS decided to hide the bootloader files better.

Features of loading Windows Vista / 7 / 8 operating systems

IN Windows Vista or Windows 7/8 boot manager is called Bootmgr. It reads the list of installed operating systems not from a simple text file, which is boot.ini, but from system storage BCD (Boot Configuration Data), accessed via special utility bcdedit.exe.

But that is not all. Open “Computer Management” -> “Disk Management” >

The standard installation process of the Windows Vista / 7 / 8 operating system creates at the beginning of the disk additional section"Reserved by the system." It is not assigned a drive letter, so unless additional steps are taken, both the partition itself and its contents will be hidden from the user. This main partition has the status “System” and “Active” and, therefore, cannot be deleted either.

In Windows 7, the size of such a partition is 100 MB, of which about 30 MB is occupied; in Windows 8, it is already 350 MB, of which 105 MB is occupied. This difference is explained by the fact that in Windows 8 the “Recovery” folder was moved to this partition.

Let's look at the contents of the "Reserved by the system" section. To do this, assign it a drive letter, for example, “W” in “Disk Management”. Additionally, open “Control Panel” -> “Folder Options” and on the “View” tab uncheck “Hide protected files” system files" and put a check mark on "Show hidden files, folders and disks."

If the system has file manager FAR Manager, then you can use it to view and not have to configure the visibility of hidden files.

This is what the contents of the “System Reserved” section look like in Windows 8 >

As expected, at the root of the partition we see the Bootmgr boot loader.

And this is what part of the contents of the “Boot” folder looks like >

In the folder we find the BCD Boot Configuration Database and its accompanying folders with language and font files.

To complete the picture, it remains to say which partition is called the boot partition. The answer is already shown in the picture with Windows volumes 7. Obviously, this is the partition on which all the main files of the operating system are located.

Well, it’s very easy to remember the names of disk partitions according to the principle “it’s the other way around” - on the system one there is no system (operating system), but there is a third-level bootloader, on the boot one there is no bootloader, but the system itself is located. Naturally, this “memory” only works when there are several sections. If there is only one partition, then it can be system, active and boot at once.

The main task of the 3rd level bootloader, which, depending on the type of OS, is Bootmgr, Ntldr or GRUB, is reading from boot disk and loading the operating system kernel. In addition, in the case of multiple booting, when several operating systems are installed on the computer, the 3rd level boot loader allows you to select the one you need every time you start the computer.

A classic mistake that Microsoft has dedicated to is Windows installation XP after Windows Vista/7/8. Windows Installer XP marks its partition as active, after which, during boot, the MBR transfers control to the PBS of this partition, which, in turn, passes control to Ntldr. Windows boot loader XP knows nothing about more later versions operating rooms Windows systems and loading them becomes impossible. It is quite easy to treat, but this situation can confuse an inexperienced user.

There is practically nothing to add to this and you can proceed directly to editing boot menu. Let's start with .

9 comments

    • Thanks for your feedback. In the near future I plan to continue describing methods for fixing loading errors on specific examples. I know from experience that while you read everything seems to be clear, but when it comes down to it in practice, difficulties begin.

  1. Please tell me how exactly to treat?:
    “The Windows XP loader does not know anything about later versions of Windows operating systems and loading them becomes impossible. It is quite easy to treat, but this situation can confuse an inexperienced user.”

    I installed XP after Vista on the laptop - as a result, the system starts until XP starts loading and everything reboots again, and if you turn off the power adapter (while the OS is loading), then everything boots normally. If you upload to safe mode, then there is no need to disconnect the adapter. What can hit us and how can we fight it?

    PLEASE FOLLOW. THANKS IN ADVANCE. SORRY FOR THE “BROKEN” RUSSIAN.

    • I won’t say anything about the influence of the power adapter on loading XP - I have no specific ideas. Regarding restoring the Vista boot, if this is relevant, then at the end of the post there is a link to the Microsoft support article (919529), which is directly devoted to this topic. To restore you will need installation disk Vista. IN command line With administrator rights you need to run:
      X:\boot\bootsect.exe /nt60 all
      where X: is a letter optical drive.
      But the XP boot will need to be added manually using the editor. The set of commands will be like this:
      Bcdedit /create (ntldr) /d " Microsoft Windows XP"
      If this command fails, then:
      Bcdedit /set (ntldr) description "Microsoft Windows XP"
      Further:
      bcdedit /set (ntldr) device partition=X:
      X: - the drive letter of the partition on which the XP bootloader files are located, and the path to it:
      bcdedit /set (ntldr) path \ntldr
      bcdedit /displayorder (ntldr) /addlast

    I had a laptop, when I loaded and rebooted Windows immediately turned on, but now I purchased desktop computer And loading in progress in three stages. How to do it in order to get rid of these stages. Sorry for the ignorant use of technical terms.

    • Yuri! I'm afraid that the information you provided is clearly not enough to make any recommendations. What Windows and about which ones stages goes speech? Please check.

    Good health, Alexander.
    How to understand, prevent, and if it happens again, how to get out of such a situation correctly.
    Laptop. Windows 7 installed. After turning it on and entering the password, it showed “missing” operating system" - that is, "there is no operating system." Shutdowns with restart gave the same result. It was possible to start only by removing and after some time inserting the battery.
    The day before, however, there was an incorrect shutdown: the flash drive and modem were not turned off first. Previously, such forgetfulness also happened, but there was no such effect.
    I would be grateful for an answer that is accessible to an old “teapot” (I am ten years older than the gentleman in a funny case, but I became acquainted with COMP at about the same age).

    • Vladimir, hello. Happy holidays and all the best.
      In this situation, you did everything right - you reset the “stuck” glitch.
      As the song says: “One drop of rain is not enough rain. One snowflake is not yet snow.” It is possible that nothing like this will ever happen again. Now, if regular problems begin with the launch, then it will be necessary to sort it out. In general, Windows 7 and higher are quite resistant to abnormal shutdowns.
      What to do? You yourself answered your own question - try to turn off devices regularly. And if it is possible to connect via USB external drive, then I would definitely make (in fact, I do quite regularly) a backup of the system, for example using .

The operating system is stored in external memory, usually on a hard disk, less often on a floppy disk. For normal operation of a computer, it is necessary that the main modules of the operating system be in RAM. Therefore, after turning on the computer, the operating system is automatically rewritten (loaded) from the disk into RAM. The most important aspects of this loading are depicted in the form of an algorithm in Fig. 9.13.

Rice. 9.13. Algorithm for loading the operating system from disk into RAM

After turning on the computer, you watch the numbers change on the screen. These numbers reflect the process of testing RAM by the BIOS program. If a fault is detected in the RAM cells, a message will be displayed.

After successfully completing the hardware testing, the drive with floppy disk A is accessed, and the indicator light next to it lights up. If you are loading the operating system from a floppy disk, then before or during testing you must insert the system disk into drive A. Otherwise, if there is no operating system on disk A, the hard disk is accessed, as evidenced by the indicator light next to it.

Reading into the RAM of the 0th sector of the 0th side of the disk in which the bootloader is located (BOOT RECORD) begins. Control is transferred to the bootloader, which checks for the presence of the IO.SYS expansion module and the MSDOS.SYS base module on the system disk. If they are in their designated place (cm. rice. 9.10), then it loads them into RAM, otherwise a message about their absence will be displayed. In this case, it is recommended to re-download. The reboot signal transfers control to the permanent BIOS module, which again writes the boot block from the disk into RAM, etc.

Remember! For reboot the operating system press the keys simultaneously into memory .

After successfully loading the IO.SYS expansion module and the MSDOS.SYS base module into the RAM, the COMMAND.COM command processor is loaded and the CONFIG.SYS configuration file is processed, which contains commands for connecting the necessary drivers. This file may be missing if you are happy with the base version of the operating system.



The batch file AUTOEXEC.BAT is then processed. Using this file you can configure the operating environment parameters. For example, create a virtual disk, change printing modes, load auxiliary programs, etc.

Attention! Files with the .BAT extension play a special role when working in a system environment. They contain a set of operating system commands or executable file names. After running a file with the .BAT extension, all commands written in it are executed automatically one after another.

A file with the standard name AUTOEXEC.BAT differs from other files of the .BAT type in that the execution of commands placed in it begins automatically immediately after the operating system boots.

If the AUTOEXEC.BAT file is missing, you will be prompted to enter the date and time:

if you press the enter key, the so-called system parameters determined by the computer timer will be accepted as the current date and time;

If you want to reset the system date and time, then in response to the prompt, enter the values ​​in one of the provided forms, for example:

10-25-1997 (month day year)

7:30:10.00r (hours:minutes:seconds)

After the AUTOEXEC.BAT file finishes running, and if this file is not found, a system disk prompt will be displayed on the display screen, for example C:\>. This indicates that the boot process has completed normally and you can begin working by entering the application name or operating system command.

Note. The CONFIG.SYS and AUTOEXEC.BAT files may be missing. In this case, the operating environment settings will be set to default.

Remember! The hard drive must permanently store the operating system.

When you turn on the computer, all drives for floppy disks must be open.

Insert floppy disk With application programs into the drive after the download is complete.



TECHNOLOGY OF WORKING IN MS DOS

§ General information about teams

§ Basic Commands for working with catalogs

§ Basic commands for working with files

§ Basic commands for working with disks

§ Creating and Using a Batch File

§ Batch file operating system auto-tuning AUTOEXEC.BAT

§ Configuring the operating system using the CONFIG.SYS configuration file

GENERAL INFORMATION ABOUT TEAMS







2024 gtavrl.ru.