You are on page 1of 14

Project 5: Virtual Memory

COS 318
Fall 2013

Project 5 Schedule

Design Review

onda!" #ov 25 10$%in ti%e slots &ro% 10a% to 8'%

Due date( )ed Dec *" 11(55'%

+eneral Suggestions

Project is not divided into 'hases, Follow the rough chec-list in the 'roject 5 s'ecs, +et &a%iliar with the 2$level 'age ta.le descri'tion o& i38/, Read section 3,0,1 and *,2 o& the 1ntel %anual, 2oo- at new PC3 structure in kernel.h, 4s alwa!s" start as earl! as !ou can" and get as %uch done as 'ossi.le .! the design review,

Project 5 Overview

1%'le%ent 'age allocation and eviction 'olic!, 1nitiali5e the %e%or! la!out 6-ernel 'ages7, Set u' each 'rocess8 %e%or!, Swa' 'ages in9out o& dis- : de%and 'aging, Page &ault handler, Relevant &iles( memory.h and memory.c #o asse%.l! 'rogra%%ing

<=tra credit( 3etter eviction 'olic!,

2$2evel Page >a.le 6i38/7

See section 3,0,1 in 1ntel

anual 6', 8*$857

Director! <ntries

See section *,2 in 1ntel

anual 6', 10/$1007

>a.le <ntries

See section *,2 in 1ntel

anual 6', 10/$1007

<ntr! Flags

See section *,2 in 1ntel

anual 6', 10/$1007

P( Page9Page ta.le loaded? @9S( @ser access? 0 : no user access R9)( @ser read9write? 0 : user read$onl! 4( 4ccessed? set on swa'$in D( Dirt! 'age? use at swa'$out

Page 4llocation and <viction

De&ine a 'age %a' data structure to trac- all 'ages and their %etadata 6in memory.h7, 1& there is a &ree 'age" si%'l! use it, Otherwise" !ou need to swa' a 'age out, Recall that !ou can pin 'ages : can8t evict these 'agesA Si%'le eviction 'olic!( e,g, F1FO

1nitiali5e Bernel

e%or!

4llocate #CB<R#<2CP>S 6'age ta.les7 For each 'age ta.le" allocate 'ages until !ou reach 4DCPEFS1C42C < ORF, 1%'ortant( 'h!sical address G virtual address, a-e sure to set correct &lagsA +ive the user 'er%ission to use the screen,

Setting u' Process

e%or!

Processes -ee' trac- o& * t!'es o& 'ages(


Page director! Page ta.les Stac- 'age ta.le Stac- 'ages @se one 'age ta.le and allocate all 'ages, #eeds 'c.$Iswa'Csi5e %e%or!, 4llocate #CPROC<SSCS>4CBCP4+<S,

PROC<SSCS>4R> 6vaddr o& code H data7


PROC<SSCS>4CB 6vaddr o& stac- to'7

Swa''ing 'ages in and out


@S3 dis- i%age &or swa' storage, Swa' in &or allocation" swa' out &or eviction, 4ssu%e that 'rocesses do not change si5e, Processes use whichever location the! were originall! loaded &ro% 6'c.$Iswa'Cloc7, @se usb/scsi.h &or read and write &unctions, Bee' in %ind( )hen do !ou need to &lush the >23?

Eandling Page Faults


+et a &ree 'age &ro% the 'age allocator, Swa' in the 'age, @'date the 'age ta.le entr! to the 'age8s address and set the 'resent &lag,

So%e %ore ti's,,,

One 'age ta.le is enough &or a 'rocess8 code and data %e%or! s'ace, So%e &unctions 6es'eciall! 'age &ault handler7 can .e interru'tedA

@se a s!nchroni5ation 'ri%itive, Bernel 'ages" 'rocess 'age director!" 'age ta.les" stac- 'age ta.les and stac- 'ages, )ith res'ect to gradingA

So%e 'ages don8t need to .e swa''ed out,

You might also like