The objective of this exercise is to count the number of page faults generated b
ID: 3714981 • Letter: T
Question
The objective of this exercise is to count the number of page faults generated by a program. We assume a pure on demand paging system with a page size of 128 bytes. We also assume that the counter variable I is in a register and that the code must be loaded in a separate frame. The size of the code is 172 bytes. We assume that 4 frames are allocated to this program. The program is:
char aString[1024];
int main(){
int i; for (i = 0; i <= 1024)
sString[i] = ‘a’;
}
i. What is the string of references that this program will generate when accessing data?
ii. How many page faults in total (code and data) will happen? Ju
Explanation / Answer
Solution:
i)
A request will be made to fetch 'a' from the memory to initialize it in aString[] array.
ii)
the loop is running 1025 times, this means 1025 write operations will be done.
FIrst access will be a page fault and after that, all 1024 accesses will be a hit.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.