


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A sample midterm exam for cmpsci 377, focusing on memory management and address spaces. It includes short answer questions on hierarchical multi-level page tables, tlb, and the generational hypothesis. Additionally, it discusses a solution to prevent double free errors and calculates the space consumption of single and multi-level page tables.
Typology: Quizzes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



**This sample midterm is not to scale: there will be more short answer and true false questions.
2. Memory Management Given the following code: *char ptr = malloc (10) free ptr; free ptr; The allocator you wrote for project two will probably crash. This is referred to as a “double free” and is actually a frequent programming error. Some allocators can handle this kind of error gracefully. This is what my free code looks like (some details are omitted, but assume this works): free(void *ptr){ BibopHeader *bbh FreeObject *fo_ptr = (FreeObject *) ptr; bbh= find_bbheader (ptr); unsigned int num_objects = maxobjects(bbh); // Gives number of possible objects in page // A *((FreeObject **)fo_ptr) = bbh->_freeList; bbh->_freeList = fo_ptr; // B bbh->_available++; // Free and unlink the page if it is empty free_page_if_empty(bbh); }
3. Address Spaces Consider a computer with the following properties: