OS@4
OS@4
&
operations
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
File Operations
● File is an abstract data type
● Create
● Write – at write pointer location
● Read – at read pointer location
● Reposition within 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
File Structure
● None - sequence of words, bytes
● Simple record structure
● Lines
● Fixed length
● Variable length
● Complex Structures
● Formatted document
● Relocatable load file
Sequential-access File
Other Access Methods
Directory
Files F F F
F 4
1 2
3 F
n
● Create a file
● Delete a file
● List a directory
● Rename a file
Directory Organization
● Naming problem
● Grouping problem
Two-Level Directory
● Separate directory for each user
● Path name
● Can have the same file name for different user
● Efficient searching
● No grouping capability
Acyclic-Graph Directories
● Have shared subdirectories and files
File Sharing
● Sharing of files on multi-user systems is desirable
● Sharing may be done through a protection scheme
● On distributed systems, files may be shared across a network
● Network File System (NFS) is a common distributed file-sharing
method
● If multi-user system
● User IDs identify users, allowing permissions and
protections to be per-user
Group IDs allow users to be in groups, permitting group
access rights
● Owner of a file / directory
● Group of a file / directory
Protection
● File owner/creator should be able to control:
● what can be done
● by whom
● Types of access
● Read
● Write
● Execute
● Append
● Delete
● List
Access Lists and Groups
● Mode of access: read, write, execute
● Three classes of users on Unix / Linux
RWX
a) owner access 7 ⇒ 111
RWX
b) group access 6 ⇒ 110
RWX
c) public access 1 ⇒ 001
● Ask manager to create a group (unique name), say G, and add
some users to the group.
● For a particular file (say game) or subdirectory, define an
appropriate access.