Open In App

CPU Scheduling Numerical Questions

Last Updated : 11 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

1. Find the size of the memory if its address consists of 22 bits. Assume the memory is 2-byte addressable.
Solution – 
If the given address consists of ‘k’ bits, then 2k locations are possible.
Size of memory = 2k x Size of one location.
According to the question, number of locations with 22 bits = 222 locations
Given that the size of the memory is 2-bytes addressable, which means that the size of one location is 2 bytes.
Hence, the size of memory = 222 x 2 bytes = 223 bytes = 8 MB.

2. Calculate the number of address bits, if the memory has a size of 16 GB. Assume the memory is 4-byte addressable.
Solution –
If the given address consists of ‘k’ bits, then 2k locations are possible.
Size of memory = 2k x Size of one location.
Given that the size of memory is 16 GB. (16 GB = 234 B)
2k x 4 = 234  
2k = 234 / 22  (∵ 22 = 4)
2k = 232
∴ k = 32 bits

3. Consider a machine with 32 bit logical addresses, 4 KB page size and page table entries of 4 bytes each. Find the size of the page table in bytes. Assume the memory is byte addressable.
Solution –
Given – No. of bits = 32 bits
Page Size = 4 KB = 4 x 210 bytes
Page table entry size = 4 bytes
Size of page table = Number of entries in page table x Page table entry size
Number of entries in page table = Process size / Page size
Process Size = Number of address bits  
Thus, Process size = 232 bytes = 230 x 22 bytes = 4 GB
Number of entries in page table = 4 x 230 / 4 x 210 = 220 pages
Size of page table = 220 x 4 = 4 MB

4. Consider a system with page table entries of 8 bytes each. If the size of the page table is 256 bytes, what is the number of entries in the page table?  
Solution – 
Size of page table = Number of entries in the page table x page table entry size
Given – Size of page table = 256 bytes, page table entry size = 8 bytes.
Thus, 256 = number of entries in page table x 8
Number of entries in the page table = 256 / 8 = 32 = 25

5. Find the total number of frames. If a system, size of the main memory is 230 bytes, the page size is 4 KB and the size of each page table entry is 32-bit.  
Solution – 
Given – Size of main memory = 230 B, page size = 4 KB = 22 KB = 212 B (∵ 1 KB = 210 B)
Size of main memory = Total number of frames x page size.
230 = Total number of frames x 212  
Total number of frames = 230 / 212 = 218


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads