8. 1 Background ●●● ●●●● ●●●●● ●●●● ●●0●● Protection of memory address ●●●● ●●●● Need to o Protect the operating system from access by user processes o Protect the user process from others o Firstly need to make sure that each process has separate memory space o Need to determine the range of legal address of process o Need to ensure that the process can access only these legal addresses
7 8.1 Background ⚫ Protection of memory address ⚫ Need to ⚫ Protect the operating system from access by user processes ⚫ Protect the user process from others ⚫ Firstly need to make sure that each process has separate memory space ⚫ Need to determine the range of legal address of process ⚫ Need to ensure that the process can access only these legal addresses
8. 1 Background ●●● ●●●● ●●●●● ●●●● o a pair of base and limit ●●0●● ▲鱼 0 registers define the operating address space system o The base register hold 256000 the smallest legal process physical memory 300040 address 300040 base ● The limit register process specifies the size of the 420940 120900 range limit o The cPu hardware process compare every address 880000 generated in user mode with the registers 1024000
8 8.1 Background ⚫ A pair of base and limit registers define the address space ⚫ The base register hold the smallest legal physical memory address ⚫ The limit register specifies the size of the range ⚫ The CPU hardware compare every address generated in user mode with the registers
8. 1 Background ●●● ●●●● ●●●●● ●●●● ●●0●● Address binding ●●●0 ●●●● The normal procedure of a process o The processes on the disk that are waiting to be brought into memory for execution form input queue Select one process in the input queue and load the process into memory It accesses instructions and data from memory o As the process terminates, its memory space is declared available
9 8.1 Background ⚫ Address binding ⚫ The normal procedure of a process ⚫ The processes on the disk that are waiting to be brought into memory for execution form input queue ⚫ Select one process in the input queue and load the process into memory ⚫ It accesses instructions and data from memory ⚫ As the process terminates, its memory space is declared available
8. 1 Background ●●● ●●●● ●●●●● ●●●● o Address may be represented in different way.080 ●●●● g Address are generally sym bolic addresses in source program E.g. goto loop1 o A com piler will typically bind these symbolic addresses to re-ocatable addresses E.g. 14: 14 bytes from the beginning of this module The linkage editor or loader will in turn bind the re locatable addresses to absolute addresses 0x00074014 Each bind is a mapping from a address space to another
10 8.1 Background ⚫ Address may be represented in different way E.g. ⚫ Address are generally symbolic addresses in source program ▪ E.g. goto loop1 ⚫ A compiler will typically bind these symbolic addresses to re-locatable addresses ▪ E.g. 14: 14 bytes from the beginning of this module ⚫ The linkage editor or loader will in turn bind the relocatable addresses to absolute addresses ▪ 0x0007 4014 Each bind is a mapping from a address space to another
●●● source ●●●● ●●●●● progre ●●●● ●●0●● ●●●● ●●●● Multi-step Processing of compiler or comple assembler tir Ime a User Program object module other module linkage editor load module time system library loader dynamically loaded system library in-memory execution dynamic binary linking time(run memory time Image
11 Multi-step Processing of a User Program