COSC 3360 - Quiz 3 (Memory Management, 7 & Virtual Memory, 7)

Ace your homework & exams now with Quizwiz!

Overlaying

Allows various modules to be assigned to the same region of memory but it is time consuming to program.

Optimal Policy

Policy in which the OS selects the page for which the time to the next reference is the longest. Produces three page faults after the frame allocation has been filled.

Resident Set Sizes

- Fixed-allocation - Variable-allocation

Page Number

Page number portion of virtual address.

Precleaning

allows the writing of pages in batches

Unequal Size Partioning

+ Large programs can be accommodated without overlays + Small partitions can be accommodated less internal fragmentation - Limits number of active processes in the system - Small jobs will not utilize partition space efficiently

Fixed Partitioning

+ Operating system can swap out a process if all partitions are full and no process is in the Ready or Running state - Program may be too big to fit in a partition. - Main memory utilization is inefficient. - Internal fragmentation (program, regardless of size, occupies an entire partition)

Dynamic Partioning

+ Partitions of variable length and number + Partitions allocated exactly as much memory as it requires - External fragmentation as time goes on - Uses compaction to combat external fragmentation, but is time consuming and wastes CPU time

Page Size

+ The smaller the page size, the lesser the amount of internal fragmentation. - More pages required per process - More pages means larger page tables - Large programs in heavily multiprogrammed environment, portion of page tables of active processes must be in virtual memory instead of main memory Physical characteristics for most secondary devices favor a larger page size for more efficient block transfer of data.

The variable-interval sampled working set algorithm (VSWS) is driven by three parameters:

- (M) Minimum duration of the sampling interval - (L) Maximum duration of the sampling interval - (Q) Number of page faults that are allowed to occur between sampling instances

Support Needed For Virtual Memory

- Hardware must support paging and segmentation - Operating system must include software for managing the movement of pages and/or segments between memory and main memory

With large caches, replacements of pages can have a performance impact. Such examples are:

- If page frame selected is in the cache, that cache block is lost as well as the page it holds. In systems using page buffering, cache performance can be improved with a policy for page placement in the page buffer. Most OS's place pages by selecting an arbitrary page frame from the buffer

Page Size Design Issues

- Issue is related to the size of physical main memory and program size - Main memory and address space used by applications is growing - Personal computer applications are becoming increasingly complex

Process Suspension If degree of multiprogramming is reduced, one or more of the currently resident processes must be swapped out. The six possilibities are:

- Lowest-priority process - Faulting process - Last process activated - Process with smallest resident set - Largest process - Process with the largest remaining execution window

Memory Partioning

- Obsolete - Does not involve virtual memory

Each virtual memory reference can cause two physical memory accesses:

- One to fetch the page table entry - One to fetch the data

These are the basic algorithms used for the selection of a page to replace:

- Optimal - Least recently used (LRU) - First-in-first-out (FIFO) - Clock

Inverted Page Table Components

- Page number - Process identifier - Control bits - Chain pointer

Protection and Sharing

- Segmentation lends itself to the implementation of protection and sharing policies - Each entry has a base address and length so inadvertent memory access can be controlled - Sharing can be achieved by segments referencing multiple processes

Design of the memory management portion of an operating system depends on three fundamental areas of choice:

- Whether or not to use virtual memory techniques - The use of paging or segmentation or both - The algorithms employed for various aspects of memory management

Placement Algorithms

1) Best-Fit: chooses the block that is closest in size to the request. 2) First-Fit: begins to scan memory from the beginning and chooses the first available block that is large enough. 3) Next-Fit: Begins to scan memory from the location of the last placement, and chooses teh next available block that is large enough. 4) Worst-Fit - finds the biggest memory location, hopefully leaving big fragments.

Characteristics of Paging and Segmentation

1. All memory references within a process are logical addresses that are dynamically translated into physical addresses at run time. 2. A process may be broken up into a number of pieces (pages or segments) and these pieces need not be contiguously located in main memory during execution.

Load Control

A control method that is concerned with determining the number of of processes that will be resident in main memory (multiprogramming level). Critical in effective memory management. If there are too few processes, then there will be many processes that will be blocked and too much time will be spent swapping, resulting in thrashing.

Page

A fixed-length block of data that resides in secondary memory (such as disk). A page of data may temporarily be copied into a frame of main memory.

Thrashing

A condition of excessive paging in which the operating system becomes sluggish. A state in which the system spends most of its time swapping process pieces rather than executing instructions.

Least Recently Used (LRU)

A policy in which a page is replaced if it has not been referenced for the longest time. By principle of locality, this should be the page least likely to be referenced in the near future. Difficult to implement. Approach is to tag each page with time of last reference and requires a great deal of overhead.

Fetch Policy

A policy that determines when a page should be brought into main memory. Two common alternatives types: demand paging and prepaging.

Logical Address

A reference to a memory location independent of the current assignment of data to memory. A translation must be made to a physical address before the memory access can be achieved.

Translation Lookaside Buffer (TLB)

A special high-speed cache for page table entries. Functions just like a memory cache and contains the page table entries that have been most recently used. Overcomes the effect of doubling the memory access time.

Segment

A variable-length block of data that resides in secondary memory. An entire segment may temporarily be copied into an available region of main memory (segmentation) or the segment may be divided into pages which can be individually copied into main memory (combined segmentation and paging).

Physical or Absolute Address

Actual location in main memory.

Relative Address

Address is expressed as a location relative to some point.

Virtual Address

An address that corresponds to a location in virtual space and is translated by address mapping to a physical address when memory is accessed.

Variable-interval Sampled Working Set Algorithm (VSWS)

An algorithm that evaluates the working set of a process at sampling instances based on elapsed virtual time.

Page Fault Frequency Algorithm (PFF)

An algorithm that requires a use bit to be associated with each page in memory. Bit is set to 1 when that page is accessed. When a page fault occurs, the OS notes the virtual time since the last page fault for that process. Does not perform well during the transient periods when there is a shift to a new locality.

Variable Allocation, Global Scope

An allocation policy. Easiest to implement and adopted in a number of OS's. OS maintains a list of free frames. Free frames is added to resident set of processes when a page fault occurs. If no frames are available, the OS must choose a page currently in memory. One way to counter potential problems is to use page buffering.

Fixed Allocation, Local Scope

An allocation policy. Necessary to decide ahead of time the amount of allocation to give a process. If the allocation is too small, there will be a high page fault. If the allocation is too large, there will be too few programs in main memory which increases processor idle time and time spent in swapping.

Variable Allocation, Local Scope

An allocation policy. When a new process is loaded into main memory, allocate certain number of page frames as its resident set. When a page fault occurs, select the page to replace from among the resident set of the process that suffers the fault. Reevaluate the allocation provided to the process and increase or decrease it to improve overall performance. The decision is based on the assessment of the likely future demands of active processes (criteria used to determine resident set size & timing of changes).

Page Fault

An event that occurs when an accessed page is not present in main memory.

Demand Paging

An extension to paged memory management in which pages are brought into memory only when referenced (on demand). Only brings pages into main memory when a reference is made on the page. Many page faults when process is first started. Page faults will drop to a low level as time goes on.

Prepaging

Bringing in all the initial pages, to prevent the high amount of page faults in the beginning. Pages other than the one demanded by a page fault are brought in. Exploits characteristics of most secondary memory devices. If pages of process are stored contiguously in secondary memory, it is more efficient to bring in bulk of pages. Ineffective if extra pages are referenced. Should not be confused with "swapping"

Local Replacement Scope

Chooses only among the resident pages of the process that generated the page fault. Activated by a page fault when there are no free page frames.

Buddy System

Compromised of fixed and dynamic partitioning. Essentially, divide blocks of memory by two until optimal block size has been reached.

Physical Organization

Computer memory is organized into at least two levels: main memory and secondary memory. If the user flow of data between the two levels, these are the following disadvantages: 1. Main memory available for the program plus its data may be insufficient. The programmer must use overlaying (waste of time). 2. The programmer does not know how much space will be available or where it would be.

Global Replacement Scope

Considers all unlocked pages in main memory as candidates for replacement. Activated by a page fault when there are no free page frames.

Replacement Policy

Deals with the selection of a page in main memory to be replaced when a new page must be brought in Objective is that the page that is removed be the page least likely to be referenced in the near future. The more elaborate the replacement policy, the greater the hardware and software overhead to be able to implement it.

Placement Policy

Determines where in real memory a process piece is to reside Important design issue in a segmentation system Paging or combined paging with segmentation is irrelevant because hardware performs functions with equal efficiency.

Segment Organization

Each segment table entry contains the starting address of the corresponding segment in main memory and length of the segment. A bit is needed to determine if the segment is in main memory. Another bit is needed to determine if the segment has been modified since it was loaded in main memory.

The order (from highest to lowest amount of page faults) of the following algorithms (OPT, CLOCK, FIFO, LRU) is:

FIFO > CLOCK > LRU > OPT

Combined Paging and Segmentation

In this system, a user's address space is broken up into a number of segments. Each segment is broken up into a number of fixed-sized pages which are equal in length to a main memory frame. - Segmentation is visible to the programmer. - Paging is transparent to the programmer.

Control Bits

Includes flags, such as valid, referenced, and modified. Used for protection and locking information.

Page Buffering

Keeping a set of free frames available so that a page may be written into them before a victim frame is written out and added to the pool. Improves paging performance and allows the use of a simpler page replacement policy. Replaced page is not lost but rather assigned to one of two lists: - Free page list - Modified page list

Free Page List

List of page frames available for reading in pages.

Logical Organization

Memory is organized linearly. Programs are written in modules. - Modules can be written and compiled independently - Different degrees of protection given to modules - Sharing on module level corresponds to user's way of viewing the problem Segmentation is the tool that readily satisfies requirements

Implications of Processes

More processes may be maintained in main memory (room for more processes, efficient utilization of processor since more processes will be in a Ready state) Process may be larger than all of main memory

Execution of a Process

Operating system brings into main memory few pieces of the program at a time Interrupt generated when an address is needed that is not in main memory Operating system places process in a blocking state Piece of process that contains logical address is brought into main memory OS issues disk I/O Read request Process dispatched to run while disk I/O takes place Interrupt issued when disk I/O is complete, OS place affected process in Ready state

Inverted Page Table

Page table which has one entry for each frame of memory. Entries consist of the virtual address of the page stored in the frame. Indexes page table table entries by frame number rather than by virtual page number. Page number portion of a virtual address is mapped into a hash value (hash value points to inverted page table).

Modified Page List

Pages are written out in clusters.

Cleaning Policy

Policy concerned with determining when a modified page should be written out to secondary memory. Opposite of fetch policy - determines when a modified page should be written back to disk. Two common alternatives are demand cleaning and precleaning.

First-In, First-Out (FIFO)

Policy in which page frames are allocated to a process as a circular buffer. Pages are removed in round-robin style. This policy is simple to implement. Page that has been in memory the longest is replaced.

Principle of Locality

Principle in which program and data references are clustered. Only few pieces of a process will be needed over a short period of time and thus possible to make intelligent guesses about which pieces will be needed in the future. This in turn will avoid thrashing.

Memory Management Requirements

Relocation Protection Sharing Logical organization Physical organization

Clock Policy

Requires the association of an additional bit with each frame. This bit is referred to as the use bit. When a page is first loaded in memory or referenced the use bit is set to 1. The set frames is considered to be a circular buffer. Any frame with a use bit of 1 is passed over by the algorithm. Page frames visualized as laid out in a circle.

Virtual Memory

Space on a hard disk or other storage device that simulates random access memory. Allows for effective multiprogramming and relives user of tight constraints of main memory.

Compaction

Technique for overcoming external fragmentation. OS shifts process so that they are contiguous and free memory is together in one block. However, this is time consuming and wastes CPU time.

Segmentation

Technique that eliminates internal fragmentation by subdividing a user program to which the program and its associated data are divided into a number of segments. + Simplifies handling of growing data structures + Allows program to be altered and recompiled + Lends itself to sharing data among processes + Lends itself to protection

Page Table

The OS maintains a __________ for each process that shows the frame location for each page of the process.

Associative Mapping

The TLB only contains some of the page table entries so we cannot simply index into the TLB based on page number. Each TLB entry must include the page number as well as the complete page table entry. The processor is equipped with hardware that allows it to interrogate simultaneously a number of TLB entries determine if there is a match on page number.

Real Address

The address of a storage location in main memory.

Resident Set

The portion of a process that is actually in main memory at any time

Process Identifier

The process that owns this page. Combination of number and process identifier identify a page within the virtual address space of a particular process.

Address Space

The range of memory addresses available to a process.

Paging

The technique of swapping items between memory and storage. Each process has its own page table which contains the frame number of the corresponding page in main memory.

Virtual Address Space

The virtual storage assigned to a process.

Policies for Virtual Memory

These policies are in place to improve performance and minimize page faults. - Fetch Policy - Placement Policy - Replacement Policy - Resident Set Management - Cleaning Policy - Load Control

Chain Pointer

This field is null if there are no chained entries for this entry. Otherwise, field contains the index value of the next entry in the chain.

Frame Locking

When a frame is locked the page currently stored in that frame may not be replaced. Kernel of the OS as well as key control structures are held in locked frames. I/O buffers and time critical areas may be locked into main memory frames. Locking is achieved by associating a lock bit with each frame.

Demand Cleaning

a page is written out to secondary memory only when it has been selected for replacement

Internal Fragmentation

allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used

Variable-allocation Policy

allows the number of frames allocated to a process to vary over the lifetime of the process

Page Frame

an individual section of main memory of uniform size into which a single page may be loaded without causing external fragmentation

Fixed-allocation Policy

give a process a fixed number of frames in main memory

Real Memory

main memory, the actual RAM

External Fragmentation

total memory space exists to satisfy a request, but it is not contiguous


Related study sets

Sample NCLEX Style Questions: LVN - RN Transition Midterm

View Set

Astronomy Chapter 4 (Motion, Energy, Gravity)

View Set

Module 6: Statistics - Measures of Central Tendency and/or Location

View Set

Basic Networking and Communications

View Set

Integumentary Pre-Lab/Tissue Review

View Set