Download presentation
Presentation is loading. Please wait.
1
1 CSE451 – Section 7
2
2 Usual stuff Project 3 will be due Monday the 27 th Experiment design email to TAs: By midnight on Sunday the 19th Today: Project 3 overview
3
3 Project 3 Given: vmtrace Simulates virtual memory on a memory trace file Tracefile = a list of all VA references during execution Includes: instruction fetch, load, store references Takes in: a memory trace file (given, netscape.exe.et.gz) physical memory size page size Outputs: # of memory references # of page faults compulsory faults page evictions pageouts
4
4 vmtrace help barb%./vmtrace -h Usage: vmtrace [OPTIONS] ALGORITHM [TRACEFILE|-] Process TRACEFILE, simulating a VM system. Reports stats on paging behavior. Zlib is available; input may be compressed. If TRACEFILE is not specified or is '-', input will be taken from stdin. ALGORITHM specifies the fault handler, and should be one of: random Options: -h|--help Print this message and exit. -V|--version Print the version information. -v|--verbose Verbose output. Includes progress output. -t|--test Run self tests. -o FILE|--output=FILE Append statistics output to the given file. -l REFS|--limit=REFS Stop after first REFS refs. -p PAGES|--pages=PAGES Simulate PAGES physical pages. Minimum value 4. -s SIZE|--size=SIZE Simulate a page size of SIZE bytes. Size must be a power of 2. barb%
5
5 vmtrace example output barb%./vmtrace -l 10000 -v random netscape.exe.et.gz vmtrace: using replacement algorithm 'random' vmtrace: reading from netscape.exe.et.gz vmtrace: reached 10000 references phys_pages,pagesize,input_file,fault_handler,ref_limit 128,1024,netscape.exe.et.gz,random,10000 type,code,load,store references,6171,1905,1924 miss,62,48,23 compulsory,53,43,21 evictions,27,16,4 pagetouts,9,7,1 barb%
6
6 P3 Goals Implement some page replacement algorithms Design and perform an experiment on some aspect of virtual memory Important to pick a good topic, ask us if not sure! This is why we ask for your design midway through
7
7 Your job: Replacement Algorithms Given: random You need to write: FIFO LRU Clock One of your choice A few possibilities: True LRU (e.g. via storing full timestamp) Variations on LRU Clock (enhanced second-chance, etc) LFU/MFU Your own! You can write more than 3 if your experiment focuses on replacement algorithms.
8
8 Source code… /* fault handlers are functions that return nothing (void) and * take 2 arguments: a pte_t* and a ref_kind_t. * The pte is the new page that must be inserted, and the * type is for statistical reporting. */ typedef void (*fault_handler_t)(pte_t *pte, ref_kind_t type); /* fault_handler_info_t lets us match the actual function to a * name. fault_handlers is searched by options.c to locate the * handler named on the command line. */ typedef struct _fault_handler_info { char *name; fault_handler_t handler; } fault_handler_info_t; fault.h
9
9 Source code… fault_handler_info_t fault_handlers[2] = { { "random", fault_random }, { NULL, NULL } /* last entry must always be NULL/NULL */ }; void fault_random(pte_t *pte, ref_kind_t type) { int page; page = random() % opts.phys_pages; physmem_evict(page, type); physmem_load(page, pte, type); } fault.c Next: add your own handlers!
10
10 Your job: Project 3 experiment Have a hypothesis “Algorithm y is better than algorithm x” “Big pages are better” “Prefetching will reduce the number of page faults” “If we understand why x happens, we can fix it” Explain why you think it will turn out that way Two steps Determine baseline behavior New test Change one aspect of the system, observe differences
11
11 experiment ideas Good: What is the ideal page size for this trace under different amounts of main memory? Compare performance of various replacement algorithms. How much better/worse is page replacement algorithm X than Y? Compare “real” LRU and LRU clock, FIFO, etc How close can we come to LRU without doing any work between page faults? No scanning, constant work per page fault How important is recency vs. frequency in predicting page re- use? Not so good: What kind of music is made when I convert the address trace to notes? Can I make a fractal out of this data?
12
12 Tips vmtrace is not an execution simulation You control what happens on a page fault You control what happens on a memory access You can modify formats for PTE, page, etc Refresh your scripting skills vmtrace is very CPU-intensive forkbomb: PIII-800/256MB Find faster machines (such as Linux boxes in the lab) Copy the trace file to local machine Full trace can take hours to execute!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.