Main Management

24 important questions on Main Management

The CPU has access to 2 types of storage - what are they?

  1. Registers - quicker than main memory (access in one clock cycle or less)
  2. Main memory - slower because it is done through a bus, which can cause a stall - to deal with this, caches are used (which are normally on the same chip as the CPU)

What are base and limit registers?

A pair of base and limit registers define the logical address space

The CPU must check every memory access generated in user mode to be sure its between base and limit for that user

What is the limit register?

It contains a range of logical addresses
- each logical address must be less than the limit register
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

What loads the base and limit registers?

The base and the limit registers can only be loaded by the OS
= this operation is done in the kernel mode so the user cannot interact with it directly

What is the algorithm for the hardware access protection mechanism?

- the CPU receives the instruction to access a given address in memory
- if the address is greater than or equal to the base address of the process, it will continue (if it is not, the OS will raise a fatal error)
- it will then check if it is smaller than the base and the limit. If yes, access to the memory is granted. If no, the OS will raise a fatal error

What is the difference between logical address and the physical address?

  • Physical address - an array of bytes with different addresses. The address seen by the memory unity

  • Logical address (virtual address)  - where an item appears to reside from the perspective of an executing application program. It is generated by the CPU

A logical address is mapped to a physical address

When can the binding of instructions and data to memory addresses be done?

Can happen at 3 stages:
  1. Compile time -> the translation of logical addresses to physical addresses at the time of compilation. This type of binding is only possible when we know the contents of the memory in advance
  2. Load time -> the translation of logical addresses to physical addresses at the time of loading. Must generate relocatable code if memory location is not known at compile time
  3. Execution time -> happens in modern processors where multiprogramming is supported - binding delayed until run time if the process can be moved during its execution from one memory segment to another. This is supported by hardware

What is the memory management unit (MMU)?

A piece of hardware that maps virtual address to physical addresses at runtime

How does the MMU map virtual address to physical addresses?

The simplest method is to add the value stored to in the relocation register to the original logical address defined by the user process

The base register is now called the relocation register 

This binding happens at execution time when a reference is made to a specific location in memory

What is dynamic relocation (dynamic loading)?

A routine is not loaded until it is called (if it is not called it stays on the disk)
- this allows better memory-space utilisation

This is especially useful when large amounts of code are needed to handle infrequently occurring cases

- no special support from the OS is required -> though the OS can help by providing libraries to implement dynamic loading

What is the backing store





  • fast disk large enough to accommodate copies of all memory images for all users; must provide direct access to these memory images

Why is swapping not used in modern systems? What do these systems use now?

It is time consuming

The systems now use modified versions of swapping




  • ●  Swapping normally disabled
  • ●  Started if more than threshold amount of memory allocated
  • ●  Disabled again once memory demand reduced below threshold

What is contiguous memory allocation?

An early method

Each process is contained in one single block
The main memory is usually divided into tow partitions:
- OS system code
- User code

Why do we need memory protection?

There are many processes running and we want to prevent processes accessing memory that is not meant for them

-> relocation registers are used to prevent this

What is multiple-partition allocation?

Degree of multiprogramming limited by number of partitions

What was multiple-partition allocation replaced by?

Variable partition- the partitions are sized to a given processes's needs
i.e. if it needs more memory, it will be given a bigger partition

  • Hole - block of available memory (basically and empty partition)
- When a process arrives, it is allocated memory from a hole large enough to accommodate it 

- If the processor is too big, then the system will skip it and move onto the next process which can hopefully fill the hole

OS maintains information about the allocated partitions and the free ones

What are 3 techniques to allocate free holes to processes?





First-fit: Allocate the first hole that is big enough





Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size
● Produces the smallest leftover hole






Worst-fit: Allocate the largest hole; must also search entire list
● Produces the largest leftover hole






---> First-fit and best-fit better than worst-fit in terms of speed and storage utilisation

What is external fragmentation?





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

i.e. the hole fragments are not contiguous so the process cannot fit it  

What is internal fragmentation?





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


It is called internal fragmentation because it involves memory that is not used which is internal to a specific partition

How can we reduce external fragmentation?

Compaction- gather all the occupied memory blocks in one large block and put all available memory spaces (holes) at the end





Compaction is possible only if relocation is dynamic, and is done at execution time
- because when you do it at execution time, you just change the base address of the processes in the base register. When the CPU accesses the process, it will have the new address dynamically

What is non-contiguous allocation?





Allows a process to acquire the several memory blocks at the different location in the memory according to its requirement





This reduces the memory wastage caused due to internal and external fragmentation




  • Paging and segmentation are the two ways which allow a process’s physical address space to be non-contiguous.

How does segmentation work at the hardware level?

- the system receives a tuple (segment number and offset)
- using the segment table, we will first check whether the segment exists and see whether the offset is less than the limit. If yes, the mapping between the logical and physical address will be obtained by adding the offset to the base. This will obtained the physical address in memory. If the offset is bigger than the limit, an error will be raised

For paging, what is the address translation scheme?





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

How does paging hardware work?

- the CPU generates logical address with the page number and the offset
- the page table will be used to extract the frame number
- the logical address is translated to the physical address through info in the page table

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo