DOC PREVIEW
CORNELL CS 4410 - Main Memory

This preview shows page 1-2-3-4-26-27-28-53-54-55-56 out of 56 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 56 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 56 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 56 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 56 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 56 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 56 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 56 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 56 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 56 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 56 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 56 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 56 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Main MemoryAnnouncementsGoals for TodayVirtualizing ResourcesRecall: Single and Multithreaded ProcessesImportant Aspects of Memory MultiplexingBinding of Instructions and Data to MemoryMulti-step Processing of a Program for ExecutionRecall: UniprogrammingMultiprogramming (First Version)Multiprogramming (Version with Protection)Base and Limit RegistersMultiprogramming (Translation and Protection v. 2)Memory BackgroundMemory-Management Unit (MMU)Dynamic relocation using a relocation registerDynamic LoadingDynamic LinkingSwappingContiguous AllocationMemory protection with base and limit registersContiguous Allocation (Cont.)Dynamic Storage-Allocation ProblemFragmentationPagingPaging - overviewAddress Translation SchemePaging HardwarePaging Model of Logical and Physical MemoryPaging ExampleFree FramesImplementation of Page TableTranslation look-aside buffers (TLBs)Paging Hardware With TLBEffective Access TimeMemory ProtectionShared PagesShared Pages ExampleStructure of the Page TableHierarchical Page TablesTwo-Level Page-Table SchemeTwo-Level Paging ExampleAddress-Translation SchemeHashed Page TablesHashed Page TableInverted Page TableInverted Page Table ArchitectureSegmentationUser’s View of a ProgramSlide 50Segmentation ArchitectureSegmentation Architecture (Cont.)Segmentation HardwareSegmentation ExampleSegmentation and PagingSummaryMain MemoryAnnouncements•Homework 3 is available via the website–It is due Wednesday, October 3rd–Make sure to look at the lecture schedule to keep up with due dates!Goals for Today•Protection: Address Spaces–What is an Address Space?–How is it Implemented?•Address Translation Schemes–Segmentation–Paging–Multi-level translation–Paged page tables–Hashed page tables–Inverted page tablesVirtualizing Resources•Physical Reality: Different Processes/Threads share the same hardware–Need to multiplex CPU (finished earlier: scheduling)–Need to multiplex use of Memory (Today)–Need to multiplex disk and devices (later in term)•Why worry about memory sharing?–The complete working state of a process and/or kernel is defined by its data in memory (and registers)–Probably don’t want different threads to even have access to each other’s memory (protection)Recall: Single and Multithreaded Processes•Threads encapsulate concurrency–“Active” component of a process•Address spaces encapsulate protection–E.g. Keeps buggy program from trashing the systemImportant Aspects of Memory Multiplexing•Controlled overlap:–Separate state of processes should not collide in physical memory. •Obviously, unexpected overlap causes chaos!–Conversely, would like the ability to overlap when desired•for communication•Translation: –Ability to translate accesses from one address space (virtual) to a different one (physical)–When translation exists, processor uses virtual addresses, physical memory uses physical addresses–Side effects:•Can be used to avoid overlap•Can be used to give uniform view of memory to programs•Protection:–Prevent access to private memory of other processes•Programs protected from each other themselves •Kernel data protected from User programsBinding of Instructions and Data to Memory•Binding of instructions and data to addresses:–Choose addresses for instructions and data from the standpoint of the processor–Could we place data1, start, and/or checkit at different addresses? •Yes•When? Compile time/Load time/Execution timedata1: dw 32…start: lw r1,0(data1)jal checkitloop: addi r1, r1, -1bnz r1, r0, loop…checkit: …0x300 00000020 … …0x900 8C2000C00x904 0C0003400x908 2021FFFF0x90C 1420FFFF …0xD00 …Multi-step Processing of a Program for Execution•Preparation of a program for execution involves components at–Compile time (i.e. “gcc”)–Link/Load time (unix “ld” does link)–Execution time (e.g. dynamic libs)•Addresses can be bound to final values anywhere in this path–Depends on hardware support –Also depends on operating system•Dynamic Libraries–Linking postponed until execution–Small piece of code, stub, used to locate the appropriate memory-resident library routine–Stub replaces itself with the address of the routine, and executes routineRecall: Uniprogramming•Uniprogramming (no Translation or Protection)–Application always runs at same place in physical memory since only one application at a time–Application can access any physical address–Application given illusion of dedicated machine by giving it reality of a dedicated machine•Of course, this doesn’t help us with multithreading0x000000000xFFFFFFFFApplicationOperatingSystemValid 32-bitAddressesMultiprogramming (First Version)•Multiprogramming without Translation or Protection–Must somehow prevent address overlap between threads–Trick: Use Loader/Linker: Adjust addresses while program loaded into memory (loads, stores, jumps)•Everything adjusted to memory location of program•Translation done by a linker-loader•Was pretty common in early days•With this solution, no protection–bugs in any program can cause other programs to crash or even the OS0x000000000xFFFFFFFFApplication1OperatingSystemApplication20x00020000Multiprogramming (Version with Protection)•Can we protect programs from each other without translation?–Yes: use two special registers base and limit to prevent user from straying outside designated area•If user tries to access an illegal address, cause an error–During switch, kernel loads new base/limit from TCB•User not allowed to change base/limit registers0x000000000xFFFFFFFFApplication1OperatingSystemApplication20x00020000Base=0x20000Limit=0x10000Base and Limit Registers•A pair of base and limit registers define the logical address spaceMultiprogramming (Translation and Protection v. 2) •Problem: Run multiple applications in such a way that they are protected from one another•Goals: –Isolate processes and kernel from one another–Allow flexible translation that:•Doesn’t lead to fragmentation•Allows easy sharing between processes•Allows only part of process to be resident in physical memory•(Some of the required) Hardware Mechanisms:–General Address Translation•Flexible: Can fit physical chunks of memory into arbitrary places in users address space•Not limited to small number of segments•Think of this as providing a large number (thousands) of fixed-sized segments (called “pages”)–Dual Mode


View Full Document

CORNELL CS 4410 - Main Memory

Download Main Memory
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 Main Memory 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 Main Memory 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?