Unit II Operating System & File system management | Cse111 Orientation Of Computing | B.tech CSE




What is an Operating System?

An Operating System (OS) is a software layer that acts as an intermediary between computer hardware and the user. It manages hardware resources and provides a set of services for application software, enabling the efficient use of a computer’s resources.

Key Components of an Operating System

Kernel:

  • The core part of the OS that manages system resources.
  • Handles communication between hardware and software.
  • Responsible for process management, memory management, device management, and system calls.

User Interface:

  • The interface through which users interact with the OS.
  • Can be a Graphical User Interface (GUI) (e.g., Windows, macOS) or a Command-Line Interface (CLI) (e.g., Linux terminal).
  • Allows users to execute commands, manage files, and launch applications.

File System:

  • Organizes and manages how data is stored and retrieved on storage devices.
  • Provides a way to create, delete, read, and write files and directories.
  • Different file systems include NTFS (Windows), ext4 (Linux), and HFS+ (macOS).

Device Drivers:

  • Specialized software that allows the OS to communicate with hardware devices (printers, graphics cards, etc.).
  • Ensures that applications can use hardware without needing to know the specifics of the hardware.

System Libraries:

  • Collections of pre-written code that developers can use to perform common tasks.
  • Provide standard functions and routines that applications can call.

System Utilities:

  • Tools and applications that perform maintenance tasks (e.g., disk management, backup).
  • Include antivirus software, disk cleanup tools, and system monitoring applications.

Process Management:

  • Responsible for managing processes in the system, including their creation, scheduling, and termination.
  • Ensures that multiple processes can run concurrently without interfering with each other.

Memory Management:

  • Manages the allocation and deallocation of memory space for processes.
  • Keeps track of each byte in a computer’s memory and ensures efficient use of RAM.

Security and Access Control:

  • Implements measures to protect system resources from unauthorized access.
  • Manages user accounts, permissions, and authentication.

2. Windows Operating System Versions and Features

1. Windows 1.0

  • Launch Date: November 1985
  • Features: Introduced a graphical user interface (GUI) over MS-DOS, with basic applications like Paint and Notepad.

2. Windows 3.0

  • Launch Date: May 1990
  • Features: Enhanced GUI, support for virtual memory, improved multitasking, and a more robust file manager.

3. Windows 95

  • Launch Date: August 1995
  • Features: Introduced the Start menu, taskbar, plug and play hardware support, and improved networking capabilities.

4. Windows 98

  • Launch Date: June 1998
  • Features: Improved hardware support, Internet Explorer integration, and the introduction of the Quick Launch bar.

5. Windows 2000

  • Launch Date: February 2000
  • Features: Enhanced stability and security, Active Directory support, and improved networking and file system capabilities.

6. Windows ME (Millennium Edition)

  • Launch Date: September 2000
  • Features: Focused on home users with enhanced multimedia support, System Restore, and Windows Movie Maker.

7. Windows XP

  • Launch Date: October 2001
  • Features: Significant UI overhaul, improved performance, better security features, and support for 64-bit processors.

8. Windows Vista

  • Launch Date: January 2007
  • Features: New Aero interface, enhanced security features (User Account Control), and improved search functionality.

9. Windows 7

  • Launch Date: October 2009
  • Features: Faster performance, taskbar improvements, better touch support, and enhanced window management (Aero Snap).

10. Windows 8

  • Launch Date: October 2012
  • Features: Introduced the tile-based Start screen, improved touch support, and integration with cloud services.

11. Windows 8.1

  • Launch Date: October 2013
  • Features: Addressed user feedback from Windows 8, reintroduced the Start button, and added enhanced multitasking features.

12. Windows 10

  • Launch Date: July 2015
  • Features: Unified platform for desktops and tablets, Cortana integration, virtual desktops, and a return to a more traditional Start menu.

13. Windows 11

  • Launch Date: October 5, 2021
  • Features: Redesigned Start menu and taskbar, enhanced gaming features, improved window management (Snap Layouts), and better integration with Microsoft Teams.

Installation Process for Windows OS

1. Preparation

  • Check System Requirements: Ensure the hardware meets the minimum requirements for the Windows version being installed.
  • Backup Data: Save important files to avoid loss during installation.
  • Create Installation Media: Use a USB flash drive or DVD. You can download the Windows Media Creation Tool from Microsoft’s website to create the installation media.

2. Boot from Installation Media

  • Insert the Installation Media: Connect the USB drive or insert the DVD.
  • Access BIOS/UEFI Settings: Restart the computer and enter BIOS/UEFI (usually by pressing F2, F10, DEL, or ESC during startup).
  • Set Boot Order: Change the boot order to prioritize the USB/DVD drive.
  • Save and Exit: Save changes and restart the computer.

3. Language and Settings

  • Select Language, Time, and Keyboard Layout: Once the installation media loads, choose your preferred language, time format, and keyboard layout.

4. Installation Type

  • Click "Install Now": Start the installation process.
  • Enter Product Key: If prompted, enter the Windows product key. You can choose to skip this step if you want to enter it later.
  • Accept License Terms: Read and accept the Microsoft Software License Terms.

5. Choose Installation Type

  • Upgrade: Keeps existing files, settings, and applications. This is typically used when upgrading from a previous version of Windows.
  • Custom: A clean installation where you can partition the hard drive, delete existing partitions, or format the drive. Recommended for best performance.

6. Disk Partitioning

  • Select Disk for Installation: If doing a custom installation, select the disk or partition where you want to install Windows.
  • Create/Delete/Format Partitions: You can manage partitions as needed. Click "Next" after selecting the desired partition.

7. Installation Process

  • Copying Files: The installer copies Windows files to the selected partition.
  • Installing Features and Updates: This process may take some time as the system installs necessary features and updates.
  • Finalizing Installation: The system may restart multiple times during this phase.

8. Configuration

  • User Account Setup: Create a user account and set a password. You may also set up a Microsoft account for additional features.
  • Privacy Settings: Configure privacy options, such as location services and diagnostic data.
  • Network Setup: Connect to a Wi-Fi network or configure Ethernet settings.

9. Finalizing Setup

  • Additional Settings: Configure settings like Cortana, OneDrive, and other Microsoft services.
  • Desktop Setup: Once the installation is complete, the system will take you to the desktop where you can start using Windows.

Directory Hierarchy of Windows Operating System

Windows uses a hierarchical file system to organize data. There are two main levels:

Single-Level Directory Hierarchy

In a single-level directory structure, all files are stored in one directory without any subdirectories. This approach was common in early operating systems. Here are some characteristics:

  • Flat Structure: All files reside in the same directory, making it simple to navigate.
  • Limited Scalability: As the number of files increases, it becomes harder to manage and locate specific files.
  • Example Use: Early versions of DOS used a single-level directory structure.

 Multiple-Level Directory Hierarchy

The multiple-level directory hierarchy is the standard in modern operating systems, including Windows. It allows for a more organized structure where directories can contain subdirectories, which can, in turn, contain their own subdirectories and files. Key features include:

  • Tree Structure: Organized like a tree, with a root directory and multiple levels of subdirectories.
  • Improved Organization: Allows for grouping files logically, making it easier to manage large numbers of files.
  • Access Control: Permissions can be set at various levels for different users.
  • Components:
  • Root Directory: The top-level directory (e.g., C:\).
  • Subdirectories: Folders within the root that can contain files and additional subdirectories.

Key Points:

  • Ease of Navigation: Users can easily navigate through directories and subdirectories to find files.
  • File Organization: Related files can be stored together in specific folders, reducing clutter.
  • Multiple Access Levels: Different users can have different permissions on various directories.

Bootloader Overview

Definition: A bootloader is a small program that initializes hardware and loads the operating system (OS) into memory when the computer starts.

Key Functions:

  • System Initialization: Checks and initializes hardware components (POST).
  • Finds the OS: Locates the operating system on the storage device.
  • Loads the Kernel: Loads the OS kernel into memory.
  • Transfers Control: Hands over control to the OS for further initialization.
  • Provides Boot Options: Offers a menu for selecting between multiple operating systems (if applicable).

Components:

  • Boot Sector: The first sector on a storage device containing the bootloader code.
  • Boot Configuration Data (BCD): Stores boot settings for Windows systems.
  • Boot Menu: Displays available OS options to the user.

Booting Process Steps:

  • Power On: System powers up and BIOS/UEFI initializes hardware.
  • POST: Performs hardware checks.
  • Locating Bootloader: BIOS/UEFI finds the bootable device.
  • Executing Bootloader: Loads and runs the bootloader from the boot sector.
  • Loading the Kernel: Bootloader loads the OS kernel into memory.
  • Transferring Control: Hands over control to the OS.

File System Basics

Definition: A file system is a method and data structure that an operating system uses to manage files on a storage device. It defines how data is stored, organized, retrieved, and managed.

Key Functions:

  • File Naming: Specifies rules for naming files (e.g., length, allowed characters).
  • Storage Allocation: Manages how disk space is allocated to files.
  • Directory Structure: Organizes files into directories (folders) for easier access.
  • Access Control: Manages permissions to ensure security and integrity.

Types of File Systems

1. FAT12

  • Introduced: 1980
  • Table Size: 12-bit
  • Max Volume Size: Up to 32 MB
  • Max File Size: 32 MB
  • Cluster Size: Up to 4 KB
  • Use Cases: Primarily for floppy disks and embedded systems.

2. FAT16

  • Introduced: 1984
  • Table Size: 16-bit
  • Max Volume Size: Up to 2 GB
  • Max File Size: 2 GB
  • Cluster Size: 2 KB to 32 KB
  • Use Cases: Used in DOS, early Windows versions, and some memory cards.

3. FAT32

  • Introduced: 1996
  • Table Size: 32-bit
  • Max Volume Size: Up to 2 TB (theoretical limit up to 16 TB)
  • Max File Size: 4 GB
  • Cluster Size: 512 bytes to 32 KB
  • Use Cases: Commonly used in USB drives, memory cards, and external hard drives due to cross-platform compatibility.

Summary

  • FAT12: Simple, limited to small disks; mainly for floppy disks.
  • FAT16: Improved capacity; used in older systems.
  • FAT32: Most versatile; supports larger volumes and files, widely used today.
Feature FAT12 FAT16 FAT32
Introduced 1980 1984 1996
Table Size 12-bit 16-bit 32-bit
Max Volume Size Up to 32 MB Up to 2 GB Up to 2 TB
Max File Size 32 MB 2 GB 4 GB
Cluster Size Up to 4 KB 2 KB to 32 KB 512 bytes to 32 KB
Use Cases Floppy disks, embedded systems DOS, early Windows USB drives, memory cards, external HDDs

Pipes and Redirection

Pipes (|)

Definition: Pipes allow you to use the output of one command as the input to another command.

Usage:

  • Example: command1 | command2
  • Example Command: ls -l | grep "txt"
    • This lists files and filters the output to show only those containing "txt".

Redirection

  • Output Redirection (> and >>):
    • >: Redirects output to a file (overwrites).
      • Example: echo "Hello" > file.txt
    • >>: Redirects output to a file (appends).
      • Example: echo "World" >> file.txt
  • Input Redirection (<):
    • Takes input from a file instead of the keyboard.
    • Example: sort < file.txt

Searching the File System

Using find Command

  • Purpose: Searches for files and directories in a specified location.
  • Basic Syntax: find [path] [options] [expression]
  • Common Examples:
    • Find all .txt files: find /path/to/dir -name "*.txt"
    • Find files modified in the last 7 days: find /path/to/dir -mtime -7

Using grep Command

  • Purpose: Searches for specific patterns within files using regular expressions.
  • Basic Syntax: grep [options] pattern [file]
  • Common Examples:
    • Search for a word in a file: grep "search_term" file.txt
    • Search recursively in a directory: grep -r "search_term" /path/to/dir

Simple Regular Expressions with grep

  • Basic Patterns:
    • : Matches any single character.
    • * : Matches zero or more occurrences of the preceding character.
    • ^ : Matches the start of a line.
    • $ : Matches the end of a line.
  • Examples:
    • Match lines starting with "Hello": grep "^Hello" file.txt
    • Match lines ending with "world": grep "world$" file.txt
    • Match lines containing "abc" anywhere: grep "abc" file.txt

Summary

  • Pipes allow chaining commands for efficient processing of data.
  • Redirection enables saving command output to files or using file input.
  • find helps locate files and directories based on various criteria.
  • grep searches for specific text patterns, utilizing simple regular expressions for powerful text processing.

Basic Process Control Using Signals

Signals

  • Signals are a form of inter-process communication used to notify processes of events.
  • Common signals include:
    • SIGINT: Interrupt from the keyboard (Ctrl + C).
    • SIGTERM: Termination request.
    • SIGSTOP: Stop (pause) a process.
    • SIGCONT: Continue a stopped process.

Pausing a Process

  • To Pause: Use the SIGSTOP signal.
    • Method: Press Ctrl + Z while a foreground process is running.
    • Command: kill -STOP <PID> to pause a specific process.

Resuming a Process

  • To Resume in Foreground: Use the fg command.
  • To Resume in Background: Use the bg command.
  • Command to Continue: kill -CONT <PID> to continue a specific paused process.

Example Commands

  • Pause a Process:
    • In bash
      • kill -STOP <PID>
  • Resume in Foreground:
    • In bash
      • fg
  • Resume in Background:
    • In bash
      • bg

Summary

  • Use signals like SIGSTOP to pause and SIGCONT to resume processes.
  • Ctrl + Z pauses the foreground process, while fg and bg manage resumption in foreground or background.

Terminating a Process

To terminate a process using its PID:

kill <PID>

To forcefully terminate a process:

kill -9 <PID>

To terminate a process by name:

pkill process_name

To kill all processes with a specific name:

killall process_name

Managing the PATH Variable

To view the current PATH variable:

echo $PATH

To add a directory to the PATH:

export PATH=$PATH:/new/directory

To remove a directory from the PATH:

export PATH=$(echo $PATH | sed -e 's|:/directory_to_remove||g' -e 's|/directory_to_remove:||g' -e 's|/directory_to_remove||g')


Post a Comment

If you have any doubt, Please let me know.

Previous Post Next Post