G53OPS - Operating Systems

This course is run at the The University of Nottingham within the School of Computer Science & IT. The course is run by Graham Kendall (EMAIL : gxk@cs.nott.ac.uk)

Relocation and Protection

As soon as we introduce multiprogramming we have two problems that we need to address.

Relocation : When a program is run it does not know in advance what location it will be loaded at. Therefore, the program cannot simply generate static addresses (e.g. from jump instructions). Instead, they must be made relative to where the program has been loaded.

Protection : Once you can have two programs in memory at the same time there is a danger that one program can write to the address space of another program. This is obviously dangerous and should be avoided.

In order to cater for relocation we could make the loader modify all the relevant addresses as the binary file is loaded. The OS/360 worked in this way but the scheme suffers from the following problems

· The program cannot be moved, after it has been loaded without going through the same process.
· Using this scheme does not help the protection problem as the program can still generate illegal addresses (maybe by using absolute addressing).
· The program needs to have some sort of map that tells the loader which addresses need to be modified.

A solution, which solves both the relocation and protection problem is to equip the machine with two registers called the base and limit registers.

The base register stores the start address of the partition and the limit register holds the length of the partition. Any address that is generated by the program has the base register added to it. In addition, all addresses are checked to ensure they are within the range of the partition.

An additional benefit of this scheme is that if a program is moved within memory, only its base register needs to be amended. This is obviously a lot quicker than having to modify every address reference within the program.

The IBM PC uses a scheme similar to this, although it does not have a limit register.

Last Page Back to Main Index Next Page



 Last Updated : 23/01/2002