Operating System - Memory Management - Notes, Study notes for Operating Systems. Indian Institute of Information Technology (IIIT)
visir66
visir661 September 2011

Operating System - Memory Management - Notes, Study notes for Operating Systems. Indian Institute of Information Technology (IIIT)

PPT (1 MB)
51 pages
41Number of download
1000+Number of visits
100%on 1 votesNumber of votes
Description
Detailed informtion about MEMORY MANAGEMENT, Protection Hardware, Swapping, Memory Partition, Paging, Segmentation.
20points
Download points needed to download
this document
Download the document
Preview3 pages / 51
This is only a preview
3 shown on 51 pages
Download the document
This is only a preview
3 shown on 51 pages
Download the document
This is only a preview
3 shown on 51 pages
Download the document
This is only a preview
3 shown on 51 pages
Download the document
Module 7: Process Synchronization

MEMORY MANAGEMENT

OUTLINE

• Basic memory management • Protection Hardware • Swapping • Memory Partition • Paging • Segmentation

Basics of memory

• Memory is required for every operation. • Memory is large array of words or bytes having its

own address. • All instructions are stored in the memory. • As per value of the PC, CPU fetches instructions

from memory.

Memory Management issues

• Basic Hardware issue. • Binding of symbolic memory address to actual

physical address. • Difference between logical address and physical

address • Memory allocation & Deallocation

A typical instruction execution cycle

• First instruction is fetched from memory. • Then it is decoded and as per requirement

operands are also fetched from memory. • Operation is performed on the operands. • Results are stored back to the memory.

Memory Management Task

Problem 1: • Two programs sharing memory simultaneously Problem 2: • One program shouldn’t be allowed to

access/change the memory of another program Problem 3: • Machine may have only 256MB of main memory,

while running a program which needs 600 MB.

Memory Management Task

• Operating system must manage sharing of physical memory between many processes

Basic Memory Hardware.

• Main Memory and registers are directly accessible to the processor.

• There are memory instruction that takes memory addresses as an argument, none of them take disk address.

So every Data and instructions are required to loaded in to these direct access storage devices.

Need of Memory Protection

• Memory Protection is important at the time of memory allocation and deallocation.

MEMORY PROTECTION

• Each Process needs separate memory space. • The overlapping is not allowed. • For separation we need to have

– Base Register – Limit Register For any access to the main memory.

A base and a limit register define a logical address space

Address Binding

• Program must be brought into memory and placed within a process for it to be run

Input queue – collection of processes on the disk that are waiting to be brought into memory to run the program

• User programs go through several steps before being run

Address Binding

• Two type of Addresses – Symbolic Address (Generated by the program for

example requirements like 5 memory blocks etc) – Relocatable address (actual physical position of the

memory block) • Address Binding is required for any execution.

Address Binding

Compile time: • Load time: • Execution time

• The concept of a logical address space that is bound to a separate physicaladdress space is central to proper memory management – Logical address – generated by the CPU; also

referred to as virtual address Physical address – address seen by the memory unit

Logical vs. Physical Address Space

Memory-Management Unit (MMU)

• Hardware device that maps virtual to physical address In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory The user program deals with logical addresses; it never sees the real physical addresses

Dynamic relocation using a relocation register

18

Modeling Multiprogramming

CPU utilization as a function of number of processes in memory

Degree of multiprogramming

How to get good performance.

• With High Degree of Multi programmability. • More program should be there into main memory. • So memory Swapping is required.

How to get good performance.

• Programs spend much of their time accessing memory, so performance is important!

• Programmers want unlimited fast memory, but – Memory (hardware) has a cost – Faster memory is more expensive

• The solution is to put a fast memory (Cache) Between Processor and main memory.

Memory Hierarchy

• Memory hierarchy – small amount of fast, expensive memory – cache – some medium-speed, medium price main memory – gigabytes of slow, cheap disk storage

• Memory manager handles the memory hierarchy

Memory Hierarchy

CPU Registers

Cache Memory

Primary Memory

Rotating Magnetic Memory

Optical Memory

Sequential Accessed Memory

Executable Memory

Secondary Storage

~500 Bytes

< 10MB

< 1GB

< 100GB (per device)

< 15GB (per device)

< 5GB (per tape)

Primary Memory • Primary Memory Design Requirements

– Minimize access time: hardware and software requirement

– Maximize available memory: using physical and virtual memory techniques

– Cost-effective: limited to a small percentage total

• Memory Manager Functions – Allocate memory to processes – Map process address space to allocated memory – Minimize access times while limiting memory

requirements

Transferring Process from secondary storage to main memory. • Program must be brought into memory and placed

within a process for it to be run • Input queue – collection of processes on the disk

that are waiting to be brought into memory to run the program

• User programs go through several steps before being run

Types of Memory Partition

• Partition memory into regions with fixed boundaries – Equal-size partitions

• program size <= partition • program size > partition size, then must use overlays • Use swapping when no available partitions

– Unequal-size partitions • Main memory use is inefficient, suffers from

Internal Fragmentation

comments (0)
no comments were posted
be the one to write the first!
This is only a preview
3 shown on 51 pages
Download the document