Introduction to Operating System

 

Operating System

Operating System is an interface between hardware and software.

Boot Process

  1. Power on
  2. Computers run a test to make sure all the hardware is working correctly this is called a Power On Self Test(POST).
  3. Based on the BIOS configuration, a boot device(HDD, CD, or USB) that contains OS is selected for a program known as a boot loader which then loads the operating system.
  4. Once OS gets loaded the essential part of OS Kernel is started and appropriately set for us to use.

OS Kernel

  • The Kernel is the core component of OS. As users, we don't interact with the kernel directly.
  • It interacts directly with the hardware.
  • It manages the hardware resources.

Linux Kernel

  • Linux is a free and open-source OS Kernel developed by Linus Torvalds.
  • Operating Systems made from software based on Linux Kernel are referred to as Linux Distributions (or Linux Distros).

Components of OS

Broadly we can categorize components of os are

  • Userspace
  • Kernel

All apps interact with the kernel. The kernel will interact with hardware

Userspace

  • Userspace is everything outside the kernel.
  • Programs we interact with directly are part of Userspace which are Text Editors, Music Players, User Interfaces, etc.
  • Userspace can include some OS programs like the GUI etc.

Responsibilities of OS

Abstraction

Abstraction means hiding the unnecessary complex inner details and showing only the relevant features. Once the operating system is up we no longer deal with the internals. For example, consider a car driver he does need to know how the engine works in the car. he/she simply needs to know few things like steering, gear, and so on.

  • Operating System abstracts away the complex details of the underlying hardware.
  • It provides a common API to applications and services.
  • Thus, It simplifies development applications.

Resource Management

Resource management is one of the important tasks for OS. power, memory, CPU, and so on are resources. For example, Mobile/laptop use multiple applications at the same time like chrome, music app, chat app. These applications required CPU, ram, GPU resources.

  • Operating System allocates hardware resources to applications in a fairway.
  • It makes efficient use of the limited resources.
  • It prevents improper use of computer resources.

Isolation and Protection

  • Operating System Provides a safe way for multiple applications to simultaneously run without interfering with each other.
  • It protects applications from each other. If one application fails Operating System ensures that it does not affect others.

Multi-User System

In Laptops, computers, multiple users can access at the same time. Resource management between the apps used by each user is the responsibility of the operating system.

Memory Management

We generally run multiple applications at a time like Whatsapp, Spotify. How much memory should be allotted to the applications in ram is taken care of by Operating System. CPU resources are also allocated by OS.

Process Management

Many times, we have more running applications than the number of CPU cores. even our Chrome Window has multiple tabs, and you can simultaneously play video in one tab, solve questions in another, Kernel continuously switches and gives different applications to use CPU. The switching is so fast that they all seem to run parallelly.

Similarly, all of the RAM is not being used by a single app. OS kernel allocates the required amount of RAM to each app as and when required.

Here, the time slicing concept is applied. A time slice is a very short interval of time that gets allocated to a process for CPU execution.

CPU runs billions of instructions per second. So in the same second, let’s say, first few instructions for Word document next few instructions for Music, similarly Web browsing and Calculator. CPU will run billions of instructions per sec. We can't exactly see the difference this is called process management.

File and File Systems

File

A file is a collection of related information that is stored on the storage medium.

File Extensions

  • Files may have an extension that is used to denote the type of file.
  • Programs open and operate files based on the file extension.
  • Image & Video Extensions: .jpeg, .png, .tiff, .mp4, .mov
  • Docs: .html, .js, .py, .docx, .txt 

Files and Folders

Usually, we organize files in folders and these folders are stored in other folders and this continues until we arrive at C:\ drive or some other drive in Windows and Root directory ( / )in Linux-based systems and macOS.

File Path

  • The general form of the name of a file or directory specifies a unique location in a file system.
  • File path usually is folder names separated by slashes.

File and File Systems

The kernel handles file storage on our machines. There are three main components to handling files on an OS.

  • File System
  • File Data
  • File Metadata

File Data

  • The data of a file is broken down into pieces of data blocks of a fixed size before storing in a disk.
  • Default Block Size is 4 KB. So, the size occupied by a file on the disk will be in multiples of 4 KB.
  • Block storage improves faster handling of data because the data isn't stored on one long piece and it can be accessed quicker. It's also better for utilizing storage space.

File Content

Though everything is stored in binary, files can be classified

  • Text Files
  • Non - Text Files

Text Files

Consists of plain, unformatted words, letters, and punctuation (Unicode Characters) intended to be readable by humans. The text files can be opened by any text editor.

  • e.g. All Code files and plain text files

Line Endings

The line ending character when Enter ↲ is typed is different in different Operating Systems.

Non-Text Files

Consists of non-textual data meant primarily to be read by applications that translate those content into something useful by humans.

  • Pictures, Audio, Video, Rich formatted text (Docs), etc.

File Metadata

The file metadata contains the information about our file.

  • Owner of File
  • Permissions (Read, Write, Execute)
  • File Size
  • Creation Date Time
  • Last Modified Date Time

File Systems

  • Responsible for managing files on the disk.
  • Provides a mechanism to store the data and access the file contents including data and programs.
  • Different file systems were developed for different use cases.

File System determine various aspects like

  • Limitations on File Size and File Names
  • Size occupied on the disk
  • Encryption
  • File Search
  • Backup & Versions

Case Sensitivity

Each File System has its own rules, preferences, etc. Similarly, some File Systems are case sensitive. A case-sensitive file system distinguishes between uppercase and lowercase letters in file names and treats them as different files.

  • Ext4 (Linux) is case-sensitive.
  • NTFS (Windows), APFS (Mac), FAT are case-insensitive.

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

Contact Form