Operating System Swapping and Dynamic Linking
36 Questions
0 Views

Operating System Swapping and Dynamic Linking

Created by
@ShinyNihonium

Questions and Answers

What is the view of a program represented in the diagram?

User's View

What is the purpose of a Segment Table?

To store information about the segments of a process

What is the term for the area of memory that is accessible by a program?

User Space

What is the relationship between a segment and the physical memory space?

<p>A segment is a logical division of the physical memory space</p> Signup and view all the answers

What is the term for a self-contained block of code that performs a specific task?

<p>All of the above</p> Signup and view all the answers

What is an example of a data structure used to store and organize variables?

<p>Array</p> Signup and view all the answers

What is the primary advantage of using dynamic linking?

<p>It is useful for libraries</p> Signup and view all the answers

What is the main purpose of a backing store in swapping?

<p>To accommodate copies of all memory images for all users</p> Signup and view all the answers

What is the term for storing the context or state of a process so that it can be reloaded when execution is resumed?

<p>Context saving</p> Signup and view all the answers

What is the average swap time if the transfer rate of the 10MB file to and from the memory is 40MB/sec and the average latency is 8ms?

<p>516ms</p> Signup and view all the answers

What is the purpose of the 'roll out, roll in' variant in swapping policy?

<p>To differentiate between high and low priority processes</p> Signup and view all the answers

What is the primary benefit of using a fast disk as a backing store?

<p>It reduces the time required for swapping</p> Signup and view all the answers

What is a limitation of flash memory in mobile systems?

<p>Limited number of write cycles</p> Signup and view all the answers

How does iOS handle low memory situations?

<p>Asks apps to voluntarily relinquish allocated memory</p> Signup and view all the answers

What is the purpose of the base register in contiguous memory allocation?

<p>Contains the value of the smallest physical address</p> Signup and view all the answers

What is a characteristic of multiple-partition allocation?

<p>Variable-partition sizes for efficiency</p> Signup and view all the answers

What happens to free partitions in multiple-partition allocation?

<p>Adjacent free partitions are combined</p> Signup and view all the answers

What is an example of static memory allocation?

<p>Declaring variables before runtime</p> Signup and view all the answers

What is the purpose of the limit register in contiguous memory allocation?

<p>Contains the range of logical addresses</p> Signup and view all the answers

Why is swapping not typically used in mobile systems?

<p>Flash memory has a limited number of write cycles</p> Signup and view all the answers

What is the physical memory address of 'b' or logical address 1?

<p>21</p> Signup and view all the answers

What is the purpose of the Translation Look-aside Buffers (TLB) in a paging system?

<p>To reduce the time to access a user memory location</p> Signup and view all the answers

In a paging system, what is the number of bits in the logical address and physical address respectively for a logical address space of 64 pages of 1024 words each, mapped onto a physical memory of 32 frames?

<p>16, 15</p> Signup and view all the answers

What is internal fragmentation in the context of paging?

<p>Unused space within a page</p> Signup and view all the answers

What is the function of the Page-Table Base Register (PTBR)?

<p>To point to the page table</p> Signup and view all the answers

What is the page number and offset for the logical address 9467, given a page size of 1KB?

<p>9, 251</p> Signup and view all the answers

In a paging system, how many memory accesses are required to access data or instructions?

<p>Two</p> Signup and view all the answers

What is the number of pages and excess bytes required for a process of size 58,800 bytes, given a page size of 2,048 bytes?

<p>28, 1,456</p> Signup and view all the answers

What is the purpose of the paging memory-management scheme?

<p>To permit the physical address space of a process to be noncontiguous</p> Signup and view all the answers

What is the size of each frame in paging?

<p>Fixed size, between 512 bytes and 16 Mbytes</p> Signup and view all the answers

How is the physical memory address determined in a paging system?

<p>By combining the base address with the page offset</p> Signup and view all the answers

What is the page table used for in a paging system?

<p>To store the base address of each page in physical memory</p> Signup and view all the answers

What is the purpose of breaking physical memory into frames?

<p>To allow for the allocation of noncontiguous memory</p> Signup and view all the answers

What is the size of the page table in the given example?

<p>2n, where n=2</p> Signup and view all the answers

What is the logical address space in the given example?

<p>2m, where m=4</p> Signup and view all the answers

What is the purpose of the page offset in a paging system?

<p>To combine with the base address to define the physical memory address</p> Signup and view all the answers

Study Notes

Dynamic Linking

  • Uses shared libraries when compiling programs
  • Useful for libraries

Swapping

  • Mechanism where a process is swapped out of memory to a backing store
  • Backing store: fast disk large enough to accommodate copies of all memory images for all users
  • Must provide direct access to these memory images
  • Roll out, roll in: variant in swapping policy
  • Implemented in higher priority and low priority processes

Context Switch Time

  • Involves storing the context or state of a process so that it can be reloaded when execution is resumed
  • Example: transfer rate of a 10MB file to and from memory is 1/4 sec or 250 milliseconds
  • Swap time: 258ms, swapping in and out: 516ms

Swapping on Mobile Systems

  • Not typically supported due to:
    • Flash memory based
    • Small amount of space
    • Limited number of write cycles
    • Poor throughput between flash memory and CPU on mobile platform
  • Instead, use other methods to free memory:
    • iOS asks apps to voluntarily relinquish allocated memory
    • Android terminates apps if low free memory, but first writes application state to flash for fast restart

Contiguous Memory Allocation

  • Memory must accommodate user processes and the operating system
  • 2 partitions of contiguous memory: resident OS and user process
  • Lower memory: where the operating system is located
  • High memory: for user processes
  • Relocation registers used to protect user processes from each other and from changing operating-system code and data
  • Base register contains value of smallest physical address
  • Limit register contains range of logical addresses
  • MMU maps logical address dynamically

Memory Mapping and Protection

  • Hardware support for relocation and limit registers

Multiple Partition Allocation

  • Multiple-partition allocation
  • Degree of multiprogramming is limited by the number of partitions
  • Variable-partition sizes for efficiency (sized to a given process’ needs)
  • Hole: block of available memory; holes of various size are scattered throughout memory
  • When a process arrives, it is allocated memory from a hole large enough to accommodate it
  • Process exiting frees its partition, adjacent free partitions combined
  • Operating system maintains information about:
    • Allocated partitions
    • Free partitions (hole)

Static and Dynamic Memory Allocation

  • Static Memory Allocation: declaring variables before runtime
  • Examples:
    • Main program, procedure, function, method
    • Object, local variables, global variables
    • Common block, stack, symbol table, arrays

Segmentation

  • Logical View of Segmentation:
    • User space
    • Physical memory space
  • Segmentation:
    • Main process
    • Segment table
    • Memory
    • Segment size and address

Paging

  • Memory-management scheme that permits the physical address space of a process to be noncontiguous
  • Avoids external fragmentation
  • Uses frames and pages
  • Breaking physical memory into fixed-sized blocks called frames (size is a power of 2, between 512 bytes and 16 Mbytes)
  • Breaking logical memory into blocks of the same size called pages
  • Keeps track of all free frames

Paging: Address Translation Scheme

  • Division of an address from the CPU:
    • Page number (p) – used as an index into a page table which contains base address of each page in the physical memory
    • Page offset (d) – combined with base address to define the physical memory address that is sent to the memory unit

Paging Hardware

  • Hardware support for Paging

Paging Model of Logical and Physical Memory

  • Example: logical memory has 4-byte page size and physical memory has 32 bytes (8 pages)

Free Frames

  • Implementation of free frames before and after allocation

Page Table - Implementation

  • PTBR (Page-Table Base Register) – points to the page table
  • PTLR (Page Table Length Register) – specifies the size of the page table
  • TLB (Translation Look-aside Buffers) - memory cache used to lessen the time to access a user memory location
  • Also called Associative Memory
  • Two Memory Accesses for data / instructions:
    • Page table
    • Data / instruction

Internal Fragmentation on Paging

  • Example: page size = 2,048 (size = 2n), size of process = 58,800 bytes, no. of pages = 28 and excess bytes = 1,456

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Learn about swapping mechanism in operating systems, including swapping policies and backing store. Also, understand dynamic linking and its application in shared libraries.

More Quizzes Like This

Operating System Types and Platforms
15 questions
Inleiding tot Besturingssystemen
12 questions
Client-Server Architecture
6 questions
Sistemi Operativi: Componenti e Caratteristiche
41 questions
Use Quizgecko on...
Browser
Browser