In this article I have briefly looked at how the Operating System(OS) deals with files.
definition
It is a collection of data that is usually stored on a secondary storage device such as a hard disk or floppy diskette.
They are operated on
An OS must provide a number of functions associated with files so that users can safely store and retrieve data.
Normal operation is
open
off
the creation
copy
Change the name
list
Additionally, operations on single data elements within a file are supported
read on
write down
search
File control block
A file control block (FCB), sometimes referred to as a file descriptor, is a data structure that holds information about a file. When an OS needs to access a file, it creates an associated file control block to manage the file.
The structure of file control blocks varies between operating systems, but most file control blocks include the following parts
name
Location of secondary storage
length
Date and time or creation or last access
nomenclature
Each OS uses a specific convention or convention for naming them.
MS-DOS uses eight character names, a period, followed by a three-character extension that indicates the file type. File names are not case-sensitive
UNIX file names can be up to 254 characters long and are case-sensitive.
Windows filenames can be up to 255 characters long and are not case-sensitive.
types
Types refer to the classification of file content such as a program, text, executable program, or data.
In the Windows operating system, the type file name is derived from the extension. Common types and their extensions are:
extension
Type
.bas
Basic source program
.c
c source program
.dll
system library
.doc
Word document
.exe
Executable program
.txt
the text
Windows applications (programs) associate with specific types. For example, the default application that opens to process a type.txt is the Notepad editor.
How an operating system keeps track of files
A hard disk has a large number of sequentially numbered sectors. As the file is created, free sectors are allocated to hold its contents and are marked as allocated.
To keep track of sectors and whether they are allocated or free and which files they belong to, the OS maintains several tables.
Andoot file system
When the OS is first installed, it creates a root file system on the disk that specifies how many sectors are available and how they will be allocated.
The root file system is a table of entries like a directory. In general, this is a fixed size, and once full, no more entries can be added. Each entry can be a file or another directory table.
The Andoot file system entry
This is highly operating system specific, but an entry might look like this,
name
Starting cluster number
length in bytes
Type
Date of creation and last modified rights
Permissions (an access control list)