Please enable JavaScript.
Coggle requires JavaScript to display documents.
Operating System (Chapter 3) - Coggle Diagram
Operating System (Chapter 3)
Concept of file
The term file is used for anything that is stored in the secondary storage.
A file could be a program (source code or executable), text files, word documents, image files, audio/video files etc.
File Extension : The short form for file type. Example = for image, will be JPG.
File management system can be define as a system that an operating system uses to keep track of different files.
File management aims to provide a convenient programming environment for the users of the system.
File access techniques
1) Sequential
The simplest file organization.
Information in the file is processed in order, one record after the other.
Advantage
Easiest to implement because records are stored & retrieved serially, one after other.
It is simple.
It is cheap.
Disadvantage
Processing is very slow.
Entire file must be processed even it’s just a single record is to be searched.
2) Direct
Method useful for disks.
Obtain data from a storage device by going directly to
where it is physically located on the device.
Users can access any record in any order
without having to begin a search from the beginning of the file.
Advantage
Processing is faster than sequential.
Concurrent processing is possible.
Disadvantage
More complex than sequential access.
More security and backup problems.
Collison may occurs.
3) Indexed
Combination of advantage between sequential and direct.
It allows files to be accessed either sequentially or randomly.
Here records are stored in order of primary key in the file.
Advantage
Very easy to process.
Simple and clear strategy.
With correct selection of key field, records in big file can be found easily and fast.
Disadvantage
It is very expensive.
Difficult to adjust, modify or update.
Types of directory structure
1) Storage structure
A disk can be used in its entirety for a file system.
A file system can be created on each of these parts of the disk.
Parts also can combined to form larger structures known as volumes.
Volumes can also store multiple operating system, allow a system to boot and run more than one.
2) Directory structure
Both the directory structure and the files reside on disk. Backups of these two structures may be kept on tapes.
3) Single-level directory
There is only one directory at the top, which is also called as the root directory.
All files are present in the root directory only and user cannot create sub directories under the root directory.
4) Two-level directory
User are allow to create a directory directly inside the root directory.
This design will help users to keep their files separately under their own directories.
Methods of file allocation
Almost every case, many files are stored on the same disk.
Main problem is how to allocate space to these files so that disk space is utilized effectively and files can be accessed quickly
1) Contiguous file allocation
Records stored one after another.
Advantage
Easy direct access.
Any record found once starting address, size known.
Disadvantage
Difficult file expansion, fragmentation
2) Linked file allocation
Files use any available disk storage space.
File records can be stored in contiguous manner, if enough empty space.
Advantage
No need external storage fragmentation.
No need for compaction.
Disadvantage
No direct access support because cannot determine specific record’s exact location
3) Indexed file allocation
Every file has own index block.
Larger files experience several index levels.
Allows direct record access because it can brings pointers together and links every extent file into index block.
Advantage
Supports sequential and direct access.
File can be found easy and faster.
Disadvantage
Does not necessarily improve storage space use.
The pointer was more overhead than non-contiguous storage.
Free space lists
Free space list manage records all free disk blocks.
Those not allocated to some file or directory.
Using Bit map
Bit vector
If the block is free, the bit is 1.
If the block is allocated, the bit is 0.
Bit map
If the block is free, the block in bit map will be white color.
-If the block is allocated, the block in bit map will be black color.
Advantage
of bit map over free lists
The file system can quickly determine if contiguous blocks are available at certain locations on secondary storage.
Disadvantage
The file system may need to search the entire bit map to find a free block.