



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Different levels of memory Some are small & fast Others are large & slow
Cache: small amount of fast, expensive memory L1 (level 1) cache: usually on the CPU chip L2 & L3 cache: off-chip, made of SRAM Main memory: medium-speed, medium price memory (DRAM) Disk: many gigabytes of slow, cheap, non-volatile storage
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Operating system (perhaps with device drivers) Single process
Memory protection may not be an issue (only one program) Flexibility may still be useful (allow OS changes, etc.)
Operating system (RAM) User program (RAM) 0xFFFF 0xFFFF 0 0 User program (RAM) Operating system (ROM) Operating system (RAM) User program (RAM) Device drivers (ROM)
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
At 20% I/O wait, 3– processes fully utilize CPU At 80% I/O wait, even 10 processes aren’t enough
0
1 0 1 2 3 4 5 6 7 8 9 10 Degree of Multiprogramming CPU Utilization 80% I/O Wait 50% I/O Wait 20% I/O Wait
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Special CPU registers: base & limit Access to the registers limited to system mode Registers contain Base: start of the process’s memory partition Limit: length of the process’s memory partition Address generation Physical address: location in actual memory Logical address: location from the process’s point of view Physical address = base + logical address Logical address larger than limit => error Process partition OS 0 0xFFFF Limit Base 0x 0x Logical address: 0x Physical address: 0x1204+0x9000 = 0xa
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Allocate more memory for data Larger stack
Inefficient: wastes memory that’s not currently in use What if the process requests too much memory? OS Code Data Stack Code Data Stack Process B Process A Room for B to grow Room for A to grow
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Keep track of free / allocated memory regions with a bitmap One bit in map corresponds to a fixed-size region of memory Bitmap is a constant size for a given amount of memory regardless of how much is allocated at a particular time Chunk size determines efficiency At 1 bit per 4KB chunk, we need just 256 bits (32 bytes) per MB of memory For smaller chunks, we need more memory for the bitmap Can be difficult to find large contiguous free areas in bitmap
8 16 24 32
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Search through region list to find a large enough space Suppose there are several choices: which one to use? First fit: the first suitable hole on the list Next fit: the first suitable after the previously allocated hole Best fit: the smallest hole that is larger than the desired region (wastes least space?) Worst fit: the largest available hole (leaves largest fragment) Option: maintain separate queues for different-size holes
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Merge adjacent free regions into a single region May involve merging two regions with the just-freed area A X B A X X B X
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
CS 1550, cs.pitt.edu Chapter (^4 ) (originaly modified by Ethan
Addresses local to the process Hardware translates virtual address to physical address
Usually on the same chip as the CPU Only physical addresses leave the CPU/MMU chip
Virtual addresses from CPU to MMU Physical addresses on bus, in memory