Operating System Unit1
Operating System Unit1
• Name
• Extension, separated by a
period.
• Example:filename.docx
• Markslist.docx
FILE ATTRIBUTES
1. Name : A file is named for the
convenience of the user and is referred
by its name. A name is usually a string of
characters.
2. Identifier : This unique tag, usually a
number ,identifies the file within the file
system.
3. Type : Files are of so many types. The
type depends on the extension of the
file. Example: .exe Executable
file .obj Object file .src Source file
4. Location : This information is a
pointer to a device Eg:C:\Users\lavan\
OneDrive\Documents\Desktop
5. Size : The current size of the file (in
bytes, words,blocks).
6. Protection : Access control
information determines who can do
reading, writing, executing and so on.
7. Time, Date, User identification : This
information may be kept for creation,
last modification,last use.
FILE OPERATIONS
1.Creating a file : Two steps are
needed to create a file.
• They are: Check whether the space is
available or not.
If the space is available then
• made an entry for the new file in the
directory.
The entry includes name of the file,
path of the file,etc…
2. Writing a file : To write a file, we
have to know 2 things.
• One is name of the file and
• second is the information or data
to be written on the file, the
system searches the entire given
location for the file.
If the file is found, the system must
keep a write pointer to the location
in the file where the next write is to
take place.
3. Reading a file : To read a file,
first of all we search the
directories for the file, if the file
is found, the system needs to
keep a read pointer to the
location in the file where the
next read is to take place.
Once the read has taken place,
the read pointer is updated
4. Repositioning within a
file : The directory is
searched for the
appropriate entry and the
current file position
pointer is repositioned to
a given value.
This operation is also
called file seek.
5. Deleting a file : To delete
a file, first of all search the
directory for named file, then
released the file space and
erase the directoryentry
.6. Truncating a file : To
truncate a file, remove the
file contents only but, the
attributes are as it is.
File Access Methods