Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 2: Memory and Process Management, (syazwan) memory management…
Chapter 2: Memory and Process
Management
Page management Strategies
Placement = Where in primary memory should data be placed
Replacement = Which page should be replaced, if primary memory is full
Fetch = When to bring data into primary memory
Fetch Strategy
Determines when pages or segments should be loaded into main memory 1. Demand paging 2. Anticipatory paging
Placement strategy
allocator receives memory from the operating system in a small number of large blocks that it must divide up to satisfy the requests for smaller blocks.
There are many common ways to perform this, with
different strengths and weaknesses.
process of assigning blocks of
memory on request.
1 Best fit strategy
The memory manager places a process in the
smallest memory in which it will fit.
This strategy produces the smallest leftover hole.
Entire list of holes is to be searched
Search of entire list can be avoided by keeping the
list of holes sorted by size.
Worst Fit Strategy
In contrast, this strategy aims to produce the largest leftover hole, which may be big enough to hold another process
Allocate the largest hole.
3 First Fit Strategy
Searching may start either at the beginning of the set
of holes or where the previous first-fit search ended.
Stop searching as soon as first hole large enough to
hold the process is found
Allocate the first hole that is big enough.
The first fit approach tends to fragment the blocks near the beginning of the list without considering blocks further down the list.
Replacement Strategies
If no frame is free, we find one that is not currently being
used and free it.
When a process generates a page fault, the memory manager must locate referenced page in secondary storage, load it into page frame in main memory and update corresponding page table entry
We can free a frame by writing its contents to swap space and changing the page table (and all other tables) to indicate that the page is no longer in memory.
Replacement Strategies
First-In-First-Out (FIFO)
Least-Recently-Used
(LRU) Least-Frequently-Used
(LFU) Least-Recently-Used
(NUR) Not-Used-Recently
what is routines?
(dominic)
A section of a program that performs a particular task
The term routine is synonymous with procedure, function,
and subroutine.
There are two types of routine:
Resident routine
Permanent in memory
Normally, a computer does not have enough memory
to hold all the programs you use
When you want to run a program, therefore, the operating system is obliged to “ free some memory by copying data or programs from main memory to a disk.”
This process is known as swapping.
A process can be swapped
temporarily out of memory to a backing store, and then brought back into memory for continued execution.
Transient routine.
Transient refers to a module that, once loaded into main memory, is
expected to remain in memory for a short time.
The term overlay is commonly used instead, and refer to a program module that is brought to memory when it is needed by the running program and then replaced with another when it is no longer needed, so a program had lower memory requirements.
Comparison Between Resident And Transient
Routines
Resident Routines
A routine that stays in memory
Example: routine that control
physical I/O
Routines that directly support application programs as they run
Transient Routines
A routine that is loaded as needed.
Stored on disk and reading memory only when needed
Example: routine that formats
disks
Anding
Memory management: Functions (Activities)
Keeping track of which parts of memory are currently
being used and by whom
Deciding which processes (or parts thereof) and data to
move into and out of memory
Allocating and de-allocating memory space as needed
Four Level of Memory Hierarchy Characteristics
The memory technology and storage organization at
each level are characterized by five parameters:
A) Access time: the round-trip time from the CPU to the memory
B) Memory size: the number of bytes or words
C) Cost per byte: cost of the memory estimated by the product
D) transfer bandwidth: rate at which information is transferred between adjacent levels
E) unit of transfer: size for data transfer
2) Main Memory
ii) It is usually much larger than
the cache and often implemented by the most costeffective RAM chips.
i)The main memory is sometimes called the primary memory of a computer system.
iii) The main memory is managed
by a MMU in cooperation with the operating system.
1) Registers and Caches
ii)The cache is controlled by
the Memory Management Unit (MMU) and is
programmer-transparent.
i) The register and the
cache are parts of the processor complex, built
either on the processor chip or on the processor
board.
3&4) Disk Drives and Tape Units
i) Disk drives and tape units are handled
by the OS with limited user intervention.
iii) The magnetic tape units are off-line
memory for use as backup storage. They hold copies of present and past
user programs and processed results
and files.
ii) The disk storage is considered the
highest level of on-line memory. It holds the system programs such as the OS
and compilers and some user programs and their data sets.
Memory devices at a lower level are:
i) faster to access,
ii) smaller in size, and
iii) more expensive per byte,
iv) having a higher bandwidth and
v) using a smaller unit of transfer as compared with those at a higher level.
• The Operating System ( Resident & Transient Routines ) occupies low memory.
• The remaining memory is the transient area
Fixed-Partition
(Erika)
Partitions fixed at system initialization time and may not be changed during system operation.
Divide the memory into a number of separate fixed areas, each of which can hold one process.
Divide memory into fixed size partitions, possibly of different size.
used in early multi-programming operating systems involved partitioning the available primary memory into a number of regions.
Most simple memory management scheme for multi-programmed systems
Fixed partitions have fixed size and usually cannot be easily expanded or shrunk.
Fixed Partition
Advantage :
Simplicity.
Easy to implement.
Multiprogramming
Dynamic Partition
Dynamic partitions can change size by themselves when they need it.
Allow the partitions to be variable in size at load time.
Allocate to the process the exact amount of memory it requires.
the transient area is treated as a pool of unstructured free space.
Because a program gets only the space it needs, relatively little is wasted.
Advantages :
Jobs are given only as much memory as they request. Still, contiguous blocks are needed. Internal fragmentation problem is solved.
Disadvantage :
Suffer external fragmentation
What is Virtual Memory(Part 7)
Technique that allows the execution of processes that are not completely in memory.
is used by the operating system in order to enhance the storage capacity of the working memory, without requiring the installation of additional Random Access Memory modules.
combines your computer’s RAM with temporary space on your hard disk.
Segmentation
is similar to dynamic partitioning
a program is divided into several segments, each similar to a partition of varied size.
is usually visible, which is actually based on the programmers’ logical view of programs.
programs are divided into variable size segments, instead of fixed size pages.
Programs are segmented automatically by compiler or assembler.
Paging
The ways in which the operating system can store and retrieve data
From secondary storage for use in main memory.
Break the main memory into fixed-sized blocks called frames and break the program or process image into blocks of the same size called pages.
The program is bought into memory for execution as pages.
its pages are loaded into any available frames, as illustrated in Figure 8.
leads to problem of Internal Fragmentation
When a page of smaller size than the size of frame is placed in a larger size frame, it leads to unused memory space within a frame.
This wastage of unused memory is called Internal Fragmentation
Advantage :
It allows the physical address space of a process to be non-contiguous.
Disadvantage:
Internal fragmentation occur.
Segmentation and Paging
addresses are divided into a segment number, a page number within that segment, and a displacement within that page.
(syazwan) memory management strategies
Placement Strategy