SlideShare a Scribd company logo
Amrita
School
of
Engineering,
Bangalore
Ms. Harika Pudugosula
Lecturer
Department of Electronics & Communication Engineering
• Background
• Swapping
• Contiguous Memory Allocation
• Segmentation
• Paging
• Structure of the Page Table
2
Introduction
• CPU scheduling, can improve both the utilization of the CPU and the speed of the
computer’s response to its users
• To realize this increase in performance, several processes must be kept in memory—
that is, sharing of takes place memory
• The memory management algorithms vary from a primitive bare-machine approach
to paging and segmentation strategies
• Each approach has its own advantages and disadvantages
• Selection of a memory-management method for a specific system depends on many
factors, especially on the hardware design of the system
3
Objectives
• To provide a detailed description of various ways of organizing memory hardware
• To discuss various memory-management techniques, including paging and
segmentation
• To provide a detailed description of the Intel Pentium, which supports both pure
segmentation and segmentation with paging
4
Background
• Memory is central to the operation of a modern computer system
• Memory consists of a large array of bytes, each with its own address
• The CPU fetches instructions from memory according to the value of the program
counter
• Instruction - Execution cycle -
• Fetch instruction from memory
• Decode the fetched instruction
• Fetch the data for executing the instruction
• Store the results
• The memory unit sees only a stream of memory addresses; it does not know how
they are generated or what they are for (instructions or data)
• Interested only in the sequence of memory addresses generated by the running
program
• Several issues that are relevant to managing memory
5
• Main memory and the registers built into the processor itself are the only general-
purpose storage that the CPU can access directly
• Any instructions in execution, and any data being used by the instructions, must be in
one of these direct-access storage devices
• If the data are not in memory, they must be moved there before the CPU can operate
on them
• Data from register can be accessed in one clock cycle. But, accessing data from main
memory requires many clock cycles
• The processor normally needs to stall, since it does not have the data required to
complete the instruction that it is executing
• The remedy is to add fast memory between the CPUand main memory, typically on
the CPU chip for fast access
• Then the hardware automatically speeds up memory access without any operating-
system control
Basic Hardware
6
• To ensure correct operation, must protect the operating system from access by user
processes
• On multiuser systems, must additionally protect user processes from one another.
• This protection must be provided by the hardware because the operating system
doesn’t usually intervene between the CPU and its memory accesses (because of the
resulting performance penalty)
• One possible implementation -
• Need to make sure that each process has a separate memory space
• To separate memory spaces, we need the ability to determine the range of legal
addresses that the process may access and to ensure that the process can access
only these legal addresses
• This protection will be provided by using two registers, usually a base and a limit
registers
• Base register - holds the smallest legal physical memory address
• Limit register - specifies the size of the range
Basic Hardware
7
Basic Hardware
8
• For example, if the base register holds 300040
and the limit register is 120900, then the
program can legally access all addresses from
300040 through 420939 (inclusive)
• Protection of memory space is accomplished
by having the CPU hardware compare every
address generated in user mode with the
registers
Basic Hardware
9
• Any attempt by a program executing in user mode to access operating-system
memory or other users’ memory results in a trap to the operating system, which
treats the attempt as a fatal error (modifying the code or data structures of either
the operating system or other users)
• The base and limit registers can be loaded only by the operating system, which uses a
special privileged instruction
• Privileged instructions can be executed only in kernel mode, only OS executes in
kernel mode
• This allows the operating system to change the value of the registers but prevents
user programs from changing the registers’ contents
• The operating system, executing in kernel mode, is given unrestricted access to both
operating-system memory and users’ memory
• This provision allows the operating system to load users’ programs into users’
memory, to dump out those programs in case of errors
10
Basic Hardware
• A program resides on a disk as a binary executable file
• To be executed, the program must be brought into memory and placed within a
process
• Depending on the memory management in use, the process may be moved between
disk and memory during its execution
• The processes on the disk that are waiting to be brought into memory for execution
are available in input queue/Device queue
• The normal single-tasking procedure is to select one of the processes in the input
queue and to load that process into memory
• As the process is executed, it accesses instructions and data from memory
• Eventually, the process terminates, and its memory space is declared available
• Addresses may be represented in different ways during these steps (next slide)
11
Address Binding
• Addresses in the source program are
generally symbolic (such as the variable
count)
• A compiler typically binds these symbolic
addresses to relocatable addresses (such
as “14 bytes from the beginning of this
module”)
• The linkage editor or loader in turn binds
the relocatable addresses to absolute
addresses (such as74014)
• Each binding is a mapping from one
address space to another
• The binding of memory address to
instruction and data is called address
binding
12
Address Binding
• Address binding of instructions and data to memory addresses can happen at three
different stages
• Compile time - If you know at compile time where the process will reside in
memory,This is called compile time binding.Then the code generated is called
absolute code .We must recompile code if starting location changes. Example:
MSDOS .com format programs are bound at compile time
• Load time - If it is not known at compile time where the process will reside in
memory, then must delay binding till load time. The compiler must generate
relocatable code. In this case, final binding is delayed until load time. If the
starting address change, we need only reload the user code to incorporate this
changed value.
• Execution time - If the process can be moved during its execution from one
memory segment to another, then binding must be delayed until run time
13
Address Binding
• An address generated by the CPU is commonly referred to as a logical address
(generated by CPU when a program is running)
• An address seen by the memory unit—that is, the one loaded into the memory-
address register of the memory—is physical address (location in a memory unit)
• The compile-time and load-time address-binding methods generate identical logical
and physical addresses
• The execution-time address-binding scheme results in differing logical and physical
addresses, refer to the logical address as a virtual address
• The set of all logical addresses generated by a program is a logical address space
• The set of all physical addresses corresponding to these logical addresses is a
physical address space
• In the execution-time address-binding scheme, the logical and physical address
spaces differ
• The run-time mapping from virtual to physical addresses is done by a hardware
device called the memory-management unit (MMU)
14
Logical Versus Physical Address Space
15
Logical Versus Physical Address Space
• Illustrating run-time mapping with a simple MMU scheme that is a generalization of
the base-register scheme
• The base register is now called a relocation register
• In MMU scheme, the value in the relocation register is added to every address
generated by a user process at the time the address is sent to memory
• The user program never sees the real physical addresses, deals with logical
addresses
• The memory-mapping hardware converts logical addresses into physical addresses
• Only when it is used as a memory address (in an indirect load or store, perhaps) is it
relocated relative to the base register
• Two different types of addresses
• Logical addresses (in the range 0 to max) and
• Physical addresses (in the range R + 0 to R + max for a base value R)
• The user program generates only logical addresses and thinks that the process runs
in locations 0 to max
• However, these logical addresses must be mapped to physical addresses before they
are used
16
Logical Versus Physical Address Space
• A routine is not loaded into main memory until it is called
• All routines are kept on disk in a relocatable format
• The main program is loaded into memory and is executed
• When a routine needs to call another routine, the calling routine first checks to see
whether the other routine has been loaded
• If it has not, the relocatable loader is called/invoked to load the desired routine
into memory and to update the program’s address tables to reflect this change
• Then control is passed to the newly loaded routine
• Advantage of dynamic loading -
• A routine can be loaded only when it is needed
• This method is particularly useful when large amounts of code are needed to
handle infrequently occurring cases, such as error routines
17
Dynamic Loading
• Dynamically linked libraries are system libraries that are linked to user programs
when the programs are run - These libraries are also called as shared libraries
• Some operating systems support only static linking, in which system libraries are
treated like any other object module and are combined by the loader into the binary
program image
• Dynamic linking, in contrast, is similar to dynamic loading, rather than loading, is
postponed until execution time
• Example - Language subroutine libraries.Many OS environments allow dynamic
linking, that is the postponing of the resolving of some undefined symbols until a
program is run
• Without dynamic linking, each program on a system must include a copy of its
language library in the executable image
• This requirement wastes both disk space and main memory
• With dynamic linking, a stub is included in the image for each library routine
reference
18
Dynamic Linking and Shared Libraries
• Stud -
• The stub is a small piece of code that indicates how to locate the appropriate
memory-resident library routine or how to load the library if the routine is not
already present
• When the stub is executed, it checks to see whether the needed routine is
already in memory
• If it is not, the program loads the routine into memory
• The stub replaces itself with the address of the routine and executes the routine
• Thus, the next time that particular code segment is reached, the library routine is
executed directly, incurring no cost for dynamic linking
• Advantages of Dynamic linking -
• A library may be replaced by a new version, and all programs that reference the
library will automatically use the new version
• Without dynamic linking, all such programs would need to be relinked to gain
access to the new library 19
Dynamic Linking and Shared Libraries
• Often-used libraries (for example the standard system libraries) need to be stored in
only one location, not duplicated in every single binary
• If a bug in a library function is corrected by replacing the library, all programs using it
dynamically will benefit from the correction after restarting them
• Programs that included this function by static linking would have to be re-linked first
20
Dynamic Linking and Shared Libraries
21
References
1. Silberscatnz and Galvin, “Operating System Concepts,” Ninth Edition,
John Wiley and Sons, 2012.
22
Thank you

More Related Content

Similar to Memory Management Strategies - I.pdf

Memory management basics
Memory management basicsMemory management basics
Memory management basics
Amrutha Rajan
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
LeahRachael
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
Anwal Mirza
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Sumalatha A
 
Chapter1 Computer System Overview Part-1.ppt
Chapter1 Computer System Overview Part-1.pptChapter1 Computer System Overview Part-1.ppt
Chapter1 Computer System Overview Part-1.ppt
ShikhaManrai1
 
Chapter1 Computer System Overview.ppt
Chapter1 Computer System Overview.pptChapter1 Computer System Overview.ppt
Chapter1 Computer System Overview.ppt
ShikhaManrai1
 
MK Sistem Operasi.pdf
MK Sistem Operasi.pdfMK Sistem Operasi.pdf
MK Sistem Operasi.pdf
wisard1
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
UsamaKhan987353
 
Computer Architecture & Organization.ppt
Computer Architecture & Organization.pptComputer Architecture & Organization.ppt
Computer Architecture & Organization.ppt
FarhanaMariyam1
 
CISSP - Chapter 3 - CPU Architecture
CISSP - Chapter 3 - CPU ArchitectureCISSP - Chapter 3 - CPU Architecture
CISSP - Chapter 3 - CPU Architecture
Karthikeyan Dhayalan
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
VSKAMCSPSGCT
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
jeetesh036
 
computer system structure
computer system structurecomputer system structure
computer system structure
HAMZA AHMED
 
assignment_presentaion_jhvvnvhjhbhjhvjh.pptx
assignment_presentaion_jhvvnvhjhbhjhvjh.pptxassignment_presentaion_jhvvnvhjhbhjhvjh.pptx
assignment_presentaion_jhvvnvhjhbhjhvjh.pptx
23mu36
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
rprajat007
 
Operating System BCA 301
Operating System BCA 301Operating System BCA 301
Operating System BCA 301
cpjcollege
 
ch8 Memory Management OS.pptx
ch8 Memory Management OS.pptxch8 Memory Management OS.pptx
ch8 Memory Management OS.pptx
Indhu Periys
 
E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5
Sneha Chopra
 
Unit 1 Computer organization and Instructions
Unit 1 Computer organization and InstructionsUnit 1 Computer organization and Instructions
Unit 1 Computer organization and Instructions
Balaji Vignesh
 
What is an Operating Systems?
What is an Operating Systems?What is an Operating Systems?
What is an Operating Systems?
JayaKamal
 

Similar to Memory Management Strategies - I.pdf (20)

Memory management basics
Memory management basicsMemory management basics
Memory management basics
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
 
Chapter1 Computer System Overview Part-1.ppt
Chapter1 Computer System Overview Part-1.pptChapter1 Computer System Overview Part-1.ppt
Chapter1 Computer System Overview Part-1.ppt
 
Chapter1 Computer System Overview.ppt
Chapter1 Computer System Overview.pptChapter1 Computer System Overview.ppt
Chapter1 Computer System Overview.ppt
 
MK Sistem Operasi.pdf
MK Sistem Operasi.pdfMK Sistem Operasi.pdf
MK Sistem Operasi.pdf
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
Computer Architecture & Organization.ppt
Computer Architecture & Organization.pptComputer Architecture & Organization.ppt
Computer Architecture & Organization.ppt
 
CISSP - Chapter 3 - CPU Architecture
CISSP - Chapter 3 - CPU ArchitectureCISSP - Chapter 3 - CPU Architecture
CISSP - Chapter 3 - CPU Architecture
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
computer system structure
computer system structurecomputer system structure
computer system structure
 
assignment_presentaion_jhvvnvhjhbhjhvjh.pptx
assignment_presentaion_jhvvnvhjhbhjhvjh.pptxassignment_presentaion_jhvvnvhjhbhjhvjh.pptx
assignment_presentaion_jhvvnvhjhbhjhvjh.pptx
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Operating System BCA 301
Operating System BCA 301Operating System BCA 301
Operating System BCA 301
 
ch8 Memory Management OS.pptx
ch8 Memory Management OS.pptxch8 Memory Management OS.pptx
ch8 Memory Management OS.pptx
 
E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5
 
Unit 1 Computer organization and Instructions
Unit 1 Computer organization and InstructionsUnit 1 Computer organization and Instructions
Unit 1 Computer organization and Instructions
 
What is an Operating Systems?
What is an Operating Systems?What is an Operating Systems?
What is an Operating Systems?
 

More from Harika Pudugosula

Artificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptxArtificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptx
Harika Pudugosula
 
Artificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptxArtificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptx
Harika Pudugosula
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
Harika Pudugosula
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
Harika Pudugosula
 
CPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdfCPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdf
Harika Pudugosula
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
Harika Pudugosula
 
Multithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdfMultithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdf
Harika Pudugosula
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
Harika Pudugosula
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
Harika Pudugosula
 
Deadlocks Part- III.pdf
Deadlocks Part- III.pdfDeadlocks Part- III.pdf
Deadlocks Part- III.pdf
Harika Pudugosula
 
Deadlocks Part- II.pdf
Deadlocks Part- II.pdfDeadlocks Part- II.pdf
Deadlocks Part- II.pdf
Harika Pudugosula
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
Harika Pudugosula
 
Memory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdfMemory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdf
Harika Pudugosula
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdf
Harika Pudugosula
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
Harika Pudugosula
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
Harika Pudugosula
 
Operating System Structure Part-II.pdf
Operating System Structure Part-II.pdfOperating System Structure Part-II.pdf
Operating System Structure Part-II.pdf
Harika Pudugosula
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
Harika Pudugosula
 
Lecture-4_Process Management.pdf
Lecture-4_Process Management.pdfLecture-4_Process Management.pdf
Lecture-4_Process Management.pdf
Harika Pudugosula
 
Lecture_3-Process Management.pdf
Lecture_3-Process Management.pdfLecture_3-Process Management.pdf
Lecture_3-Process Management.pdf
Harika Pudugosula
 

More from Harika Pudugosula (20)

Artificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptxArtificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptx
 
Artificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptxArtificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptx
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
CPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdfCPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdf
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
 
Multithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdfMultithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdf
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
 
Deadlocks Part- III.pdf
Deadlocks Part- III.pdfDeadlocks Part- III.pdf
Deadlocks Part- III.pdf
 
Deadlocks Part- II.pdf
Deadlocks Part- II.pdfDeadlocks Part- II.pdf
Deadlocks Part- II.pdf
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
 
Memory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdfMemory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdf
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdf
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
Operating System Structure Part-II.pdf
Operating System Structure Part-II.pdfOperating System Structure Part-II.pdf
Operating System Structure Part-II.pdf
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
 
Lecture-4_Process Management.pdf
Lecture-4_Process Management.pdfLecture-4_Process Management.pdf
Lecture-4_Process Management.pdf
 
Lecture_3-Process Management.pdf
Lecture_3-Process Management.pdfLecture_3-Process Management.pdf
Lecture_3-Process Management.pdf
 

Recently uploaded

ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 

Recently uploaded (20)

ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 

Memory Management Strategies - I.pdf

  • 2. • Background • Swapping • Contiguous Memory Allocation • Segmentation • Paging • Structure of the Page Table 2
  • 3. Introduction • CPU scheduling, can improve both the utilization of the CPU and the speed of the computer’s response to its users • To realize this increase in performance, several processes must be kept in memory— that is, sharing of takes place memory • The memory management algorithms vary from a primitive bare-machine approach to paging and segmentation strategies • Each approach has its own advantages and disadvantages • Selection of a memory-management method for a specific system depends on many factors, especially on the hardware design of the system 3
  • 4. Objectives • To provide a detailed description of various ways of organizing memory hardware • To discuss various memory-management techniques, including paging and segmentation • To provide a detailed description of the Intel Pentium, which supports both pure segmentation and segmentation with paging 4
  • 5. Background • Memory is central to the operation of a modern computer system • Memory consists of a large array of bytes, each with its own address • The CPU fetches instructions from memory according to the value of the program counter • Instruction - Execution cycle - • Fetch instruction from memory • Decode the fetched instruction • Fetch the data for executing the instruction • Store the results • The memory unit sees only a stream of memory addresses; it does not know how they are generated or what they are for (instructions or data) • Interested only in the sequence of memory addresses generated by the running program • Several issues that are relevant to managing memory 5
  • 6. • Main memory and the registers built into the processor itself are the only general- purpose storage that the CPU can access directly • Any instructions in execution, and any data being used by the instructions, must be in one of these direct-access storage devices • If the data are not in memory, they must be moved there before the CPU can operate on them • Data from register can be accessed in one clock cycle. But, accessing data from main memory requires many clock cycles • The processor normally needs to stall, since it does not have the data required to complete the instruction that it is executing • The remedy is to add fast memory between the CPUand main memory, typically on the CPU chip for fast access • Then the hardware automatically speeds up memory access without any operating- system control Basic Hardware 6
  • 7. • To ensure correct operation, must protect the operating system from access by user processes • On multiuser systems, must additionally protect user processes from one another. • This protection must be provided by the hardware because the operating system doesn’t usually intervene between the CPU and its memory accesses (because of the resulting performance penalty) • One possible implementation - • Need to make sure that each process has a separate memory space • To separate memory spaces, we need the ability to determine the range of legal addresses that the process may access and to ensure that the process can access only these legal addresses • This protection will be provided by using two registers, usually a base and a limit registers • Base register - holds the smallest legal physical memory address • Limit register - specifies the size of the range Basic Hardware 7
  • 8. Basic Hardware 8 • For example, if the base register holds 300040 and the limit register is 120900, then the program can legally access all addresses from 300040 through 420939 (inclusive) • Protection of memory space is accomplished by having the CPU hardware compare every address generated in user mode with the registers
  • 9. Basic Hardware 9 • Any attempt by a program executing in user mode to access operating-system memory or other users’ memory results in a trap to the operating system, which treats the attempt as a fatal error (modifying the code or data structures of either the operating system or other users)
  • 10. • The base and limit registers can be loaded only by the operating system, which uses a special privileged instruction • Privileged instructions can be executed only in kernel mode, only OS executes in kernel mode • This allows the operating system to change the value of the registers but prevents user programs from changing the registers’ contents • The operating system, executing in kernel mode, is given unrestricted access to both operating-system memory and users’ memory • This provision allows the operating system to load users’ programs into users’ memory, to dump out those programs in case of errors 10 Basic Hardware
  • 11. • A program resides on a disk as a binary executable file • To be executed, the program must be brought into memory and placed within a process • Depending on the memory management in use, the process may be moved between disk and memory during its execution • The processes on the disk that are waiting to be brought into memory for execution are available in input queue/Device queue • The normal single-tasking procedure is to select one of the processes in the input queue and to load that process into memory • As the process is executed, it accesses instructions and data from memory • Eventually, the process terminates, and its memory space is declared available • Addresses may be represented in different ways during these steps (next slide) 11 Address Binding
  • 12. • Addresses in the source program are generally symbolic (such as the variable count) • A compiler typically binds these symbolic addresses to relocatable addresses (such as “14 bytes from the beginning of this module”) • The linkage editor or loader in turn binds the relocatable addresses to absolute addresses (such as74014) • Each binding is a mapping from one address space to another • The binding of memory address to instruction and data is called address binding 12 Address Binding
  • 13. • Address binding of instructions and data to memory addresses can happen at three different stages • Compile time - If you know at compile time where the process will reside in memory,This is called compile time binding.Then the code generated is called absolute code .We must recompile code if starting location changes. Example: MSDOS .com format programs are bound at compile time • Load time - If it is not known at compile time where the process will reside in memory, then must delay binding till load time. The compiler must generate relocatable code. In this case, final binding is delayed until load time. If the starting address change, we need only reload the user code to incorporate this changed value. • Execution time - If the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time 13 Address Binding
  • 14. • An address generated by the CPU is commonly referred to as a logical address (generated by CPU when a program is running) • An address seen by the memory unit—that is, the one loaded into the memory- address register of the memory—is physical address (location in a memory unit) • The compile-time and load-time address-binding methods generate identical logical and physical addresses • The execution-time address-binding scheme results in differing logical and physical addresses, refer to the logical address as a virtual address • The set of all logical addresses generated by a program is a logical address space • The set of all physical addresses corresponding to these logical addresses is a physical address space • In the execution-time address-binding scheme, the logical and physical address spaces differ • The run-time mapping from virtual to physical addresses is done by a hardware device called the memory-management unit (MMU) 14 Logical Versus Physical Address Space
  • 15. 15 Logical Versus Physical Address Space • Illustrating run-time mapping with a simple MMU scheme that is a generalization of the base-register scheme • The base register is now called a relocation register • In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time the address is sent to memory
  • 16. • The user program never sees the real physical addresses, deals with logical addresses • The memory-mapping hardware converts logical addresses into physical addresses • Only when it is used as a memory address (in an indirect load or store, perhaps) is it relocated relative to the base register • Two different types of addresses • Logical addresses (in the range 0 to max) and • Physical addresses (in the range R + 0 to R + max for a base value R) • The user program generates only logical addresses and thinks that the process runs in locations 0 to max • However, these logical addresses must be mapped to physical addresses before they are used 16 Logical Versus Physical Address Space
  • 17. • A routine is not loaded into main memory until it is called • All routines are kept on disk in a relocatable format • The main program is loaded into memory and is executed • When a routine needs to call another routine, the calling routine first checks to see whether the other routine has been loaded • If it has not, the relocatable loader is called/invoked to load the desired routine into memory and to update the program’s address tables to reflect this change • Then control is passed to the newly loaded routine • Advantage of dynamic loading - • A routine can be loaded only when it is needed • This method is particularly useful when large amounts of code are needed to handle infrequently occurring cases, such as error routines 17 Dynamic Loading
  • 18. • Dynamically linked libraries are system libraries that are linked to user programs when the programs are run - These libraries are also called as shared libraries • Some operating systems support only static linking, in which system libraries are treated like any other object module and are combined by the loader into the binary program image • Dynamic linking, in contrast, is similar to dynamic loading, rather than loading, is postponed until execution time • Example - Language subroutine libraries.Many OS environments allow dynamic linking, that is the postponing of the resolving of some undefined symbols until a program is run • Without dynamic linking, each program on a system must include a copy of its language library in the executable image • This requirement wastes both disk space and main memory • With dynamic linking, a stub is included in the image for each library routine reference 18 Dynamic Linking and Shared Libraries
  • 19. • Stud - • The stub is a small piece of code that indicates how to locate the appropriate memory-resident library routine or how to load the library if the routine is not already present • When the stub is executed, it checks to see whether the needed routine is already in memory • If it is not, the program loads the routine into memory • The stub replaces itself with the address of the routine and executes the routine • Thus, the next time that particular code segment is reached, the library routine is executed directly, incurring no cost for dynamic linking • Advantages of Dynamic linking - • A library may be replaced by a new version, and all programs that reference the library will automatically use the new version • Without dynamic linking, all such programs would need to be relinked to gain access to the new library 19 Dynamic Linking and Shared Libraries
  • 20. • Often-used libraries (for example the standard system libraries) need to be stored in only one location, not duplicated in every single binary • If a bug in a library function is corrected by replacing the library, all programs using it dynamically will benefit from the correction after restarting them • Programs that included this function by static linking would have to be re-linked first 20 Dynamic Linking and Shared Libraries
  • 21. 21 References 1. Silberscatnz and Galvin, “Operating System Concepts,” Ninth Edition, John Wiley and Sons, 2012.