DOC PREVIEW
Chico CSCI 340 - Chapter 8.1 Memory Management

This preview shows page 1-2-15-16-17-32-33 out of 33 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 8.1: Memory ManagementChapter 8: Memory ManagementBackgroundIntroductionBasic HardwareClocks, Executions, and TimingA base and a limit register define a logical address spaceHW address protection with base and limit registersAddress BindingMulti-step Processing of a User ProgramBinding of Instructions and Data to MemoryWhere / When Binding May OccurLogical vs. Physical Address SpaceMemory-Management Unit (MMU)Dynamic Relocation using a Relocation RegisterDynamic LoadingDynamic Loading - moreDynamic LinkingDynamic Linking – moreProcess SwappingSchematic View of SwappingThere are Issues on SwappingSwapping and OverheadIssues on Swapping – 2Contiguous AllocationMemory Mapping and ProtectionMemory AllocationSlide 28Dynamic Storage-Allocation ProblemFragmentation - ExternalFragmentation - InternalSo, what to do about Fragmentation?End of Chapter 8.1Chapter 8.1: Memory ManagementChapter 8.1: Memory Management8.2Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter 8: Memory ManagementChapter 8: Memory ManagementChapter 8.1BackgroundSwapping Contiguous AllocationChapter 8.2PagingChapter 8.3SegmentationSegmentation with Paging8.3Silberschatz, Galvin and Gagne ©2005Operating System ConceptsBackgroundBackgroundWe know that In order to facilitate throughput to support the CPU in executing programs, a program must be brought into memory for it to be runThere are a number of memory management schemes available nowadays and the choice depends on many factors – the most prominent of which are paging and segmentation each of which is very much influenced by a corresponding hardware design necessary to support these management schemes.Each of the major approaches to managing memory requires its own hardware organization and supporting data structures.8.4Silberschatz, Galvin and Gagne ©2005Operating System ConceptsIntroductionIntroductionFact: To keep the CPU executing, a number of processes must be in memory at any given instant.Memory is organized into arrays of words or bytes each of which are directly addressable. (We use hexadecimal addresses)A program counter, in the control unit of the CPU, contains the address of the next instruction to fetch and execute. The execution of an instruction may involve a number of memory fetches – not just the instruction to be fetched and executed, but oftentimes operands that must also be fetched and manipulated.When an instruction is executed, Say Add X to Y, as part of the execution of the instruction, both X and Y must be each fetched. After an instruction is executed, the result must be stored back into memory (at Y).Memory units only see streams of addresses that need to be accessed.We are interested in the continuous sequence of memory addressed that are generated by the running program that require memory accesses.In order to fully appreciate how memory is accessed, we need to start with the hardware, since this will drive how memory is accessed.8.5Silberschatz, Galvin and Gagne ©2005Operating System Concepts Basic HardwareBasic HardwareYour book cites main memory as built into the processor itself. I differ with this view.The CPU does consist of registers and control logic for executing a process. I consider main memory a separate, physical unit. So, …Instructions contains an opcode that indicates the nature of the instruction to be executed, and addresses of data needed to execute the instruction. If an instruction refers to something on, say, disk, then these data must be fetched and moved into primary memory before the data can be directly accessed and processed in the CPU. The CPU clock, and the time it takes to ‘tick’, is referred to as a clock cycle.8.6Silberschatz, Galvin and Gagne ©2005Operating System ConceptsClocks, Executions, and TimingClocks, Executions, and TimingIn the CPU, an instruction can be decoded and many register-type operations can take place within one tick of the clock.So once the data is in the processor, things occur very quickly.But access to main memory, like for ‘values’ of X and Y to add, require a number of clock cycles.We don’t like to delay the CPU, so we normally add a faster layer of memory access between the processor and main memory called cache memory. (We spoke about this in earlier chapters)Also, the operating system must be protected from inadvertent access as well as from the programmer’s address space for the process that is executing. So, whenever an address is ‘developed,’ care must be taken to ensure that the specific memory address desired is not in violation other protected areas.Is the address located within the operating system area? Other areas??This leads us to the concept of Contiguous Allocation and basic and limit registers.8.7Silberschatz, Galvin and Gagne ©2005Operating System ConceptsA base and a limit register define a logical address spaceA base and a limit register define a logical address spaceMemory is arranged with the OS and its associate support found in low memory;User processes share higher memory. Each process has two registers associated with it: one contains the starting address of the process and the second register contains the limit (or range).See figure: all addresses developed during execution that fall between these values are ‘in range’ and ‘addressable.’ These are okayAny addresses outside this range are considered fatal errors and attempting to access such as address results in a trap to the operating system..8.8Silberschatz, Galvin and Gagne ©2005Operating System ConceptsHW address protection with base and limit registersHW address protection with base and limit registersBase and Limit registers are loaded only by the operating system which uses special privileged instructions only available in kernel mode.Since only the operating system can access base and limit registers, this gives the operating system control of users’ memory and user programs.8.9Silberschatz, Galvin and Gagne ©2005Operating System ConceptsAddress BindingAddress BindingPrograms normally reside on disk in executable form, as some kind of .exe file (.exe. .dll, .class. Others…)Program must be brought into memory for it to be runInput queue – collection of processes on the disk that are waiting to be brought into memory to run the programUser programs go through several steps before being run.


View Full Document
Download Chapter 8.1 Memory Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter 8.1 Memory Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter 8.1 Memory Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?