Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Assume a 32-bit processor (data/address sizes are 32-bit) with a 256 MB physi

ID: 3771577 • Letter: 1

Question

1. Assume a 32-bit processor (data/address sizes are 32-bit) with a 256 MB physical memory that uses 8KB page size.

(a) What is the maximum number of physical pages in such system (i.e. total number of physical pages).

(b) How many entries does the page table have.
(c) What is the size of the page table (in bits) assuming that each entry contains physical page number, valid bit, dirty bit and a reference bit.

(d) Assume that in such a system, a fully associative TLB with 32 entries is used to accelerate address translation. What is the total size of the TLB (in bits) if it has data, tag, valid, dirty, and a reference bit fields.

Explanation / Answer

#include <stdio.h> int main(void) { char word[12] = ""; char exit[12] = "exit"; boolean a=true; while (a) { printf("enter a new word (or) enter exit”); Scanf(“%s”,word); If(strcmp(word,exit)) { a=false; } Char *matchWords=getMatchWords(words); for(i = 0; i < matchWords.length; i++) { printf("state %d : %s ", i, matchWords [i]); } } Char[] getMatchWords(char[] word) { Char[100] res; FILE *fptr; if ((fptr=fopen("program.txt","r"))==NULL){ printf("Error! opening file"); exit(1); /* Program exits if file pointer returns NULL. */ } char temp[100]; for (i = 0; i < 100; ++i) { // Read a word from the file fscanf(f, "%s", temp); // Allocate memory for the word, because temp is too temporary boolean a= findTarget(word,temp); if(a==true) { } res[i]= temp; } } public static boolean findTarget( String target, String source ) { int target_len = target.length(); int source_len = source.length(); boolean found = false; for(int i = 0; ( i < source_len && !found ); ++i) { int j = 0; while( !found ) { if( j >= target_len ) { break; } /** * Learning Concept: * * String target = "for"; * String source = "Searching for a string within a string the hard way."; * * 1 - target.charAt( j ) : * The character at position 0 > The first character in 'Target' > character 'f', index 0. * * 2 - source.charAt( i + j) : * * The source strings' array index is searched to determine if a match is found for the * target strings' character index position. The position for each character in the target string * is then compared to the position of the character in the source string. * * If the condition is true, the target loop continues for the length of the target string. * * If all of the source strings' character array element position matches the target strings' character array element position * Then the condition succeeds .. */ else if( target.charAt( j ) != source.charAt( i + j ) ) { break; } else { ++j; if( j == target_len ) { found = true; } } } } return found; } }