Memory Management II Dynamic Storage Allocation, Lecture Slide - Computer Science, Slides of Introduction to Computers

Dynamic Storage Allocation, Other placement Policies Buddy systems Implementation Issues

Typology: Slides

2010/2011

Uploaded on 10/07/2011

rolla45
rolla45 🇺🇸

4

(6)

133 documents

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Memory Management II:
Dynamic Storage Allocation
Oct 13, 1998
Topics
other placement policies (cont)
buddy systems
implementation issues (sequential fits)
class15.ppt
15-213
Introduction to Computer Systems
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Memory Management II Dynamic Storage Allocation, Lecture Slide - Computer Science and more Slides Introduction to Computers in PDF only on Docsity!

Memory Management II:

Dynamic Storage Allocation

Oct 13, 1998

Topics

other placement policies (cont)

buddy systems

implementation issues (sequential fits)

class15.ppt

Introduction to Computer Systems

CS 213 F’

class15.ppt

Basic allocator mechanisms

Sequential fits

best fit, first fit, or next fit placement

various splitting and coalescing options

  • immediate or deferred coalescing – splitting thresholds

Segregated free lists

simple segregated storage

segregated fits

  • buddy systems

CS 213 F’

class15.ppt

Segregated fits

To allocate a block of size n:Array of free lists, each one for some size class

search appropriate free list for block of size m > n

if an appropriate block is found:

  • split block and place fragment on appropriate list (optional)

if no block is found, try next larger class

repeat until block is found

To free a block:

coalesce and place on appropriate list (optional)

Tradeoffs

classes)faster search than sequential fits (i.e., log time for power of two size

controls fragmentation of simple segregated storage

coalescing can increase search times

  • deferred coalescing can help

CS 213 F’

class15.ppt

Buddy systems

Special case of segregated fits.

all blocks are power of two sizes

Basic idea:

Heap is 2

m

words^

Maintain separate free lists of each size 2

, 0 <= k <= m.k

Requested block sizes are rounded up to nearest power of 2.

Originally, one free block of size 2

m

CS 213 F’

class15.ppt

Buddy systems (cont)

To free a block of size 2

k

buddy

To free a block of size 2

k

if buddy free, coalesce with buddy and return new block to free list

To free a block of size 2

k

if buddy not free, just return block to free list

CS 213 F’

class15.ppt

Buddy systems (cont)

Key fact about buddy systems:

address of its buddygiven the address and size of a block, it is easy to compute the

e.g., block of size 32 with address

xxx...x00000 has buddy

xxx...x

Tradeoffs:

fast search and coalesce

subject to internal fragmentation

CS 213 F’

class15.ppt

Steele mail fraud case

March 6, 1993 (Pittsburgh, PA)

onto some diskettes, then resigns.copies school board billing records from firm's laptopsSteele & Hoffman, after watching the movie "The Firm",Phil McCalister, disgruntled associate at Pgh law firm

July 29, 1993

Charlie Steele, managing partner of Steele & Hoffman.evidence of systematic overbilling of school systems byMcCalister hands over 4 diskettes to postal instpectors as

September, 1996

originals from March 6, 1993 (they weren't).I'm asked by defense to determine if the 4 diskettes are the

December, 1996

years in federal pen and $80,000 fine.Charlie Steele convicted of mail fraud and sentenced to 3Despite brilliant testimony by the computer expert witness,

CS 213 F’

class15.ppt

Anatomy of a Computer

memory

disk buffer (temporary)

programs

dataand

keyboard

display

hard disk (fixed)

diskette (removeable)

CS 213 F’

class15.ppt^ Internal fragmentation in DOS files

Files allocated in fixed size logical sectors

cluster

data abc

slack (internal fragmentation)

CS 213 F’

class15.ppt

How slack takes a picture of a

disk when a file is copied (1)

abc

source disk

destination disk

disk buffer

1. read source directory ("DE" is directory entry)

DE

DE

DE

DE

CS 213 F’

class15.ppt

How slack takes a picture of a

disk when a file is copied (3)

abc

source disk

destination disk

disk buffer

snapshot of the files on the source disk when the file was copied.3. write file to destination disk. Notice that slack now contains a

DE

DE

DE

DE

abc

DE

DE

DE

DE

abc

CS 213 F’

class15.ppt

Federal diskette F1 is not a duplicate

Cluster

(^) Sector

[F1:1991-$.IN

C1638-1789]

Name

.Ext

Size

Date

Time

Cluster

(^) Arc

R/O

(^) Sys

(^) Hid

(^) Dir

Vol

YS

(^) am

R/O

(^) Sys

(^) Hid

MSDOS

SYS

(^) am

R/O

Sys (^) Hid

CONFIG

SYS

am

Arc

AUTOEXEC

BAT

(^) am

Arc

DOS

4:40 pm

Dir

WININST

4:41 pm

Dir

WINDOWS

4:43 pm

Dir

COMMAND

COM

(^) am

Arc

SCAN

4:50 pm

Dir

WINA

(^) am

HARCHLRD

REG

12:50 pm

Arc

ASP

(^) am

Dir

DO

12:01 pm

Dir

GOLF

12:01 pm

Dir

LOTUS

4:32 pm

Dir

NORTON

12:04 pm

Dir

Source: Norton Utilities Diskedit program

CS 213 F’

class15.ppt

Cluster^ Federal diskette F3 is not a duplicate

Sector

[F3:SUMMARY

C905-936]

Name

.Ext

Size

Date

Time

Cluster

Arc (^) R/O

Sys

Hid (^) Dir

Vol

LOVIS...-----------------------------------------------------------------------------

2:23 pm

Dir

BACKUP

(^) am

Arc

BURRELL

(^) am

Dir

MIFFLINB

(^) am

Dir

Source: Norton Utilities Diskedit program

CS 213 F’

class15.ppt

Files on the federal diskettes came

from the hard disk

Cluster

Sector

[F2:PRICE

C2020-2023]

Name

.Ext

Size

Date

Time

Cluster

Arc (^) R/O

Sys

Hid (^) Dir

Vol

DECEMBER

2:07 pm

Arc

EMWAUG

(^) am

Arc

EMWAUG

2:20 pm

Arc

EMWDEC

1:31 pm

Arc

EMWDEC

(^) am

Arc

EMWDEC

(^) am

Arc

EMWFEB

(^) am

Arc

EMWJAN

5:22 pm

Arc

EMWJUL

(^) am

Arc

EMWJUL

(^) am

Arc

EMWJUL

2:14 pm

Arc

Source: Norton Utilities Diskedit program