overlay-feature

Overlay advantages and disadvantages in programs?

Many years ago people were first confronted with programs that were too big to fit in the available memory. The solution to this problem is usually adopted was to split the program into pieces, and they are also called as overlays.

Overlay() would start running first. When it was done, it would call another overlay, the idea of the overlay is to keep only those instructions and data in memory that are needed at the given time.

When other instructions are needed, they are loaded into the space occupied previously by instructions that are no longer needed. Some overlay system was highly complex, allowing multiple overlays in memory at once.

The overlays were kept on the disk and swapped in and out memory by the operating system, dynamically as needed.

As an example, consider a two-pass assembler. during pass1, it constructs a symbol table, then during pass2, it generates machine language code. we may be able3 to partition such an assembler into pass1 code, pass2 code, the symbol table, and common support routines used by both pass1 and pass2.

Assume that the size of these components are as follows-

Pass1 70KB
Pass2 80KB
Symbol table \20KB
Common routines 30KB

We need 200KB of memory to load everything at once. If there is only 150KB available, we can not run over the process. However, notice that pass 1 and pass2 do not need to be in memory at the same time.

We thus define two overlays- overlay A is a symbol table, common routines, and pass1, and overlay B is the symbol table, common routines, and pass2.

Overlay A needs only 120 KB and overlay B needs 130 KB as shown in Fig1 below. we can now run over assembler in the 150KB of memory. It will load somewhat faster because fewer data need to be transferred before execution starts. But, it will run somewhat slower, due to the extra I/O to read the code for overlay B over the code for overlay A.

overlay-content
Overlays

The code for overlay A and overlay B are kept on disk as absolute memory images and are read by the overlay driver as needed. special relocation and linking algorithms are needed to construct the overlays.

The programmer, on the other hand, must design and program the overlay structure properly. This task can be a major undertaking, requiring complete knowledge of the structure of the program, its code, and its data structures.

Since by definition the program is large – small programs do not need to be overlaid -obtaining a sufficient understanding of the program may be difficult. for these reasons, the use of overlay is currently limited to a microcomputer and other systems that have a limited amount of memory.

In the case of any queries, you can write to us at a5theorys@gmail.com we will get back to you ASAP.

Hope! you would have enjoyed this post.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!