lab 3.2 overview - Lab 3.2: Overview David Lie ECE344...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lab 3.2: Overview David Lie ECE344 University of Toronto
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ECE344: Operating Systems Tasks Major Task: – Implement Swapping Minor Task – Performance counters and tuning
Background image of page 2
3 ECE344: Operating Systems Implementing Swap Overview: – In your coremap allocation function, you should currently return an error (or panic) if you can’t satisfy a request for memory Instead: 1. Call page replacement algorithm and select a page to evict 2. Allocate space on swap and write the page out 3. Find all virtual mappings to the physical frame and write the location of swap into the page table entries, mark them as on swap. Set reference count to zero in coremap 4. Zero out the evicted physical frame and have the allocation function return it
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 ECE344: Operating Systems Initializing Swap First you need to pick a disk to use as swap: – By default, two disks are defined in root/sys161.conf: 2 disk rpm=7200 sectors=10240 file=DISK1.img 3 disk rpm=7200 sectors=10240 file=DISK2.img – The drives are mapped onto devices lhd0raw: and lhd1raw: , and can be accessed like files #define SWAP_DEVICE "lhd0raw:” static struct vnode *swap_vnode; retval = vfs_open(SWAP_DEVICE, O_RDWR, &swap_vnode); if (retval) { panic("couldn't open swap device\n"); }
Background image of page 4
5 ECE344: Operating Systems Initializing Swap Next, you will need to get the size of your swap device and
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/20/2012.

Page1 / 14

lab 3.2 overview - Lab 3.2: Overview David Lie ECE344...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online