Operating System Tutorial

Operating System Tutorial Types of Operating System Evolution of Operating System Functions of Operating System Operating System Properties Operating System Services Components of Operating System Needs of the Operating System

Operating Systems

Linux Operating System Unix Operating System Ubuntu Operating System Chrome Operating Systems Fedora Operating System MAC Operating System MS Windows Operating System Solaris Operating System Cooperative Operating System CorelDRAW Operating System CentOS FreeBSD Operating Systems Batch Operating System MS-DOS Operating System Commercial Mobile Operating Systems

Differences

Difference Between Multi-programming and Multitasking Difference between C-LOOK and C-SCAN Difference between Rotational Latency and Disk Assess Time Trap vs Interrupt Difference between C-SCAN and SSTF Difference between SCAN and FCFS Difference between Seek Time and Disk Access Time Difference between SSTF and LOOK Difference between Process and Program in the Operating System Difference between Protection and Security in Operating System

How To

How to implement Monitors using Semaphores How to Install a Different Operating System on a PC

Questions

What is Kernel and Types of Kernel What is DOS Operating System What is Thread and Types of Thread What is Process Scheduler and Process Queue What is Context Switching What is CPU Scheduling What is Producer-Consumer Problem What is Semaphore in Operating System Monitors in Operating System What is Deadlock What is Paging and Segmentation What is Demand Paging What is Virtual Memory What is a Long term Scheduler What is Page Replacement in Operating System What is BSR Mode What is Convoy Effect What is Job Sequencing in Operating System Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs Why is there a Need for an Operating System

Misc

Process Management Process State Scheduling Algorithm FCFS (First-come-First-Serve) Scheduling SJF (Shortest Job First) Scheduling Round-Robin CPU Scheduling Priority Based Scheduling HRRN (Highest Response Ratio Next) Scheduling Process Synchronization Lock Variable Mechanism TSL Mechanism Turn Variable Mechanism Interested Variable Mechanism Deadlock Avoidance Strategies for Handling Deadlock Deadlock Prevention Deadlock Detection and Recovery Resource Allocation Graph Banker’s Algorithm in Operating System Fixed Partitioning and Dynamic Partitioning Partitioning Algorithms Disk Scheduling Algorithms FCFS and SSTF Disk Scheduling Algorithm SCAN and C-SCAN Disk Scheduling Algorithm Look and C-Look Disk Scheduling Algorithm File in Operating System File Access Methods in Operating System File Allocation Method Directory Structure in Operating System N-Step-SCAN Disk Scheduling Feedback Queue in Operating System Contiguous Memory Allocation in Operating System Real-time Operating System Starvation in Operating System Thrashing in Operating System 5 Goals of Operating System Advantages of Operating System Advantages of UNIX Operating System Bit Vector in Operating System Booting Process in Operating System Can a Computer Run Without the Operating System Dining Philosophers Problem in Operating System Free Space Management in Operating System Inter Process Communication in Operating System Swapping in Operating System Memory Management in Operating System Multiprogramming Operating System Multitasking Operating Systems Multi-user Operating Systems Non-Contiguous Memory Allocation in Operating System Page Table in Operating System Process Scheduling in Operating System Segmentation in Operating System Simple Structure in Operating System Single-User Operating System Two Phase Locking Protocol Advantages and Disadvantages of Operating System Arithmetic operations in binary number system Assemblers in the operating system Bakery Algorithm in Operating System Benefits of Ubuntu Operating System CPU Scheduling Criteria in Operating System Critical Section in Operating System Device Management in Operating System Linux Scheduler in Operating System Long Term Scheduler in Operating System Mutex in Operating System Operating System Failure Peterson's Solution in Operating System Privileged and Non-Privileged Instructions in Operating System Swapping in Operating System Types of Operating System Zombie and Orphan Process in Operating System 62-bit operating system Advantages and Disadvantages of Batch Operating System Boot Block and Bad Block in Operating System Contiguous and Non - Contiguous Memory Allocation in Operating System Control and Distribution Systems in Operations Management Control Program in Operating System Convergent Technologies in Operating System Convoy Effect in Operating System Copy Operating Systems to SSD Core Components of Operating System Core of UNIX Operating System Correct Value to return to the Operating System Corrupted Operating System Cos is Smart Card Operating System Cosmos Operating Systems Examples Generation of Operating System Hardware Solution in Operating System Process Control Block in Operating System Function of Kernel in Operating System Operating System Layers History of Debian Operating Systems Branches and Architecture of Debian Operating Systems Features and Packages of Debian Operating Systems Installation of Operating System on a New PC Organizational Structure and Development in Debian Operating Systems User Interface in Operating System Types Of Memory in OS Operating System in Nokia Multilevel Paging in OS Memory Mapping Techniques in OS Memory Layout of a Process in Operating System Hardware Protection in Operating System Functions of File Management in Operating System Core of Linux Operating System Cache Replacement Policy in Operating System Cache Line and Cache Size in Operating System What is Memory Mapping? Difference Between Network Operating System And Distributed Operating System What is the difference between a Hard link and a Soft Link? Principles of Preemptive Scheduling Process Scheduling Algorithms What is NOS? What is the Interrupt I/O Process? What is Time Sharing OS What is process termination? What is Time-Sharing Operating System What is Batch File File system manipulation What is Message-passing Technique in OS Logical Clock in Distributed System 20 Functions of Operating Systems Cache Memory in OS

Types of files in OS

Introduction

An operating system employs a file system to store, arrange, and control directories and files on a storage medium. Several typical file system types are as follows:

  • FAT (File Allocation Table): Windows and other operating systems from earlier eras used the outdated file system known as FAT (File Allocation Table).
  • NTFS (New Technology File System):  Windows uses the New Technology File System (NTFS), a contemporary file system. Features like encryption, compression, and file and folder permissions are supported.
  • ext (Extended File System): The Extended File System (ext) is frequently found on operating systems based on Linux and Unix.
  • HFS (Hierarchical File System): MacOS uses a HFS (Hierarchical File System) file system.
  • APFS (Apple File System): Apple started a new file system for both iOS and Mac computers.
Types of files in OS

A file is an assortment of connected data stored on secondary storage media. A group of logically connected items is called file. As far as the user is concerned, a file is the smallest possible allocation of logical secondary storage.

The file name is split into two parts, as indicated below: name and extension, separated by a period.

Objectives of File management System

The following are the primary goals of file management system:

  • It supports a range of storage devices in terms of I/O.
  • It reduces the possibility of corrupted or lost data.
  • It aids in the OS's standardization of I/O interface procedures for user programs.
  • In the context of a multiuser system, it supports numerous users' I/O needs.

File Structure

An operating system-understandable predetermined format is required for a file structure. Its unique structure is determined by its classification.

OS files are categorized into three types:

  • Text file: It is a line-by-line arrangement of characters.
  • Object file: An object file is a block-organized collection of bytes.
  • Source file: It is a collection of procedures and operations.

Functions of File

  • Create a file, locate available disc space, and add something to the directory.
  • Write to file; needs to be positioned inside the file
  • It requires a location within the file to read from it.
  • Reclaim disc space by deleting the directory entry.
  • Adjust and shift the read/write position.

Types of files

The system can recognize the three sorts of files: special, directory, and regular. The operating system, however, makes extensive use of these fundamental kinds.

There are the following fundamental file types:

ItemDescription
regularIt stores data (text, binary, and executable).
directoryIt contains information used to access other files.
specialIt defines a FIFO (first-in, first-out) pipe file or a physical device.

Each file type the system can recognize belongs to one of these groups. The operating system, however, makes extensive use of these fundamental kinds.

Regular files

Regular files are the most often used file type used to hold data. Text files and binary files are examples of regular files.

Text files

Text files are standard files that may be viewed by the user and hold data in ASCII format. These files are printable and displayable. A text file's lines cannot have NUL characters, and none not even the newline character may be longer than {LINE_MAX} bytes.

The term text file does not prohibit control and other nonprintable characters (apart from NUL). As a result, most programs that list text files as inputs or outputs can either handle unusual characters or note their limits clearly in the relevant parts.

Binary files

Binary files are just regular files with computer-readable data inside of them. Binary files can also be executable files that give instructions to the system on how to perform a task. Programs and commands are kept in binary, executable files. Binary code is created from ASCII text using specialized compilation software.

The main difference between text and binary files is that text files have lines that are fewer than {LINE_MAX} bytes long, without NUL characters, and always end with a newline character.

Directory files

Although they don't hold the actual file contents, directory files do hold the information the system needs to access all file kinds. Directories offer the file system structure flexibility and depth while taking up less space than a typical file. Each directory entry represents a file or a subdirectory. The file name and the index node reference number (inode number) are contained in each entry. The inode number indicates the file's unique index node. The inode number indicates the location of the file's associated data. A different set of instructions creates and manages directories.

Special files

Special files are temporary files produced by processes, or they define devices for the system. Block, character, and FIFO (first-in, first-out) are the three fundamental categories of special files. Pipes are another name for FIFO files. Processes can temporarily communicate with one another by creating pipes. Following the completion of the initial operation, these files disappear. Devices are defined by character and block files.

Each file has a set of permissions, also known as access modes, which control who can open, edit, and run the file.

File Access Methods

Types of files in OS

The procedure that controls how files are viewed and read into memory is known as file access. Operating systems typically only support one access method at a time. Nevertheless, some operating systems allow for more than one type of access.

There are three ways to access files:

  1. Sequential access
  2. Direct random access
  3. Index sequential access

Sequential Access

This file access technique allows records to be accessed in a predetermined order. The sequential access approach likewise processes the file's contents one at a time. Most compilers use this access mechanism to access files.

Random Access

Direct random access is another name for the technique. The record can be directly accessed using this approach. Every record has a unique address that may be accessed for direct reading and writing.

Sequential Access

The foundation of this kind of accessing technique is basic sequential access. With this type of access, an index, including a direct pointer to various memory blocks, is constructed for each file. Using this method, the file can be accessed directly from the index pointer, which is searched sequentially. Greater access efficiency can be achieved by utilizing multiple levels of indexing. It also reduces how long it takes to access a single record.

Issues Handled By File System

There are numerous data structures that we have seen where the file may be stored. The primary responsibility of the file system is to maintain optimal file organization.

A free space is produced every time a file is removed from the hard drive. Many of these spaces might need to be recovered to reallocate them to other files. The primary problem with files is deciding where to store them on the hard drive; a block can be used to store a file. It could be stored in non-contiguous blocks on the disc. Every block where the files are partially located needs to be monitored.

Files Attributes and Their Operations

AttributesTypesOperations
NameDocCreate
TypeExeOpen
SizeJpgRead
Creation DataXisWrite
AuthorCAppend
Last ModifiedJavaTruncate
protectionclassDelete
File typeUsual extensionFunction
Executableexe, com, binRead to run machine language program
Objectobj, oCompiled, machine language not linked
Source CodeC, java, pas, asm, aSource code in various languages
Batchbat, shCommands to the command interpreter
Texttxt, docTextual data, documents
Word Processorwp, tex, rrf, docVarious word processor formats
Archivearc, zip, tarRelated files grouped into one compressed file
Multimediampeg, mov, rmFor containing audio/video information
Markupxml, html, texIt is the textual data and documents
Librarylib, a ,so, dllIt contains libraries of routines for programmers
Print or Viewgif, pdf, jpgIt is a format for printing or viewing an ASCII or binary file.

File Directories

An arrangement of files is called a file directory. Details about the files, such as their location, ownership, and attributes, are contained in the directory. The operating system is in charge of a lot of this data, particularly that related to storage. Several file management procedures can access the directory, a file in and of itself.

Below are information contained in a device directory:

  • Name
  • Type
  • Address
  • Current length
  • Maximum length
  • Date last accessed
  • Date last updated
  • Owner id
  • Protection information

The operations performed on the directory are as follows: 

  • Search for a file
  • Create a file
  • Delete a file
  • List a directory
  • Rename a file
  • Traverse the file system

Advantages of File System

  • Organization: Files can be arranged into directories and subdirectories using a file system, which facilitates file management and location.
  • Data protection: To guard against data loss or corruption, file systems frequently come with features like backup and restore, file and folder permissions, and error detection and correction.
  • Better performance: A well-designed file system can enhance the speed at which data is read and written by effectively arranging data on the disc.

Disadvantages of File System

  • Compatibility problems: Data transfer across other operating systems might be challenging due to incompatibilities between file systems.
  • Overhead: File systems may utilize a portion of their disc capacity to hold overhead data, metadata, and other information, which takes up space that could be used for user data.
  • Vulnerability: File systems are susceptible to viruses, data corruption, and other security risks that could jeopardize the system's stability and security.