DOC PREVIEW
UMD CMSC 412 - Homework #6

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMSC 412 Homework SixName:Read Ch 7, 8, 9.Due Thursday November 5.Type, please. 10-11 point times (serif) roman (not italic, no bold) or similar, single or 1.5 spaced, 1 inch margins.(I don’t mean to define a specific style; missing one or two of these is fine, I won’t grade it down.)As always, if you use sources on-line (e.g., wikipedia, pages found by google, man pages), please cite. Thisassignment is meant to be done individually.Point totals are approximate, subject to change.1. (6 points) Implement a utility program (similar to Unix cp) that copies an input file to one output file. Theimplementation must use memory-mapped files. Turn in the code (printed).Guidelines and Hints:Your program will take as command line arguments the file names of the input and the output files. Fail nicely ifthe input file does not exist.Procedure:• open() both files.• Call fstat() to obtain the size of the input file. (You need the size of the input file for mmap plus is needit to set the size of the output file in mmap.)• Call lseek() and write one byte to set the size of the output file. (scripts/zerofile uses the same trick inPerl.) If you don’t set the size of the output file size, the call to mmap will succeed but the first reference tothe associated memory area will generate SIGBUS.• Call mmap() for each of the files to map them into memory.• Use memcpy() to perform the copy.• exit() (closing and unmapping are implicit).Consult man pages to find required include files.2. (2 points) Contrast internal and external fragmentation.3. Consider a system with a 32-bit logical address and 4-KB pages. The system supports up to 512 MB physicalmemory. How many entries are there in:i. (1 point) a conventional single-level page tableii. (1 point) an inverted page table4. (3 points) (a) What is Beladys anomaly? (b) Do FIFO (first-in, first-out), LILO (last-in, last-out), and LRU (least-recently used) suffer from Beladys anomaly? (c) What is the common feature of the page replacement algorithmsthat do not suffer from Beladys anomaly?5. (2 points) How large is the page table of a process that can address 2 GB in 4 KB pages. (32 bit addresses; assumeonly 8 bits are needed for flags.) (This is an ordinary page table, not hierarchical, not inverted, not hash based.)6. (6 points) (9.8) Consider the following page reference string:1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6 How many faults would occur for the following three replacement algo-rithms assuming one, two, three, four, five, six, seven frames.scheme 1 page 2 3 4 5 6 7LRUFIFOOPT7. A simplified view of thread states includes only Ready, Running, and Blocked.i. (1 point) Will a thread change state if it incurs a page fault? If so, to what state?Page 1 of 2CMSC 412 Homework Sixii. (1 point) Will a thread change state if it incurs a TLB miss that is resolved in the page table? If so, to whatstate?8. (2 points) What hardware support is required to implement copy-on-write?9. If you’re monitoring the rate at which the pointer in the clock algorithm advances, what can you say about thesystem ifi. (1 point) The pointer is moving fast.ii. (1 point) The pointer is moving slow or is still.Page 2 of


View Full Document

UMD CMSC 412 - Homework #6

Documents in this Course
Security

Security

65 pages

Deadlocks

Deadlocks

22 pages

Set 2

Set 2

70 pages

Project 2

Project 2

21 pages

Load more
Download Homework #6
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework #6 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework #6 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?