Download - OS - File Handling
![Page 1: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/1.jpg)
V.A.
CSED,TU
File Handling
Organized By: Vinay Arora
Assistant Professor
CSED, TU
![Page 2: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/2.jpg)
VA.
CSED,TU
Disclaimer
This is NOT A COPYRIGHT MATERIAL
Content has been taken mainly from the following books:
Operating Systems Concepts By Silberschatz & Galvin, Operating Systems: Internals and Design Principles By William Stallings
www.os-book.com
www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm
www.personal.kent.edu/~rmuhamma/OpSystems/os.html
http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspx
http://www.computer.howsttuffworks.com/operating-system6.htm
http://williamstallings.com/OS/Animations.htmlhttp://msdn.microsoft.com/en-us/library/aa450566.aspx
www.os-book.com
http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html
Etc…
![Page 3: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/3.jpg)
VA.
CSED,TU
File Concept
� Contiguous Logical Address Space
� Types:
� Data
� numeric
� character
� Binary
� Program
![Page 4: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/4.jpg)
VA.
CSED,TU
File Attributes
� Name – only information kept in human-readable form
� Identifier – Unique tag (number) identifies file within file system
� Type – Needed for systems that support different types
� Location – Pointer to file location on device
� Size – Current file size
� Protection – Controls who can do reading, writing, executing
� Time, Date, and user Identification – Data for protection, security, and usage monitoring
� Information about files are kept in the directory structure, which is maintained on the disk
![Page 5: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/5.jpg)
VA.
CSED,TU
File Operations
� Create
� Write
� Read
� Reposition within File
� Delete
� Truncate
� Open (Fi) – Search the directory structure on disk for entry Fi, and move
the content of entry to memory
� Close (Fi) – Move the content of entry Fi in memory to directory
structure on disk
![Page 6: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/6.jpg)
VA.
CSED,TU
� Several pieces of data are needed to manage open files:
� File Pointer: Pointer to last read/write location, per process that has
the file open
� File-open Count: Counter of number of times a file is open – to
allow removal of data from open-file table when last processes
closes it
� Disk Location of the File: cache of data access information
� Access Rights: Per-process access mode information
![Page 7: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/7.jpg)
VA.
CSED,TU
![Page 8: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/8.jpg)
VA.
CSED,TU
Access Methods
� Sequential Accessread nextwrite next resetno read after last write
(rewrite)
� Direct Accessread nwrite nposition to n
read nextwrite next
rewrite n
n = relative block number
![Page 9: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/9.jpg)
VA.
CSED,TU
Sequential Access
![Page 10: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/10.jpg)
VA.
CSED,TU
Index & Relative Files
![Page 11: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/11.jpg)
VA.
CSED,TU
Directory Structure
� A collection of nodes containing information about all files
![Page 12: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/12.jpg)
VA.
CSED,TU
File System Organization
![Page 13: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/13.jpg)
VA.
CSED,TU
Operations performed on Directory
� Search for a File
� Create a File
� Delete a File
� List a Directory
� Rename a File
� Traverse the File System
![Page 14: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/14.jpg)
VA.
CSED,TU
Organize directory to obtain
� Efficiency – Locating a file quickly
� Naming – Convenient to users
� Two users can have same name for different files
� The same file can have several different names
� Grouping – Logical grouping of files by properties, (e.g., all Java
programs, all games, …)
![Page 15: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/15.jpg)
VA.
CSED,TU
Single-level Directory
![Page 16: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/16.jpg)
VA.
CSED,TU
Two-level Directory
![Page 17: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/17.jpg)
VA.
CSED,TU
Tree Structured Directory
![Page 18: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/18.jpg)
VA.
CSED,TU
Acyclic Graph Directory
![Page 19: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/19.jpg)
VA.
CSED,TU
General Graph Directory
![Page 20: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/20.jpg)
VA.
CSED,TU
File Sharing
![Page 21: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/21.jpg)
VA.
CSED,TU
File Sharing
![Page 22: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/22.jpg)
VA.
CSED,TU
File Security
![Page 23: OS - File Handling](https://reader034.vdocument.in/reader034/viewer/2022052303/556d0a98d8b42ad34f8b4bd7/html5/thumbnails/23.jpg)
VA.
CSED,TU
Thnx…