0% found this document useful (0 votes)
2 views

Memory Management(QA) Week 7

The document explains the concepts of address space and memory space in computer science, differentiating between virtual addresses generated by programs and physical addresses in main memory. It discusses the role of the Memory Management Unit (MMU) in mapping logical addresses to physical addresses, highlighting the importance of this mapping in multiprogramming systems. Additionally, it outlines the differences between logical and physical addresses, emphasizing that users interact with logical addresses while physical addresses are managed by the system.

Uploaded by

mohammed nisath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Memory Management(QA) Week 7

The document explains the concepts of address space and memory space in computer science, differentiating between virtual addresses generated by programs and physical addresses in main memory. It discusses the role of the Memory Management Unit (MMU) in mapping logical addresses to physical addresses, highlighting the importance of this mapping in multiprogramming systems. Additionally, it outlines the differences between logical and physical addresses, emphasizing that users interact with logical addresses while physical addresses are managed by the system.

Uploaded by

mohammed nisath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

HNDIT 3052 Operating Systems

Questions and Answers on address space, logical & physical address, MMU
Question1:
Describe about address space and memory space in Computer Science.
Answer:
An address used by a programmer will be termed as a virtual address and set of such addresses the
address space. An address in main memory is known as a physical address. The set of these locations is
termed as memory space. So address space is set of addresses produced by programs as they reference
instructions and data, memory space comprises actual main memory locations directly addressable for
processing.

Supposes a computer which has a main-memory capacity of 64K words (K=1024). 16-bits are required
to specify a physical address in memory because 64K = 216. Assume that computer has auxiliary memory
for storing information equivalent to capacity of 16 main memories. Let's signify address space by N
and memory space by M we then have for this illustration: N = 16 × 64 K = 1024K and M = 64K.

In a multiprogramming computer system, data and programs are transferred to and from auxiliary
memory and main memory based on demands obliged by CPU. Suppose program 1 is currently being
executed in CPU. Program 1 and a part of its associated data are moved from secondary memory in the
main memory as displayed in Figure below. Parts of programs and data require not being in contiguous
locations in memory because information is being moved in and out and empty spaces may be available
in scattered locations in memory.

(Address and Memory Space in Virtual Memory)

HNDIT 3052 Operating Systems


address field of an instruction code will comprise 20 bits however physical memory addresses should
be specified with just 16-bits. So, CPU will reference data and instructions with a 20 bits address though
information at this address should be taken from physical memory since access to auxiliary storage for
particular words will be prohibitively long. A mapping table is then required as displayed in Figure
below to map a virtual address of 20 bits to a physical address of 16 bits. Mapping is a dynamic operation
that means every address is translated instantly as a word is referenced by CPU.

(Memory table for mapping a virtual table)

Page 2 of 4
Question-02:
Describe the differences between Logical Address and Physical Address.
Answer:

S.No Logical Address Physical Address

Users can access the logical User can never access the physical address of the
1.
address of the Program. Program

The logical address is generated by


2. The physical address is located in the memory unit.
the CPU.

The user can access the physical


A physical address can be accessed by a user
3. address with the help of a logical
indirectly b ut not directly.
address.

The logical address does not exist


On the other hand, the physical address is a location
4. physically in the memory and thus
in the memory. Thus it can be accessed physically.
termed as a Virtual address.

The set of all logical addresses that


The set of all physical addresses corresponding to
are generated by any program is
5. the Logical addresses is commonly known
referred to as Logical Address
as Physical Address Space.
Space.

This address is generated by the It is computed by the Memory Management


6.
CPU. Unit(MMU).

Question-03:
explain the memory management unit (MMU) in OS with aid of suitable
example.
Answer:
Memory Management Unit(MMU) in OS
It is a hardware device that does the run-time mapping from the virtual address to the physical address.
It is located within the Central Processing Unit.

Let us understand the concept of mapping with the help of a simple MMU scheme and that is a base-
register scheme.

Page 3 of 4
In the above diagram, the base register is termed the Relocation register. The relocation register is a
special register in the CPU and is used for the mapping of logical addresses used by a program to
physical addresses of the system's main memory.

The value in the relocation register is added to every address that is generated by the user process at the
time when the address is sent to the memory.

MMU Example
Suppose the base is at 14000, then an attempt by the user to address location 0 is relocated dynamically
to 14000; thus access to location 356 is mapped to 14356.

It is important to note that the user program never sees the real physical addresses. The Program can
create a pointer to location 356 and store it in the memory and then manipulate it after that compare it
with other addresses as number 356.

User program always deals with the logical addresses. The Memory Mapping unit mainly converts the
logical addresses into the physical addresses. The final location of the referenced memory address is not
determined until the reference is made.

There are two types of addresses that we have:

logical addresses (lies in the range 0 to max).

physical addresses (lies in the range R+0 to R+max for the base value R)

As we have told you above the user generates only a logical address and then thinks that the process
runs in locations 0 to max. However, these logical addresses must be mapped to physical addresses
before they are used.

Page 4 of 4

You might also like