Files: Difference between revisions

From COMP15212 Wiki
gravatar Yuron [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
gravatar U05730dg [userPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
-->{{Path|Filing|3}}{{Path|IPC|4}}<!--
-->{{Path|Filing|3}}{{Path|IPC|4}}<!--
-->{{#invoke:Dependencies|add|Filing System,5}}
-->{{#invoke:Dependencies|add|Filing System,5}}
A file is the basic storage unit in a [[Filing_System|filing system]].
A file is the basic storage unit in a [[Filing_System|filing system]]. They are large but slow to access (relative to main [[memory]] [[structures]]), possibly accessible by many users and processes, and <strong>permanent</strong>.
They are large but slow to access (relative to main [[Memory|memory]]
[[Structures|structures]], possibly accessible by many users and
processes, and <strong>permanent</strong>.


[[File_Access|Access to a file]] requires the appropriate sequence of
[[File Access|Access to a file]] requires the appropriate sequence of [[System Calls|system calls]] and is typically subject to [[File Permissions|access permissions]].
[[System Calls | system calls]] and is typically subject to [[File_Permissions|access permissions]].


Each file comprises a standard set of [File_Attributes file
Each file comprises a standard set of [[File Attributes|file attributes]] (e.g. the file size) and a variable number of blocks/“clusters” which contain the data.  It is normal (but not compulsory) to keep only one <em>type</em> of data in each file.
attributes] (e.g. the file size) and a variable
number of blocks/“clusters” which contain the data.  It is
normal (but not compulsory) to keep only one <em>type</em> of data in each
file.


[[Image:files.png|link=|alt=Files]]
[[Image:files.png|link=|alt=Files]]


The data may be <em>structured</em> into <strong>records</strong>, either by the filing
The data may be <em>structured</em> into <strong>records</strong>, either by the filing system itself or through user preference.  Most modern file systems leave any structuring to the user and regard the body of the file as a large [[Arrays|array]] of (usually) bytes.
system itself or through user preference.  Most modern file systems
leave any structuring to the user and regard the body of the file as a
large [[Arrays|array]] of (usually) bytes.


Historically, some files may have been only <em>serially</em> accessible:
Historically, some files may have been only <em>serially</em> accessible: start at the beginning and read as a [[Streams|stream]].  Although this is still possible – and, sometimes, convenient – it is usually possible to move the point of reading/writing to an arbitrary position.  However this can still require a sequence of system calls.
start at the beginning and read as a [[Streams|stream]].  Although this
is still possible – and, sometimes, convenient – it is usually
possible to move the point of reading/writing to an arbitrary
position.  However this can still require a sequence of system calls.


Some operating systems may allow the virtual [[Memory Mapped Files|mapping of a file into the address space]] for added convenience.
Some operating systems may allow the virtual [[Memory Mapped Files|mapping of a file into the address space]] for added convenience.


When reading (or writing) a file there is an associated <em>position</em>;
When reading (or writing) a file there is an associated <em>position</em>; this is <em>not</em> part of the file though but is maintained by the access process.  It is possible to have multiple processes reading the same file at different places simultaneously.
this is <em>not</em> part of the file though but is maintained by the access
process.  It is possible to have multiple processes reading the same
file at different places simultaneously.


A file will typically have some [File_Types type] part of which may
A file will typically have some [[File Types|type]] part of which may be maintained by the file system and some from the user’s knowledge. Each file has some unique identifier but the user will usually have a human-readable name by which it can be identified.  This “file name” may or may not be part of the file’s attributes.  For example, in a Unix filing system the file name is separate from the file and one file can have multiple different names.
be maintained by the file system and some from the user’s knowledge.
Each file has some unique identifier but the user will usually have a
human-readable name by which it can be identified.  This “file
name” may or may not be part of the file’s attributes.  For
example, in a Unix filing system the file name is separate from the
file and one file can have multiple different names.


[[Image:file_links.png|link=|alt=File links]]
[[Image:file_links.png|link=|alt=File links]]
----
----
 
{{BookChapter|13.1|529-539}}
{{PageGraph}}
{{PageGraph}}
{{Category|Filing System}}
{{Category|Filing System}}

Latest revision as of 13:25, 9 May 2024

On path: Filing 1: Filing System • 2: File Systems • 3: Files • 4: File Attributes • 5: File Types • 6: File Permissions • 7: File Access • 9: Filing System Implementation • 10: I-nodes • 11: Links • 12: File Descriptor
On path: IPC 1: Processes • 2: Interprocess Communication • 3: Shared Memory • 4: Files • 5: Unix Signals • 6: Pipes • 7: Sockets • 8: Synchronisation • 9: Synchronisation Barrier • 10: Atomicity • 11: Mutual exclusion • 12: Signal and Wait
Depends on Filing System

A file is the basic storage unit in a filing system. They are large but slow to access (relative to main memory structures), possibly accessible by many users and processes, and permanent.

Access to a file requires the appropriate sequence of system calls and is typically subject to access permissions.

Each file comprises a standard set of file attributes (e.g. the file size) and a variable number of blocks/“clusters” which contain the data. It is normal (but not compulsory) to keep only one type of data in each file.

Files

The data may be structured into records, either by the filing system itself or through user preference. Most modern file systems leave any structuring to the user and regard the body of the file as a large array of (usually) bytes.

Historically, some files may have been only serially accessible: start at the beginning and read as a stream. Although this is still possible – and, sometimes, convenient – it is usually possible to move the point of reading/writing to an arbitrary position. However this can still require a sequence of system calls.

Some operating systems may allow the virtual mapping of a file into the address space for added convenience.

When reading (or writing) a file there is an associated position; this is not part of the file though but is maintained by the access process. It is possible to have multiple processes reading the same file at different places simultaneously.

A file will typically have some type part of which may be maintained by the file system and some from the user’s knowledge. Each file has some unique identifier but the user will usually have a human-readable name by which it can be identified. This “file name” may or may not be part of the file’s attributes. For example, in a Unix filing system the file name is separate from the file and one file can have multiple different names.

File links


Also refer to: Operating System Concepts, 10th Edition: Chapter 13.1, pages 529-539