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.! the design review.0. Read section 3. 4s alwa!s" start as earl! as !ou can" and get as %uch done as 'ossi.le . 2oo.at new PC3 structure in kernel.1 and *.le descri'tion o& i38/.2 o& the 1ntel %anual.h.

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

8*$857 .1 in 1ntel anual 6'.2$2evel Page >a.le 6i38/7 ● See section 3.0.

Director! <ntries ● See section *.2 in 1ntel anual 6'. 10/$1007 .

le <ntries ● See section *.2 in 1ntel anual 6'.>a. 10/$1007 .

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 .<ntr! Flags ● ● ● ● ● ● See section *.2 in 1ntel anual 6'. 10/$1007 P( Page9Page ta.

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

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

● PROC<SSCS>4R> 6vaddr o& code H data7 – – ● PROC<SSCS>4CB 6vaddr o& stac. #eeds 'c.Setting u' Process ● e%or! Processes -ee' trac.'ages @se one 'age ta. 4llocate #CPROC<SSCS>4CBCP4+<S.le and allocate all 'ages.o& * t!'es o& 'ages( – – – – Page director! Page ta.$Iswa'Csi5e %e%or!.'age ta.le Stac.les Stac.to'7 – .

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

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

'age ta.les and stac.e swa''ed out.. Bernel 'ages" 'rocess 'age director!" 'age ta. So%e &unctions 6es'eciall! 'age &ault handler7 can .les" stac. )ith res'ect to gradingA ● So%e 'ages don8t need to .. ● One 'age ta. – – .So%e %ore ti's.e interru'tedA – ● @se a s!nchroni5ation 'ri%itive.'ages.le is enough &or a 'rocess8 code and data %e%or! s'ace.