Question
# Variables: # NBA: number of bits in the virtual address # NBO: number of bits for offset in the virtual address # NBP: number
# Variables: # NBA: number of bits in the virtual address # NBO: number of bits for offset in the virtual address # NBP: number of bits for VPN in the virtual address # NP: number of pages # SA: size of the virtual address space # SP: size of a virtual page # # The units of SA and SP are bytes, and I'm assuming that # each byte of memory has its own address.
# For example, suppose a virtual address has 32 bits, and the # size of a page is 4 KB. How many page bits and offset bits # in the virtual address? # # Solution: Since the page size is 4 KB, the number of offset # bits must be 12, because log2(4*1024) is 12. Then the # the number of page bits must be 20, since there are 32 bits # in the virtual address, and subtracting the 12 offset bits # we get 20.
# To solve the problems you need to know these relationships # between the variables: # # NBA = log2(SA), or equally SA = 2^NBA # NBP = log2(NP), or equally NP = 2^NBP # NBO = log2(SP), or equally SP = 2^NBO # NBO + NBP = NBA # # For example, suppose SP (size of a page) is 1024 bytes. Then # the number of offset bits in the virtual address must be log2(1024), # which is 10.
####################################################################### # # PROBLEMS # # After each problem, enter the correct values for the variables shown. # Put your answer right after the equals sign. # Note that 32 KB means 32*1024, and similarly for MB. # #######################################################################
#@ 1 If the size of the virtual address space is 32 KB, and # each page is 2 KB, how many page bits and offset bits in the # virtual address?
NBP= NBO=
#@ 2 If a page is 4 KB, and there are 32 virtual pages, how # many page bits and offset bits in the virtual address?
NBP= NBO=
#@ 3 If the size of the virtual address space is 32 MB, and there are # 2048 virtual pages, how many page bits and offset bits in the virtual address?
NBP= NBO=
#@ 4 If a virtual address is 8 bits, and there are 32 virtual pages, # how many page bits and offset bits in the virtual address?
NBP= NBO=
#@ 5 If a virtual address is 32 bits, and a page is 4 KB, how # many page bits and offset bits in the virtual address?
NBP= NBO=
#@ 6 If there are 1024 virtual pages, and 10 offset bits in a # virtual address, then what is the size of the virtual address space # (in bytes)?
SA=
#@ 7 If the virtual address space is 64 MB, and there are 12 # page bits in a virtual address, then what is the page size?
SP=
#@ 8 If the virtual address space is 32 KB, and each page is 2 KB, # then how many virtual pages are there?
NP=
#@ 9 If there are 4096 pages, and each page is 8 KB, then # how many bits in a virtual address?
NBA=
#@ 10 If a virtual address has 32 bits, and the number of pages # is 1024*1024, then how many offset bits in the virtual address?
NBO=
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started