When a program is to be run it is loaded into memory from the hard disk. Sometimes this is known as loading the program into intermediate access store (IAS). Once the program is loaded into main memory it can be executed. However the program has no idea where in main memory it will be loaded into. This poses a problem if it is trying to access other parts of the memory with static memory addresses. I.e. somewhere in the code it says “read the value from memory address 1000 000. As it could be loaded anywhere in main memory, the loader must update all of these static memory addresses so they point to the correct address. For example, if the loader offsets the program by 2K then it must update all of the static memory addresses. This can be largely solved by relative memory addresses, which will be looked at later in the course.

The loader program, therefore, loads the program into main memory and then changes the static memory addresses by an offset.

The issue becomes more difficult when a multitasking OS is used. This means that, potentially, there could be numerous processes running at any one time. Each process requires memory in order to store not only the program but its data. With multitasking there are two major issues to think about with regards to memory.

  • Security
  • Extra memory

Let's say two processes are running.

Now lets say that word requires an extra 20 MB. Where should it get the memory from? Clearly from what ever is free. But how does word know where that memory exists. It is not aware of other processes running, nor is it aware of what memory they are using. As such to get extra memory there must be some process running which knows which process is running in which memory space. This is the memory manager.

 

Security is also an issue. If a malicious process is running on the PC and it has access to all memory it could start reading sensitive information. For example sensitive information retrieved from a database. The malicious process could then email that data to some hacker. This means that the memory manager must restrict access to other processes memory. That means that no other process can access or overwrite another processes memory space.