Lecture 22 File-System Interface
Download
Report
Transcript Lecture 22 File-System Interface
Lecture 22
File-System I
File Concept
Fall 2000
M.B. Ibáñez
File System
• From a user’s point of view, the file system
is perhaps the most important part of the OS
– He/she wants rapid access
– SO must guarantees that the files will not be
corrupted
– The files must be secure from authorized access
Fall 2000
M.B. Ibáñez
File Management System
• The way a user of application may access
files
• Programmer does not need to develop file
management software
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
File System Software
Architecture
User Program
Pile
Sequential
Indexed
Sequential
Indexed
Hashed
Logical I/O
Basic I/O Supervisor
Basic File System
Disk Device Driver
Tape Device Driver
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Basic File System
•
•
•
•
Physical I/O
Deals with exchanging blocks of data
Concerned with the placement of blocks
Concerned with buffering blocks in main
memory
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Logical I/O
• Allows users and applications to access
records
• Maintains basic data about file
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Access Method
• Reflect different file structures
• Different ways to store and process data
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Functions of File Management
• Identify and locate a selected file
• Use a directory to describe the location of
all files plus their attributes
• On a shared system describe user access
control
• Blocking for access to files
• Allocate files to free blocks
• Manage free storage for available
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
File System
• It is the part of the Operating System which
consists of
– An interface to the user
– Data structures and algorithms needed by the
Operating System to implement that interface
Fall 2000
M.B. Ibáñez
Files
• Used for input to a program
• Output of application saved in a file for
long-term storage
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Terms Used with Files
• Field
– basic element of data
– contains a single value
– characterized by its length and data type
• Record
– collection of related fields
– treated as a unit
• Example: employee record
From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall
Fall 2000
M.B. Ibáñez
Terms Used with Files
• File
–
–
–
–
collection of similar records
treated as a single entity
have unique file names
may restrict access
• Database
– collection of related data
– relationships exist among elements
Fall 2000
M.B. Ibáñez
From Operating Systems. Internals and Design
Principles. W. Stalling. Prentice Hall
File Attributes
•
•
•
•
•
Name – only information kept in human-readable form.
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.
Fall 2000
M.B. Ibáñez
From Operating System Concepts.
Silberschatz & Galvin. Addison Wesley
File Operations
•
•
•
•
•
•
•
create
write
read
reposition within file – file seek
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.
Fall 2000
M.B. Ibáñez
From Operating System Concepts.
Silberschatz & Galvin. Addison Wesley
File Types – name, extension
File Type
Executable
Object
Source code
Usual extension
exe, com, bin or
none
obj, o
Function
ready-to-run machinelanguage program
complied, machine
language, not linked
source code in various
languages
commands to the
command interpreter
textual data documents
Batch
c, p, pas, 177,
asm, a
bat, sh
Text
txt, doc
Word processor
wp, tex, rrf, etc.
Library
lib, a
various word-processor
formats
libraries of routines
Print or view
ps, dvi, gif
ASCII or binary file
Archive
arc, zip, tar
related files grouped
into one file, sometimes
compressed.
Fall 2000
M.B. Ibáñez