COMP 314 - U3C8

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 3 Chapter 8 Background (275) o The CPU fetches instructions from memory according to the value of the program counter. These instructions may cause additional loading from and storing to specific memory addresses. o A typical instruction-execution cycle first fetches an instruction from memory. (276) The instruction is then decoded and may cause operands to be fetched from memory. After the instruction has been executed on the operands, results may be stored back in memory. The memory unit sees only a stream of memory addresses; it does not know how they are generated or what they are for. Accordingly, we can ignore how a program generates a memory address. o Basic Hardware Main memory and the registers built into the processor itself are the only storage that the CPU can access directly. There are machine instructions that take memory address, but not disk address. Therefore, data has to be moved into main memory to be used by the CPU. Registers that are built into the CPU are generally accessible within one cycle of the CPU clock. The CPU can perform operations on the register at the rate of one operation per clock tick, whereas operations to main memory can take several clock ticks. This situation is intolerable because of the frequency of memory accesses. The remedy is to use fast memory between the CPU and main memory – a buffer called the cache . (277) Protection of the physical memory from user processes, and protecting user processes from one another is the job of hardware, which can be implemented in several ways. We first need to make sure that each process has a separate memory space. We must establish ranges of legal addresses for each process. We can provide this protection by using two registers, usually a base and a limit. o The base holds the smallest legal memory address; the limit specifies the size of the range. Protection of memory space is accomplished by having the CPU hardware compare every addresses generated by user mode with the register. Any attempt to access outside the range by a process results in a trap by the OS, which treats the attempts as a fatal error. The base and the limit registers can be loaded only by the OS, which has special privileged instructions – which can only be accessed in kernel mode. This gives access to the OS to make changes to its memory and that of other processes. o Address Binding (278) Usually a program exists as a binary executable. To be executed, the program must be brought into memory and placed within a process. Depending on the memory management involved, a process may be moved between disk and memory during its execution. The processes on the disk that are waiting to be brought into memory for execution
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

COMP 314 - U3C8 - COMP 314 Unit 3 Chapter 8 Background...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online