Chapter 9

clippersdogheartedSoftware and s/w Development

Dec 14, 2013 (3 years and 5 months ago)

69 views

A+ Guide to Software

Managing, Maintaining and Troubleshooting

THIRD EDITION

Chapter 9

Managing

Memory

2

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

You Will Learn…


About the evolution of OS memory
management


How Windows 9x manages memory
addresses and virtual memory


How Windows NT/2000/XP manages
memory


How to troubleshoot OS problems with
memory

3

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

OS Memory Management
Evolution


Decisions made by IBM and Microsoft in the
early 1980s still affect Windows 9x memory use


Early CPUs had only 20 address lines


Largest memory address the CPU could handle was
11111111111111111111 (1,048,575, 1,024K, 1 MB)


DOS and applications used first 640K


BIOS and device drivers used 640K to 1024K

4

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

DOS and Windows 9x Memory

5

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Further Evolution


Later CPUs and motherboards used 24
address lines and more


Memory above 1024K became available,
called
extended memory


Memory addresses expressed using
hexadecimal notation


Upper memory address numbers begin with
A through F

6

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

First Megabyte of Memory in
Windows 9x

7

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

How Memory Addresses are Used


Memory addresses are assigned to
memory and used for communication


Device drivers


The OS


Application software


All components identify data to be
shared by referring to its memory
address

8

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Data Identified by Its Memory
Address

9

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Windows 9x Memory
Management


Supports 32
-
bit, protected mode
applications


Still permits 16
-
bit, real mode device
drivers and applications


Uses a
virtual DOS machine (VDM)


OS totally controls memory access


Enables the use of
virtual memory
, where
memory is stored in
swap file

10

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Real Mode and Protected Mode
Memory Access

11

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Evolution of Memory
Management

12

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

How Windows 9x and DOS
Manage Memory Addressing


ROM BIOS on the motherboard


Some circuit boards


Device drivers


The OS


Applications

Memory mapping is the process of
assigning memory addresses as the PC is
booted to:

13

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

How Windows 9x and DOS
Manage Memory Addressing

(continued)


Conventional

memory

or base
memory: the first 640K


Upper memory
: from 640K to 1024K


Extended memory
: above 1024K


High memory area (HMA)
: the first 64K
of extended memory

14

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Memory Address Map

15

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Conventional Memory


Designed to hold all memory addresses
accessible to the user


Operating system


Application software


Data


Turned out to be grossly inadequate


Couldn’t be rectified in subsequent DOS
versions, because upper memory had
been dedicated to hardware devices

16

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Upper Memory


Memory addresses from 640K to 1024K


Video RAM and ROM


Sixteen
-
bit BIOS programs for legacy
expansion boards


Often has unassigned addresses


Memory management involves using
unassigned upper memory addresses for
device drivers and TSR programs

17

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Expanded Memory and the

High Memory Area


Memory above 1 MB


Managed as a device


Need device driver (memory extender)


Need applications written to use it


High memory area is the first 64K


Exists because of a bug in Intel 286
processors


DOS 5 and above could store portions of
the OS in the HMA

18

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Utilities that Manage Memory


Himem.sys

is device driver for memory
above 640K


Loaded automatically by Windows 9x


Emm386.exe

loads device drivers and
other programs into upper memory


Can be loaded by an entry in Config.sys

19

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Using Himem.sys


Manages memory as a device


Loaded with a
Device=

command in
Config.sys

20

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Himem.sys in Config.sys

21

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Using Emm386.exe


Used to manage memory addresses in
upper memory


Use the
MEM

command to examine
memory allocation


Goal of memory management is to
maximize the amount of free conventional
memory


22

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

A PC Not Using Upper Memory

23

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Creating and Using Upper
Memory Blocks


Himem.sys must be loaded first


Emm386.exe is loaded next


DOS=HIGH

loads DOS into HMA


DOS=UMB

creates
upper memory
blocks

(consecutive memory addresses
in upper memory assigned to physical
memory)

24

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Config.sys Set to Use Upper
Memory

25

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Loading Device Drivers High


Devicehigh=

in Config.sys loads a
device driver into a UMB


Loadhigh

(
LH
) command in
Autoexec.bat loads a program into a
UMB

26

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

How Windows 9x Manages

Virtual Memory


Virtual memory uses hard drive space so
that it acts like memory


Windows stores virtual memory in a
swap file


Increases the amount of memory
available


Works considerably slower than real
memory

27

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Virtual Memory Options

28

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Virtual Memory Options

(continued)


Windows 9x automates virtual memory
management


To improve performance, set the
maximum and minimum size to same
value, preventing the size from changing


Set size to 2.5 times amount of RAM


Location of the swap file can be changed

29

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Memory Paging


Virtual Memory Manager (VMM)


Page

is a 4K segment of memory


Memory paging

is the process of moving
pages in and out of physical RAM


Symptoms of
disk thrashing


Very high CPU use


Very slow system response


Constant hard drive use

30

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Windows NT/2000/XP Memory
Management


Windows NT/2000/XP eliminates the
complexity of DOS and Windows 9x


All memory addresses used the same way


Loses some backwards compatibility


Virtual memory manager


Allocates memory in 4K pages


Swap file is named
Pagefile.sys


31

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Windows NT/2000/XP Memory
Management
(continued)

32

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

How Windows NT/2000/XP
Manages Virtual Memory


Set initial and maximum sizes of the file
to the same value


Balance file size with disk space use


Optimize performance by moving the
paging file off the boot volume


Paging file must be on the same disk as
the OS to capture memory dumps

33

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Changing Paging File Settings

34

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Troubleshooting Memory


Check for viruses


Download latest OS and application
patches from manufacturer’s Web site


Test memory modules


Memtest86 can be downloaded from
http://www.memtest86.com



Determine whether sufficient memory is
installed

35

A+ Guide to Software: Managing, Maintaining and Troubleshooting, Third Edition

Summary


Evolution of OS memory management


Windows 9x memory address and virtual
memory management


Windows NT/2000/XP memory
management


Troubleshooting OS memory problems