Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nachos Filesystem

2,807 views

Published on

  • Be the first to like this

Nachos Filesystem

  1. 1. Nachos filesystem 0.01 Kang Zhang( jobo.zh@gmail.com ) 2008-12-04
  2. 2. Agenda
  3. 3. Agenda • History • Installation • Your task • Implementation details • Hints
  4. 4. History of Nachos filesystem
  5. 5. History of Nachos filesystem • Nachos in C++ • Nachos in java( initial version) • Nachos 5.0j
  6. 6. Installation of phase 5
  7. 7. Installation of phase 5 1) Download the patch from our site.
  8. 8. nachos/ filesys/ Directory.java Installation of DirectoryEntry.java FileHeader.java RealOpenFile.java FilesysKernel.java phase 5 RealFileSystem.java FilesysProcess.java RealFileSystemUtil.java BitMap.java 1) Download the patch from our machine/ Machine.java site. Disk.java SynchDisk.java Lib.java proj5/ nachos.conf Makefile test/ hl.coff hl.c
  9. 9. nachos/ filesys/ Directory.java Installation of DirectoryEntry.java FileHeader.java RealOpenFile.java FilesysKernel.java phase 5 RealFileSystem.java FilesysProcess.java RealFileSystemUtil.java BitMap.java 1) Download the patch from our machine/ Machine.java site. Disk.java SynchDisk.java 2) Merge these code with yours. Lib.java proj5/ nachos.conf Makefile test/ hl.coff hl.c
  10. 10. Installation of phase 5
  11. 11. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2)
  12. 12. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf.
  13. 13. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf. 5) Modify FilesysProcess.java and FilesysKernel.java
  14. 14. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf. 5) Modify FilesysProcess.java and FilesysKernel.java public class FilesysProcess extends UserProcess{
  15. 15. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf. 5) Modify FilesysProcess.java and FilesysKernel.java public class FilesysProcess extends UserProcess{ 6) Merge test/ directory with your test/
  16. 16. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf. 5) Modify FilesysProcess.java and FilesysKernel.java public class FilesysProcess extends UserProcess{ 6) Merge test/ directory with your test/ 7) Run phase5 (win)
  17. 17. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2) 4) Merge proj5/nachos.conf with proj2/nachos.conf. 5) Modify FilesysProcess.java and FilesysKernel.java public class FilesysProcess extends UserProcess{ 6) Merge test/ directory with your test/ 7) Run phase5 (win) $java nachos.machine.Machine -x hl.coff -[] nachosproj5nachos.conf
  18. 18. Installation of phase 5
  19. 19. Installation of phase 5 8) Done, it works! nachos 5.0j initializing... config interrupt timer processor console user-check grader hello worldMachine halting! Ticks: total 551314, kernel 551000, user 314 Disk I/O: reads 18, writes 0 Console I/O: reads 0, writes 11 Paging: page faults 0, TLB misses 0 Network I/O: received 0, sent 0
  20. 20. Installation of phase 5 8) Done, it works! nachos 5.0j initializing... config interrupt timer processor console user-check grader hello worldMachine halting! Ticks: total 551314, kernel 551000, user 314 Disk I/O: reads 18, writes 0 Console I/O: reads 0, writes 11 Paging: page faults 0, TLB misses 0 Network I/O: received 0, sent 0
  21. 21. Limits
  22. 22. Limits • unsafe for multiple processes • has limited file size(4k) • flat directory structure
  23. 23. Overview of nachos filesystem
  24. 24. Overview of nachos filesystem Nachos FileSystem OpenFile StubFileSystem JVM Runtime RealFileSystem RealOpenFile StubOpenFile Disk,Directory SynchDisk ...
  25. 25. Overview of disk
  26. 26. Overview of disk Hard Disk Driver root freemap filenodes directory
  27. 27. Overview of disk Hard Disk Driver root freemap filenodes directory
  28. 28. Overview of disk Hard Disk Driver root freemap filenodes directory
  29. 29. Overview of disk Hard Disk Driver root freemap filenodes directory
  30. 30. Inside a file
  31. 31. Inside a file Helloworld.coff File info: File length, etc. File pointers: Sector 1 Sector 2 Sector 3 Sector k Sector n-2 Sector n-1 Sector n INode FNode
  32. 32. Inside a file File info: File length, etc. File pointers: Sector 1 Sector 2 Sector 3 Sub Sector k-1 sectors Sub Sub Sub sectors sectors sectors INode FNode
  33. 33. Directory
  34. 34. Directory • Directory • Contains a list of directory entries • DirectoryEntry • Stores basic info about a file
  35. 35. File
  36. 36. File • FileHeader • Contains pointers to actual data on disk. • SynchDisk • For concurrent access. • RealOpenFile
  37. 37. Your task
  38. 38. Your task • Remove restrictions on file size and enable user to create files as large as the DISK • Synchronize file access by multiple processes to remove problems associated with multiprogramming / multiprocessing(Optional*)
  39. 39. Your task • Remove restrictions on file size and enable user to create files as large as the DISK • Synchronize file access by multiple processes to remove problems associated with multiprogramming / multiprocessing(Optional*) * : I’ve not designed testcase for it. You need provide testcase by yourself.
  40. 40. Your task ...
  41. 41. Your task ... • Allow file size to be modified after creation • Implement hierarchical directory structure • Implement some sort of performance enhancement to your system (Optional)
  42. 42. Your task ... • Design the api (rmdir,ls,mkdir) to prove your implementation. • ( You need modify syscall.h and start.s to support them, recompile the libnachos.a is needed) • (-1 is reserved by our Nachos test framework, don’t define api using it) • (be consistent with Unix style. E.g.Your file system should use / instead of .)
  43. 43. Hints
  44. 44. Hints 1. Read the code before you start.
  45. 45. Hints 1. Read the code before you start. 2. Some functions need to be moved.
  46. 46. Hints 1. Read the code before you start. 2. Some functions need to be moved. 3. Take care of cross complier
  47. 47. Hints 1. Read the code before you start. 2. Some functions need to be moved. 3. Take care of cross complier 4. Be patient with the bugs. :-)
  48. 48. Questions ?
  49. 49. Thank you!

×