SlideShare a Scribd company logo
1 of 40
Virtual Memory ,Direct memoryVirtual Memory ,Direct memory
addressing and indirect memoryaddressing and indirect memory
addressingaddressing
MADE BY:MADE BY:
KASHISH-13ITU013KASHISH-13ITU013
PRAPTI SETHI-13ITU028PRAPTI SETHI-13ITU028
RITIKA MEHANDIRATTA-13ITU029RITIKA MEHANDIRATTA-13ITU029
SHIVAM NAGPAL-13ITU038SHIVAM NAGPAL-13ITU038
SHUBHAM CHOUDHARY-13ITU039SHUBHAM CHOUDHARY-13ITU039
SMARTH BAJAJ-13ITU040SMARTH BAJAJ-13ITU040
SONALI GUPTA -13ITU043SONALI GUPTA -13ITU043
SURBHI GROVER-13ITU044SURBHI GROVER-13ITU044
FANTASTIC 8FANTASTIC 8
Topics coveredTopics covered
 Virtual memoryVirtual memory
 Direct memory access (DMA)Direct memory access (DMA)
 Indirect memory accessIndirect memory access
 Addressing ModesAddressing Modes
1.1. ImmediateImmediate
2.2. DirectDirect
3.3. IndirectIndirect
4.4. RegisterRegister
5.5. Register IndirectRegister Indirect
6.6. Displacement (Indexed)Displacement (Indexed)
INTRODUCTIONINTRODUCTION
 In computing, In computing, virtual memoryvirtual memory
is a memory managementis a memory management
technique that is implementedtechnique that is implemented
using both hardware andusing both hardware and
software. It maps memorysoftware. It maps memory
addresses used by aaddresses used by a
program, called program, called virtualvirtual
addressesaddresses, into, intophysicalphysical
addressesaddresses in computer in computer
memory. memory. 
 Direct memory access (DMADirect memory access (DMA) is) is
a feature of computerizeda feature of computerized
systems that allows certainsystems that allows certain
hardware subsystems tohardware subsystems to
access main systemaccess main system
memory independently ofmemory independently of
the central processingthe central processing
unit (CPU).unit (CPU).
INDIRECT ADDRESSINGINDIRECT ADDRESSING
 An address in a computer instruction that indicates a location where An address in a computer instruction that indicates a location where 
the address of the referenced operand is to be found. Alsoknown asthe address of the referenced operand is to be found. Alsoknown as
multilevel address.multilevel address.
MemoryMemory
register
CPU cache
Main Memory
Secondary Storage
Server (or INTERNET)
• larger capacity
• lower speed
• lower cost
What isWhat is……
 Virtual memory as an alternate set ofVirtual memory as an alternate set of
memory addresses.memory addresses.
 Programs use these virtual addressesPrograms use these virtual addresses
rather than real addresses to storerather than real addresses to store
instructions and data.instructions and data.
 When the program is actually executed,When the program is actually executed,
the virtual addresses are converted intothe virtual addresses are converted into
real memory addresses.real memory addresses.
Why is it neededWhy is it needed……..
 Before the development of the virtual memoryBefore the development of the virtual memory
technique, programmers had to manage directlytechnique, programmers had to manage directly
two-level storage such as main memory or ramtwo-level storage such as main memory or ram
and secondary memory in the form of hard disksand secondary memory in the form of hard disks
or earlier, magnetic drums.or earlier, magnetic drums.
 Enlarge the address space, the set of addressesEnlarge the address space, the set of addresses
a program can utilize.a program can utilize.
 Virtual memory might contain twice as manyVirtual memory might contain twice as many
addresses as main memory.addresses as main memory.
ObjectObject……
 When a computer is executing many programsWhen a computer is executing many programs
at the same time, Virtual memory make theat the same time, Virtual memory make the
computer to share memory efficiently.computer to share memory efficiently.
 Eliminate a restriction that a computer works inEliminate a restriction that a computer works in
memory which is small and be limited.memory which is small and be limited.
 When many programs is running at the sameWhen many programs is running at the same
time, by distributing each suitable memory areatime, by distributing each suitable memory area
to each program, VM protect programs toto each program, VM protect programs to
interfere each other in each memory area.interfere each other in each memory area.
How does it workHow does it work……
 To facilitate copying virtual memory into realTo facilitate copying virtual memory into real
memory, the operating system divides virtualmemory, the operating system divides virtual
memory into pages, each of which contains amemory into pages, each of which contains a
fixed number of addresses.fixed number of addresses.
 Each page is stored on a disk until it is needed.Each page is stored on a disk until it is needed.
 When the page is needed, the operating systemWhen the page is needed, the operating system
copies it from disk to main memory, translatingcopies it from disk to main memory, translating
the virtual addresses into real addresses.the virtual addresses into real addresses.
Virtual MemoryVirtual Memory
 Use main memory as a “cache” for secondary memoryUse main memory as a “cache” for secondary memory
 Allows efficient and safe sharing of memory among multipleAllows efficient and safe sharing of memory among multiple
programs.programs.
 Provides the ability to easily run programs larger than the size ofProvides the ability to easily run programs larger than the size of
physical memoryphysical memory
 Simplifies loading a program for execution by providing for codeSimplifies loading a program for execution by providing for code
relocation (i.e., the code can be loaded anywhere in main memory)relocation (i.e., the code can be loaded anywhere in main memory)
 What makes it work? – again the Principle of LocalityWhat makes it work? – again the Principle of Locality
 A program is likely to access a relatively small portion of its addressA program is likely to access a relatively small portion of its address
space during any period of timespace during any period of time
 Each program is compiled into its own address space – a “virtual”Each program is compiled into its own address space – a “virtual”
address spaceaddress space
 During run-time eachDuring run-time each virtualvirtual address must be translated to aaddress must be translated to a
physicalphysical address (an address in main memory)address (an address in main memory)
MMU (Memory ManagementMMU (Memory Management
Unit)Unit)
 The hardware base that makes a virtual memory systemThe hardware base that makes a virtual memory system
possible.possible.
 Allows software to reference physical memory by virtualAllows software to reference physical memory by virtual
addresses, quite often more than one.addresses, quite often more than one.
 It accomplishes this through the use of page and pageIt accomplishes this through the use of page and page
tables.tables.
 Use a section of memory to translate virtual addressesUse a section of memory to translate virtual addresses
into physical addresses via a series of table lookups.into physical addresses via a series of table lookups.
 The software that handles the page fault is generally partThe software that handles the page fault is generally part
of an operating system and the hardware that detectsof an operating system and the hardware that detects
this situation.this situation.
Segmentation... & paging...Segmentation... & paging...
 Segmentation involves the relocation of variable sizedSegmentation involves the relocation of variable sized
segments into the physical address space.segments into the physical address space.
 Generally these segments are contiguous units, and areGenerally these segments are contiguous units, and are
referred to in programs by their segment number and anreferred to in programs by their segment number and an
offset to the requested data.offset to the requested data.
 A technique used by virtual memory operating systemsA technique used by virtual memory operating systems
to help ensure that the data you need is available asto help ensure that the data you need is available as
quickly as possible.quickly as possible.
 Instead of utilizing a segment/offset addressingInstead of utilizing a segment/offset addressing
approach, as seen in segmentation, paging uses a linearapproach, as seen in segmentation, paging uses a linear
sequence of virtual addresses which are mapped tosequence of virtual addresses which are mapped to
physical memory as necessary.physical memory as necessary.
 Due to this addressing approach, a single program mayDue to this addressing approach, a single program may
refer to series of many non-contiguous segments.refer to series of many non-contiguous segments.
Virtual Memory (Paging)Virtual Memory (Paging)
Page table
Address Space
Page table
Address Space
Physical
Memory
Two Programs Sharing PhysicalTwo Programs Sharing Physical
MemoryMemory
Program 1
virtual address space
main memory
 A program’s address space is divided into pages (all one fixed size)
or segments (variable sizes)
 The starting location of each page (either in main memory or in
secondary memory) is contained in the program’s page table.
Program 2
virtual address space
Address TranslationAddress Translation
Virtual Address
(VA)
Page offsetVirtual page number
31 30 . . . 12 11 . . . 0
Page offsetPhysical page number
Physical Address (PA)
29 . . . 12 11 0
Translation
 So each memory requestSo each memory request firstfirst requires an addressrequires an address translationtranslation from thefrom the
virtual space to the physical spacevirtual space to the physical space
 A virtual memory miss (i.e., when the page is not in physicalA virtual memory miss (i.e., when the page is not in physical
memory) is called amemory) is called a page faultpage fault
 A virtual address is translated to a physical address by
a combination of hardware and software
VIRTUAL ADDRESSING WITHVIRTUAL ADDRESSING WITH
CACHECACHE
 Thus it takes anThus it takes an extraextra memory accessmemory access
to translate a VA to a PA.to translate a VA to a PA.
CPUTrans-
lation
Cache
Main
Memory
VAPAmiss
hit
data
 This makes memory (cache) accesses very expensive (if every
access was really two accesses)
 The hardware fix is to use a Translation Lookaside Buffer (TLB) – a
small cache that keeps track of recently used address mappings to
avoid having to do a page table lookup
Translation Lookaside BuffersTranslation Lookaside Buffers
(TLBs)(TLBs)
 Just like any other cache, the TLB can beJust like any other cache, the TLB can be
organized as fully associative, set associative,organized as fully associative, set associative,
or direct mappedor direct mapped
V Virtual Page # Physical Page # Dirty Ref
Access
 TLB access time is typically smaller than cache access
time (because TLBs are much smaller than caches)
TLBs are typically not more than 128 to 256 entries even on high
end machines
A TLB in the Memory HierarchyA TLB in the Memory Hierarchy
 A TLB miss – is it a page fault or merely a TLB miss?A TLB miss – is it a page fault or merely a TLB miss?
 If the page is loaded into main memory, then the TLB miss canIf the page is loaded into main memory, then the TLB miss can
be handled (in hardware or software) by loading the translationbe handled (in hardware or software) by loading the translation
information from the page table into the TLBinformation from the page table into the TLB
 Takes 10’s of cycles to find and load the translation info intoTakes 10’s of cycles to find and load the translation info into
the TLBthe TLB
 If the page is not in main memory, then it’s a true page faultIf the page is not in main memory, then it’s a true page fault
 Takes 1,000,000’s of cycles to service a page faultTakes 1,000,000’s of cycles to service a page fault
 TLB misses are much more frequent than true page faultsTLB misses are much more frequent than true page faults
CPU
TLB
Lookup
Cache
Main
Memory
VA PA miss
hit
data
Trans-
lation
hit
miss
¾ t¼ t
Summarizing(virtual memory)Summarizing(virtual memory)
……
 Virtual memoryVirtual memory is a common part of most operatingis a common part of most operating
systems on computers.systems on computers.
 It has become so common because it provides a bigIt has become so common because it provides a big
benefit for users at a very low cost.benefit for users at a very low cost.
 benefits of executing a program that is only partially inbenefits of executing a program that is only partially in
memory.memory.
 program isprogram is no longer constrainedno longer constrained by the amount ofby the amount of
physical memory.physical memory.
⇒⇒ user would be able to write programs for anuser would be able to write programs for an
extremely large virtual address space.extremely large virtual address space.
 more programsmore programs could be run at the same timecould be run at the same time
⇒⇒ increase CPU utilization and throughput.increase CPU utilization and throughput.
 less I/Oless I/O would be neededwould be needed to load or swapto load or swap each usereach user
programprogram
⇒⇒ run fasterrun faster
Addressing ModesAddressing Modes
 ImmediateImmediate
 DirectDirect
 IndirectIndirect
 RegisterRegister
 Register IndirectRegister Indirect
 Displacement (Indexed)Displacement (Indexed)
Immediate AddressingImmediate Addressing
 Operand is part of instructionOperand is part of instruction
 Operand = address fieldOperand = address field
 e.g. ADD 5e.g. ADD 5
 Add 5 to contents of accumulatorAdd 5 to contents of accumulator
 5 is operand5 is operand
 No memory reference to fetch dataNo memory reference to fetch data
 FastFast
 Limited rangeLimited range
Immediate AddressingImmediate Addressing
DiagramDiagram
OperandOpcode
Instruction
DIRECT ADDRESSINGDIRECT ADDRESSING
 Address field contains address of operandAddress field contains address of operand
 Effective address (EA) = address field (A)Effective address (EA) = address field (A)
 e.g. ADD Ae.g. ADD A
 Add contents of cell A to accumulatorAdd contents of cell A to accumulator
 Look in memory at address A for operandLook in memory at address A for operand
 Single memory reference to access dataSingle memory reference to access data
 No additional calculations to work out effectiveNo additional calculations to work out effective
addressaddress
 Limited address spaceLimited address space
Direct Addressing DiagramDirect Addressing Diagram
Address AOpcode
Instruction
Memory
Operand
INDIRECT ADDRESSINGINDIRECT ADDRESSING
In this mode the address field of the instruction
gives the address where the effective address
is stored in memory.
Memory cell pointed to by address field
contains the address of (pointer to) the operand
EA = (A)
Look in A, find address (A) and look there
for operand
e.g. ADD (A)
Add contents of cell pointed to by
contents of A to accumulator
INDIRECT ADDRESSINGINDIRECT ADDRESSING
CONT...CONT...
Large address space
2n
where n = word length
May be nested, multilevel, cascaded
e.g. EA = (((A)))
Indirect addressing is often combined with pre
or post increment or decrement addressing
allowing the address of the operand to
be increases by one either before or after
using it.
Multiple memory accesses to find operand
Hence slower
Indirect AddressingIndirect Addressing
DiagramDiagram
Address AOpcode
Instruction
Memory
Operand
Pointer to operand
DIRECT AND INDIRECTDIRECT AND INDIRECT
EXAMPLEEXAMPLE
Register Addressing (1)Register Addressing (1)
 Operand is held in register named inOperand is held in register named in
address filedaddress filed
 EA = REA = R
 Limited number of registersLimited number of registers
 Very small address field neededVery small address field needed
 Shorter instructionsShorter instructions
 Faster instruction fetchFaster instruction fetch
Register Addressing (2)Register Addressing (2)
 No memory accessNo memory access
 Very fast executionVery fast execution
 Very limited address spaceVery limited address space
 Multiple registers helps performanceMultiple registers helps performance
 Requires good assembly programming orRequires good assembly programming or
compiler writingcompiler writing
 N.B. C programmingN.B. C programming
 register int a;register int a;
 c.f. Direct addressingc.f. Direct addressing
Register AddressingRegister Addressing
DiagramDiagram
Register Address ROpcode
Instruction
Registers
Operand
Register IndirectRegister Indirect
AddressingAddressing
 C.f. indirect addressingC.f. indirect addressing
 EA = (R)EA = (R)
 Operand is in memory cell pointed to byOperand is in memory cell pointed to by
contents of register Rcontents of register R
 Large address space (2Large address space (2nn
))
 One fewer memory access than indirectOne fewer memory access than indirect
addressingaddressing
Register Indirect AddressingRegister Indirect Addressing
DiagramDiagram
Register Address ROpcode
Instruction
Memory
OperandPointer to Operand
Registers
Displacement AddressingDisplacement Addressing
 EA = A + (R)EA = A + (R)
 Address field hold two valuesAddress field hold two values
 A = base valueA = base value
 R = register that holds displacementR = register that holds displacement
 or vice versaor vice versa
Displacement AddressingDisplacement Addressing
DiagramDiagram
Register ROpcode
Instruction
Memory
OperandPointer to Operand
Registers
Address A
+
Relative AddressingRelative Addressing
 A version of displacement addressingA version of displacement addressing
 R = Program counter, PCR = Program counter, PC
 EA = A + (PC)EA = A + (PC)
 PC holds the address of next instruction toPC holds the address of next instruction to
be read.be read.
 Used with branch type instructions.Used with branch type instructions.
 Results in shorter address field.Results in shorter address field.
Base-Register AddressingBase-Register Addressing
 The content of the base address is addedThe content of the base address is added
to the address part of the instructionto the address part of the instruction
 It is assumed to hold a base address andIt is assumed to hold a base address and
address field which gives displacementaddress field which gives displacement
relativerelative
 The are used in computers for reallocationThe are used in computers for reallocation
of programsof programs
 R may be explicit or implicitR may be explicit or implicit
Indexed AddressingIndexed Addressing
 EA = A + REA = A + R
 It is a special type of cpu register.It is a special type of cpu register.
 The distance b/w beginning address andThe distance b/w beginning address and
operands address is index valueoperands address is index value
 In this mode the content of an indexIn this mode the content of an index
register is added to the address part ofregister is added to the address part of
the register to obtain EAthe register to obtain EA
 Good for accessing arraysGood for accessing arrays

More Related Content

What's hot

basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memoryAdarsh Patel
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memoryvampugani
 
Storage Virtualization
Storage VirtualizationStorage Virtualization
Storage VirtualizationMehul Jariwala
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryrapunzel08
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Distributed computing ).ppt him
Distributed computing ).ppt himDistributed computing ).ppt him
Distributed computing ).ppt himHimanshu Saini
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryAnuj Modi
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryWayne Jones Jnr
 
RAM :A primary Memory
RAM :A primary MemoryRAM :A primary Memory
RAM :A primary MemoryDev Dorse
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and PagingEmery Berger
 
Fullandparavirtualization.ppt
Fullandparavirtualization.pptFullandparavirtualization.ppt
Fullandparavirtualization.pptImXaib
 
Parallel computing
Parallel computingParallel computing
Parallel computingVinay Gupta
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementAjit Nayak
 
Desktop virtualization
Desktop virtualizationDesktop virtualization
Desktop virtualizationatadrisi
 
Unit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureUnit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureBalaji Vignesh
 

What's hot (20)

basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Storage Virtualization
Storage VirtualizationStorage Virtualization
Storage Virtualization
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Distributed computing ).ppt him
Distributed computing ).ppt himDistributed computing ).ppt him
Distributed computing ).ppt him
 
Memory management
Memory managementMemory management
Memory management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
RAM :A primary Memory
RAM :A primary MemoryRAM :A primary Memory
RAM :A primary Memory
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
 
Fullandparavirtualization.ppt
Fullandparavirtualization.pptFullandparavirtualization.ppt
Fullandparavirtualization.ppt
 
Virtual memory ppts
Virtual memory pptsVirtual memory ppts
Virtual memory ppts
 
Parallel computing
Parallel computingParallel computing
Parallel computing
 
parallel processing
parallel processingparallel processing
parallel processing
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Desktop virtualization
Desktop virtualizationDesktop virtualization
Desktop virtualization
 
Unit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureUnit 5 Advanced Computer Architecture
Unit 5 Advanced Computer Architecture
 

Viewers also liked

15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1New Era University
 
Operating system introduction to operating system
Operating system   introduction to operating systemOperating system   introduction to operating system
Operating system introduction to operating systemjaydeesa17
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual MemoryEmery Berger
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O DevicesSlideshare
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureDilum Bandara
 
Op Sy 03 Ch 51
Op Sy 03 Ch 51Op Sy 03 Ch 51
Op Sy 03 Ch 51 Google
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of AlgorithmsSwapnil Agrawal
 
File system.
File system.File system.
File system.elyza12
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386yash sawarkar
 
types of operating system
types of operating systemtypes of operating system
types of operating systemMahira Rashdi
 

Viewers also liked (20)

Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Virtual memory 20070222-en
Virtual memory 20070222-enVirtual memory 20070222-en
Virtual memory 20070222-en
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1
 
Device Management
Device ManagementDevice Management
Device Management
 
Vm
VmVm
Vm
 
Operating system introduction to operating system
Operating system   introduction to operating systemOperating system   introduction to operating system
Operating system introduction to operating system
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O Devices
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Input-Output Modules
Input-Output ModulesInput-Output Modules
Input-Output Modules
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
 
Op Sy 03 Ch 51
Op Sy 03 Ch 51Op Sy 03 Ch 51
Op Sy 03 Ch 51
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
File system.
File system.File system.
File system.
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386
 
Presentation on memory
Presentation on memoryPresentation on memory
Presentation on memory
 
types of operating system
types of operating systemtypes of operating system
types of operating system
 
File system
File systemFile system
File system
 

Similar to Virtual Memory ,Direct memory addressing and indirect memory addressing presentation

NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.pptPratikBose10
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.pptsuryansh85
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptMonirJihad1
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptRahulRaj395610
 
How many total bits are required for a direct-mapped cache with 2048 .pdf
How many total bits are required for a direct-mapped cache with 2048 .pdfHow many total bits are required for a direct-mapped cache with 2048 .pdf
How many total bits are required for a direct-mapped cache with 2048 .pdfEye2eyeopticians10
 
virtualmemory-111228090333-phpapp02 (1).pdf
virtualmemory-111228090333-phpapp02 (1).pdfvirtualmemory-111228090333-phpapp02 (1).pdf
virtualmemory-111228090333-phpapp02 (1).pdfArchanaPandiyan
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementkazim Hussain
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management Shashank Asthana
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memoryPrakharBansal29
 
An Efficient Virtual Memory using Graceful Code
An Efficient Virtual Memory using Graceful CodeAn Efficient Virtual Memory using Graceful Code
An Efficient Virtual Memory using Graceful Codeijtsrd
 
Memory : operating system ( Btech cse )
Memory : operating system ( Btech cse )Memory : operating system ( Btech cse )
Memory : operating system ( Btech cse )HimanshuSharma1389
 

Similar to Virtual Memory ,Direct memory addressing and indirect memory addressing presentation (20)

NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.ppt
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.ppt
 
virtual memory - Computer operating system
virtual memory - Computer operating systemvirtual memory - Computer operating system
virtual memory - Computer operating system
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
 
Os
OsOs
Os
 
How many total bits are required for a direct-mapped cache with 2048 .pdf
How many total bits are required for a direct-mapped cache with 2048 .pdfHow many total bits are required for a direct-mapped cache with 2048 .pdf
How many total bits are required for a direct-mapped cache with 2048 .pdf
 
virtualmemory-111228090333-phpapp02 (1).pdf
virtualmemory-111228090333-phpapp02 (1).pdfvirtualmemory-111228090333-phpapp02 (1).pdf
virtualmemory-111228090333-phpapp02 (1).pdf
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Unit 5-lecture-2
Unit 5-lecture-2Unit 5-lecture-2
Unit 5-lecture-2
 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memory
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
An Efficient Virtual Memory using Graceful Code
An Efficient Virtual Memory using Graceful CodeAn Efficient Virtual Memory using Graceful Code
An Efficient Virtual Memory using Graceful Code
 
VirutualMemory.docx
VirutualMemory.docxVirutualMemory.docx
VirutualMemory.docx
 
Memory : operating system ( Btech cse )
Memory : operating system ( Btech cse )Memory : operating system ( Btech cse )
Memory : operating system ( Btech cse )
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

Virtual Memory ,Direct memory addressing and indirect memory addressing presentation

  • 1. Virtual Memory ,Direct memoryVirtual Memory ,Direct memory addressing and indirect memoryaddressing and indirect memory addressingaddressing MADE BY:MADE BY: KASHISH-13ITU013KASHISH-13ITU013 PRAPTI SETHI-13ITU028PRAPTI SETHI-13ITU028 RITIKA MEHANDIRATTA-13ITU029RITIKA MEHANDIRATTA-13ITU029 SHIVAM NAGPAL-13ITU038SHIVAM NAGPAL-13ITU038 SHUBHAM CHOUDHARY-13ITU039SHUBHAM CHOUDHARY-13ITU039 SMARTH BAJAJ-13ITU040SMARTH BAJAJ-13ITU040 SONALI GUPTA -13ITU043SONALI GUPTA -13ITU043 SURBHI GROVER-13ITU044SURBHI GROVER-13ITU044
  • 3. Topics coveredTopics covered  Virtual memoryVirtual memory  Direct memory access (DMA)Direct memory access (DMA)  Indirect memory accessIndirect memory access  Addressing ModesAddressing Modes 1.1. ImmediateImmediate 2.2. DirectDirect 3.3. IndirectIndirect 4.4. RegisterRegister 5.5. Register IndirectRegister Indirect 6.6. Displacement (Indexed)Displacement (Indexed)
  • 4. INTRODUCTIONINTRODUCTION  In computing, In computing, virtual memoryvirtual memory is a memory managementis a memory management technique that is implementedtechnique that is implemented using both hardware andusing both hardware and software. It maps memorysoftware. It maps memory addresses used by aaddresses used by a program, called program, called virtualvirtual addressesaddresses, into, intophysicalphysical addressesaddresses in computer in computer memory. memory.   Direct memory access (DMADirect memory access (DMA) is) is a feature of computerizeda feature of computerized systems that allows certainsystems that allows certain hardware subsystems tohardware subsystems to access main systemaccess main system memory independently ofmemory independently of the central processingthe central processing unit (CPU).unit (CPU).
  • 5. INDIRECT ADDRESSINGINDIRECT ADDRESSING  An address in a computer instruction that indicates a location where An address in a computer instruction that indicates a location where  the address of the referenced operand is to be found. Alsoknown asthe address of the referenced operand is to be found. Alsoknown as multilevel address.multilevel address.
  • 6. MemoryMemory register CPU cache Main Memory Secondary Storage Server (or INTERNET) • larger capacity • lower speed • lower cost
  • 7. What isWhat is……  Virtual memory as an alternate set ofVirtual memory as an alternate set of memory addresses.memory addresses.  Programs use these virtual addressesPrograms use these virtual addresses rather than real addresses to storerather than real addresses to store instructions and data.instructions and data.  When the program is actually executed,When the program is actually executed, the virtual addresses are converted intothe virtual addresses are converted into real memory addresses.real memory addresses.
  • 8. Why is it neededWhy is it needed……..  Before the development of the virtual memoryBefore the development of the virtual memory technique, programmers had to manage directlytechnique, programmers had to manage directly two-level storage such as main memory or ramtwo-level storage such as main memory or ram and secondary memory in the form of hard disksand secondary memory in the form of hard disks or earlier, magnetic drums.or earlier, magnetic drums.  Enlarge the address space, the set of addressesEnlarge the address space, the set of addresses a program can utilize.a program can utilize.  Virtual memory might contain twice as manyVirtual memory might contain twice as many addresses as main memory.addresses as main memory.
  • 9. ObjectObject……  When a computer is executing many programsWhen a computer is executing many programs at the same time, Virtual memory make theat the same time, Virtual memory make the computer to share memory efficiently.computer to share memory efficiently.  Eliminate a restriction that a computer works inEliminate a restriction that a computer works in memory which is small and be limited.memory which is small and be limited.  When many programs is running at the sameWhen many programs is running at the same time, by distributing each suitable memory areatime, by distributing each suitable memory area to each program, VM protect programs toto each program, VM protect programs to interfere each other in each memory area.interfere each other in each memory area.
  • 10. How does it workHow does it work……  To facilitate copying virtual memory into realTo facilitate copying virtual memory into real memory, the operating system divides virtualmemory, the operating system divides virtual memory into pages, each of which contains amemory into pages, each of which contains a fixed number of addresses.fixed number of addresses.  Each page is stored on a disk until it is needed.Each page is stored on a disk until it is needed.  When the page is needed, the operating systemWhen the page is needed, the operating system copies it from disk to main memory, translatingcopies it from disk to main memory, translating the virtual addresses into real addresses.the virtual addresses into real addresses.
  • 11. Virtual MemoryVirtual Memory  Use main memory as a “cache” for secondary memoryUse main memory as a “cache” for secondary memory  Allows efficient and safe sharing of memory among multipleAllows efficient and safe sharing of memory among multiple programs.programs.  Provides the ability to easily run programs larger than the size ofProvides the ability to easily run programs larger than the size of physical memoryphysical memory  Simplifies loading a program for execution by providing for codeSimplifies loading a program for execution by providing for code relocation (i.e., the code can be loaded anywhere in main memory)relocation (i.e., the code can be loaded anywhere in main memory)  What makes it work? – again the Principle of LocalityWhat makes it work? – again the Principle of Locality  A program is likely to access a relatively small portion of its addressA program is likely to access a relatively small portion of its address space during any period of timespace during any period of time  Each program is compiled into its own address space – a “virtual”Each program is compiled into its own address space – a “virtual” address spaceaddress space  During run-time eachDuring run-time each virtualvirtual address must be translated to aaddress must be translated to a physicalphysical address (an address in main memory)address (an address in main memory)
  • 12. MMU (Memory ManagementMMU (Memory Management Unit)Unit)  The hardware base that makes a virtual memory systemThe hardware base that makes a virtual memory system possible.possible.  Allows software to reference physical memory by virtualAllows software to reference physical memory by virtual addresses, quite often more than one.addresses, quite often more than one.  It accomplishes this through the use of page and pageIt accomplishes this through the use of page and page tables.tables.  Use a section of memory to translate virtual addressesUse a section of memory to translate virtual addresses into physical addresses via a series of table lookups.into physical addresses via a series of table lookups.  The software that handles the page fault is generally partThe software that handles the page fault is generally part of an operating system and the hardware that detectsof an operating system and the hardware that detects this situation.this situation.
  • 13. Segmentation... & paging...Segmentation... & paging...  Segmentation involves the relocation of variable sizedSegmentation involves the relocation of variable sized segments into the physical address space.segments into the physical address space.  Generally these segments are contiguous units, and areGenerally these segments are contiguous units, and are referred to in programs by their segment number and anreferred to in programs by their segment number and an offset to the requested data.offset to the requested data.  A technique used by virtual memory operating systemsA technique used by virtual memory operating systems to help ensure that the data you need is available asto help ensure that the data you need is available as quickly as possible.quickly as possible.  Instead of utilizing a segment/offset addressingInstead of utilizing a segment/offset addressing approach, as seen in segmentation, paging uses a linearapproach, as seen in segmentation, paging uses a linear sequence of virtual addresses which are mapped tosequence of virtual addresses which are mapped to physical memory as necessary.physical memory as necessary.  Due to this addressing approach, a single program mayDue to this addressing approach, a single program may refer to series of many non-contiguous segments.refer to series of many non-contiguous segments.
  • 14. Virtual Memory (Paging)Virtual Memory (Paging) Page table Address Space Page table Address Space Physical Memory
  • 15. Two Programs Sharing PhysicalTwo Programs Sharing Physical MemoryMemory Program 1 virtual address space main memory  A program’s address space is divided into pages (all one fixed size) or segments (variable sizes)  The starting location of each page (either in main memory or in secondary memory) is contained in the program’s page table. Program 2 virtual address space
  • 16. Address TranslationAddress Translation Virtual Address (VA) Page offsetVirtual page number 31 30 . . . 12 11 . . . 0 Page offsetPhysical page number Physical Address (PA) 29 . . . 12 11 0 Translation  So each memory requestSo each memory request firstfirst requires an addressrequires an address translationtranslation from thefrom the virtual space to the physical spacevirtual space to the physical space  A virtual memory miss (i.e., when the page is not in physicalA virtual memory miss (i.e., when the page is not in physical memory) is called amemory) is called a page faultpage fault  A virtual address is translated to a physical address by a combination of hardware and software
  • 17. VIRTUAL ADDRESSING WITHVIRTUAL ADDRESSING WITH CACHECACHE  Thus it takes anThus it takes an extraextra memory accessmemory access to translate a VA to a PA.to translate a VA to a PA. CPUTrans- lation Cache Main Memory VAPAmiss hit data  This makes memory (cache) accesses very expensive (if every access was really two accesses)  The hardware fix is to use a Translation Lookaside Buffer (TLB) – a small cache that keeps track of recently used address mappings to avoid having to do a page table lookup
  • 18. Translation Lookaside BuffersTranslation Lookaside Buffers (TLBs)(TLBs)  Just like any other cache, the TLB can beJust like any other cache, the TLB can be organized as fully associative, set associative,organized as fully associative, set associative, or direct mappedor direct mapped V Virtual Page # Physical Page # Dirty Ref Access  TLB access time is typically smaller than cache access time (because TLBs are much smaller than caches) TLBs are typically not more than 128 to 256 entries even on high end machines
  • 19. A TLB in the Memory HierarchyA TLB in the Memory Hierarchy  A TLB miss – is it a page fault or merely a TLB miss?A TLB miss – is it a page fault or merely a TLB miss?  If the page is loaded into main memory, then the TLB miss canIf the page is loaded into main memory, then the TLB miss can be handled (in hardware or software) by loading the translationbe handled (in hardware or software) by loading the translation information from the page table into the TLBinformation from the page table into the TLB  Takes 10’s of cycles to find and load the translation info intoTakes 10’s of cycles to find and load the translation info into the TLBthe TLB  If the page is not in main memory, then it’s a true page faultIf the page is not in main memory, then it’s a true page fault  Takes 1,000,000’s of cycles to service a page faultTakes 1,000,000’s of cycles to service a page fault  TLB misses are much more frequent than true page faultsTLB misses are much more frequent than true page faults CPU TLB Lookup Cache Main Memory VA PA miss hit data Trans- lation hit miss ¾ t¼ t
  • 20. Summarizing(virtual memory)Summarizing(virtual memory) ……  Virtual memoryVirtual memory is a common part of most operatingis a common part of most operating systems on computers.systems on computers.  It has become so common because it provides a bigIt has become so common because it provides a big benefit for users at a very low cost.benefit for users at a very low cost.  benefits of executing a program that is only partially inbenefits of executing a program that is only partially in memory.memory.  program isprogram is no longer constrainedno longer constrained by the amount ofby the amount of physical memory.physical memory. ⇒⇒ user would be able to write programs for anuser would be able to write programs for an extremely large virtual address space.extremely large virtual address space.  more programsmore programs could be run at the same timecould be run at the same time ⇒⇒ increase CPU utilization and throughput.increase CPU utilization and throughput.  less I/Oless I/O would be neededwould be needed to load or swapto load or swap each usereach user programprogram ⇒⇒ run fasterrun faster
  • 21.
  • 22. Addressing ModesAddressing Modes  ImmediateImmediate  DirectDirect  IndirectIndirect  RegisterRegister  Register IndirectRegister Indirect  Displacement (Indexed)Displacement (Indexed)
  • 23. Immediate AddressingImmediate Addressing  Operand is part of instructionOperand is part of instruction  Operand = address fieldOperand = address field  e.g. ADD 5e.g. ADD 5  Add 5 to contents of accumulatorAdd 5 to contents of accumulator  5 is operand5 is operand  No memory reference to fetch dataNo memory reference to fetch data  FastFast  Limited rangeLimited range
  • 25. DIRECT ADDRESSINGDIRECT ADDRESSING  Address field contains address of operandAddress field contains address of operand  Effective address (EA) = address field (A)Effective address (EA) = address field (A)  e.g. ADD Ae.g. ADD A  Add contents of cell A to accumulatorAdd contents of cell A to accumulator  Look in memory at address A for operandLook in memory at address A for operand  Single memory reference to access dataSingle memory reference to access data  No additional calculations to work out effectiveNo additional calculations to work out effective addressaddress  Limited address spaceLimited address space
  • 26. Direct Addressing DiagramDirect Addressing Diagram Address AOpcode Instruction Memory Operand
  • 27. INDIRECT ADDRESSINGINDIRECT ADDRESSING In this mode the address field of the instruction gives the address where the effective address is stored in memory. Memory cell pointed to by address field contains the address of (pointer to) the operand EA = (A) Look in A, find address (A) and look there for operand e.g. ADD (A) Add contents of cell pointed to by contents of A to accumulator
  • 28. INDIRECT ADDRESSINGINDIRECT ADDRESSING CONT...CONT... Large address space 2n where n = word length May be nested, multilevel, cascaded e.g. EA = (((A))) Indirect addressing is often combined with pre or post increment or decrement addressing allowing the address of the operand to be increases by one either before or after using it. Multiple memory accesses to find operand Hence slower
  • 29. Indirect AddressingIndirect Addressing DiagramDiagram Address AOpcode Instruction Memory Operand Pointer to operand
  • 30. DIRECT AND INDIRECTDIRECT AND INDIRECT EXAMPLEEXAMPLE
  • 31. Register Addressing (1)Register Addressing (1)  Operand is held in register named inOperand is held in register named in address filedaddress filed  EA = REA = R  Limited number of registersLimited number of registers  Very small address field neededVery small address field needed  Shorter instructionsShorter instructions  Faster instruction fetchFaster instruction fetch
  • 32. Register Addressing (2)Register Addressing (2)  No memory accessNo memory access  Very fast executionVery fast execution  Very limited address spaceVery limited address space  Multiple registers helps performanceMultiple registers helps performance  Requires good assembly programming orRequires good assembly programming or compiler writingcompiler writing  N.B. C programmingN.B. C programming  register int a;register int a;  c.f. Direct addressingc.f. Direct addressing
  • 33. Register AddressingRegister Addressing DiagramDiagram Register Address ROpcode Instruction Registers Operand
  • 34. Register IndirectRegister Indirect AddressingAddressing  C.f. indirect addressingC.f. indirect addressing  EA = (R)EA = (R)  Operand is in memory cell pointed to byOperand is in memory cell pointed to by contents of register Rcontents of register R  Large address space (2Large address space (2nn ))  One fewer memory access than indirectOne fewer memory access than indirect addressingaddressing
  • 35. Register Indirect AddressingRegister Indirect Addressing DiagramDiagram Register Address ROpcode Instruction Memory OperandPointer to Operand Registers
  • 36. Displacement AddressingDisplacement Addressing  EA = A + (R)EA = A + (R)  Address field hold two valuesAddress field hold two values  A = base valueA = base value  R = register that holds displacementR = register that holds displacement  or vice versaor vice versa
  • 37. Displacement AddressingDisplacement Addressing DiagramDiagram Register ROpcode Instruction Memory OperandPointer to Operand Registers Address A +
  • 38. Relative AddressingRelative Addressing  A version of displacement addressingA version of displacement addressing  R = Program counter, PCR = Program counter, PC  EA = A + (PC)EA = A + (PC)  PC holds the address of next instruction toPC holds the address of next instruction to be read.be read.  Used with branch type instructions.Used with branch type instructions.  Results in shorter address field.Results in shorter address field.
  • 39. Base-Register AddressingBase-Register Addressing  The content of the base address is addedThe content of the base address is added to the address part of the instructionto the address part of the instruction  It is assumed to hold a base address andIt is assumed to hold a base address and address field which gives displacementaddress field which gives displacement relativerelative  The are used in computers for reallocationThe are used in computers for reallocation of programsof programs  R may be explicit or implicitR may be explicit or implicit
  • 40. Indexed AddressingIndexed Addressing  EA = A + REA = A + R  It is a special type of cpu register.It is a special type of cpu register.  The distance b/w beginning address andThe distance b/w beginning address and operands address is index valueoperands address is index value  In this mode the content of an indexIn this mode the content of an index register is added to the address part ofregister is added to the address part of the register to obtain EAthe register to obtain EA  Good for accessing arraysGood for accessing arrays

Editor's Notes

  1. The page size is 212 = 4KB, the number of physical pages allowed in memory is 218, the physical address space is 1GB and the virtual address space is 4GB