Nachos filesystem 0.01
Kang Zhang( jobo.zh@gmail.com )
2008-12-04
Agenda
Agenda
• History
• Installation
• Your task
• Implementation details
• Hints
History of Nachos
filesystem
History of Nachos
filesystem
• Nachos in C++
• Nachos in java( initial version)
• Nachos 5.0j
Installation of
phase 5
Installation of
phase 5
1) Download the patch from our
site.
nachos/
filesys/
Directory.java
I...
nachos/
filesys/
Directory.java
...
Installation of phase 5
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf.
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf.
...
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf.
...
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf.
...
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf.
...
Installation of phase 5
3) Choose a phase to start with.(e.g. Phase 2)
4) Merge proj5/nachos.conf with proj2/nachos.conf...
Installation of phase 5
Installation of phase 5
8) Done, it works!
nachos 5.0j initializing... config interrupt timer processor console
user-che...
Installation of phase 5
8) Done, it works!
nachos 5.0j initializing... config interrupt timer processor console
user-che...
Limits
Limits
• unsafe for multiple processes
• has limited file size(4k)
• flat directory structure
Overview of nachos filesystem
Overview of nachos filesystem
Nachos
FileSystem
...
Overview of disk
Overview of disk
Hard Disk Driver
root
freemap filenodes
dir...
Overview of disk
Hard Disk Driver
root
freemap filenodes
dir...
Overview of disk
Hard Disk Driver
root
freemap filenodes
dir...
Overview of disk
Hard Disk Driver
root
freemap filenodes
dir...
Inside a file
Inside a file
Helloworld.coff
File info:
File length, etc.
File pointers:
Sector 1 Sector 2 Secto...
Inside a file
File info:
File length, etc.
File pointers:
Sector 1 Sector 2 Sector 3
...
Directory
Directory
• Directory
• Contains a list of directory entries
• DirectoryEntry
• Stores basic info about a file
File
File
• FileHeader
• Contains pointers to actual data on
disk.
• SynchDisk
• For concurrent access.
• RealOpenFile
Your task
Your task
• Remove restrictions on file size and enable
user to create files as large as the DISK
• Synchronize file acces...
Your task
• Remove restrictions on file size and enable
user to create files as large as the DISK
• Synchronize file acces...
Your task ...
Your task ...
• Allow file size to be modified after creation
• Implement hierarchical directory structure
• Implement some...
Your task ...
• Design the api (rmdir,ls,mkdir) to prove
your implementation.
• ( You need modify syscall.h an...
Hints
Hints
1. Read the code before you start.
Hints
1. Read the code before you start.
2. Some functions need to be moved.
Hints
1. Read the code before you start.
2. Some functions need to be moved.
3. Take care of cross complier
Hints
1. Read the code before you start.
2. Some functions need to be moved.
3. Take care of cross complier
4. Be patient...
Questions ?
Thank you!
of 49

Nachos Filesystem

Published on: Mar 3, 2016
Published in: Education      Technology      News & Politics      
Source: www.slideshare.net


Transcripts - Nachos Filesystem

  • 1. Nachos filesystem 0.01 Kang Zhang( jobo.zh@gmail.com ) 2008-12-04
  • 2. Agenda
  • 3. Agenda • History • Installation • Your task • Implementation details • Hints
  • 4. History of Nachos filesystem
  • 5. History of Nachos filesystem • Nachos in C++ • Nachos in java( initial version) • Nachos 5.0j
  • 6. Installation of phase 5
  • 7. Installation of phase 5 1) Download the patch from our site.
  • 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. 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. Installation of phase 5
  • 11. Installation of phase 5 3) Choose a phase to start with.(e.g. Phase 2)
  • 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. 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. 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. 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. 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. 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. Installation of phase 5
  • 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. 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. Limits
  • 22. Limits • unsafe for multiple processes • has limited file size(4k) • flat directory structure
  • 23. Overview of nachos filesystem
  • 24. Overview of nachos filesystem Nachos FileSystem OpenFile StubFileSystem JVM Runtime RealFileSystem RealOpenFile StubOpenFile Disk,Directory SynchDisk ...
  • 25. Overview of disk
  • 26. Overview of disk Hard Disk Driver root freemap filenodes directory
  • 27. Overview of disk Hard Disk Driver root freemap filenodes directory
  • 28. Overview of disk Hard Disk Driver root freemap filenodes directory
  • 29. Overview of disk Hard Disk Driver root freemap filenodes directory
  • 30. Inside a file
  • 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. 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. Directory
  • 34. Directory • Directory • Contains a list of directory entries • DirectoryEntry • Stores basic info about a file
  • 35. File
  • 36. File • FileHeader • Contains pointers to actual data on disk. • SynchDisk • For concurrent access. • RealOpenFile
  • 37. Your task
  • 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. 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. Your task ...
  • 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. 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. Hints
  • 44. Hints 1. Read the code before you start.
  • 45. Hints 1. Read the code before you start. 2. Some functions need to be moved.
  • 46. Hints 1. Read the code before you start. 2. Some functions need to be moved. 3. Take care of cross complier
  • 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. Questions ?
  • 49. Thank you!