Skip to main content

Introduction to OS-Operating System

What is Operating System

 
The Operating System is a program with the following features 

An operating system is a system software that acts as an interface between the user and the computer hardware.
It is an integrated set of specialized programs used to manage overall resources and operations of the computer. 
It is a specialized software that controls and monitors the execution ofall other programs that reside in the computer, including application Unit 
 

Intorduction to Opeating System

all other programs that reside in the computer, including applicationprograms and other system software. 

Objectives of Operating System


To make the computer system convenient to use in an efficientmanner. To hide the details of the hardware resources from the users.To provide users a convenient interface to use the computer system. To act as an intermediary between the hardware and its users, makingit easier for the users to access and use other resources.  To manage the resources of a computer system.


Memory Management 


Memory management refers to management of Primary Memory or Main Memory. For a program to be executed, it must in the main memory.  

An Operating System does the following activities for memory management


Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part arenot in use. 
In multiprogramming, the OS decides which process will get memory when and howmuch.
Allocates the memory when a process requests it to do so.
 

Processor Management

 

Important Functions of OS


The OS decides which process gets the processor when and for how much time. Thisfunction is called CPU scheduling.

An Operating System does the following activities for processor management
 
Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller.

Allocates the processor (CPU) to a process. 
Deallocate processor when a process is no longer required.
De-allocates the memory when a process no longer needs it or has been terminated.

Device Management


The OS Keeps track of all the devices. 
It does the following activities fordevice management.
Keeps tracks of all devices. The program responsible for this task is known asthe I/O controller. 

Decides which process gets the device when and for how much time.
Allocates the device in the most efficient way. 
De-allocates devices. 

File Management 


A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. 

An Operating System does the following activities for file management


Keeps track of information, location, uses, status etc. The collective facilities are often known as file system. Decides who gets the resources.  

Security: Prevents unauthorized access to programs and data by means of passwords and other similar techniques.

Following are the common services offered by an almost all OS 


User Interface

 
Usually Operating system comes in two forms or types. 

Depending on theinterface their types have been further subdivided. These are,

  • Command line interface (CLI) 
  • Graphical User Interface (GUI) 
The CLI usually deals with using text commands and a technique for enteringServices Provided by Operating System those commands. 

GUI is a window system with a pointing device (like mouse or trackball) topoint to the I/O, choose from menus driven interface and to make choicesviewing from a number of lists and a keyboard to entry the texts. 

Program Execution in Operating system

 
The operating system must have the capability to load a program into memoryand execute that program. 

Furthermore, the program must be able to end its execution, either normally orabnormally.

File System Manipulation in Operating System

File handling portion of operating system also allows users tocreate and delete files by specific name along with extension,search for a given file and / or list file information. 

Some programs comprise of permissions management forallowing or denying access to files or directories based on file

I/O operations in Operating System
A program which is currently executing may require I/O, whichmay involve file or other I/O device. For efficiency and protection, users cannot directly govern theI/O devices. So, the OS provide a means to do I/O Input /Output operation which means read or write operation with any
ownership. file.

Communication system of Operating System


Processes executing on same computer system or on differentcomputer systems can communicate using operating system support.

Resource Allocation


When multiple jobs running concurrently, resources must need to beallocated to each of them. Resources can be CPU cycles, mainmemory storage, file storage and I/O devices. CPU schedulingroutines are used here to establish how best the CPUcan be used. 

Error Detection


Errors may occur within CPU, memory hardware, I/O devices and inthe user program. For each type of error, the OS takes necessaryaction to handle the error. This service of the operating system keeps track of which users areusing how much and what kinds of computer resources have beenused for accounting or simply to accumulate usage statistics.

Security


Prevents unauthorized access to programs and data bymeans of passwords and other similar techniques.
routines are used here to establish how best the CPUcan be used. 

Accounting


A process is basically a program in execution. A process is defined as an entity which represents the basic unit ofwork to be implemented in the system. A computer program becomes a process when an executable file isloaded into memory 

To put it in simple terms, we write our computer programs in a textfile and when we execute this program, it becomes a process whichperforms all the tasks mentioned in the program. 

Concept of Process in OS


A word processing program being run by an individual user on aPC is a process. 
Process

A system task such as sending output to printer can also be aprocess.

When a program is loaded into the memory and it becomesa process, it can be divided into four sections ─ stack, heap,text and data. 

The following image shows a simplified layout of a processinside main memory. 
The process Stack contains the temporary data such asmethod/function parameters, return address and local This is dynamically allocated memory to a process during

This includes the current activity represented by the valueof Program Counter and the contents of the processor's

Stack

This section contains the global and static
variables

Heap

its run time. Text, registers. 

A computer program is a collection of instructions thatperforms a specific task when executed by a computer. 

Process Life Cycle


When a process executes, it passes through different states.These stages may differ in different operating systems, and

In general, a process can have one of the following fivestates at a time. 
Process Life Cycle 
the names of these states are also not standardized. the names of these states are also not standardized. 

New: This is the initial state when a process is first started/created. The process is waiting to be assigned to a processor. Ready processes arewaiting to have the processor allocated to them by the operating system so thatthey can run. Process may come into this state after Start state or while runningit by but interrupted by the scheduler to assign CPU to some other process. 

Once the process has been assigned to a processor by the OS scheduler, theprocess state is set to running and the processor executes its instructions. Process moves into the waiting state if it needs to wait for a resource, such aswaiting for user input, or waiting for a file to become available.

Terminated or Exit

Ready


Once the process finishes its execution, or it is terminated by the operatingsystem, it is moved to the terminated state where it waits to be removed frommain memory.

Running


Once the process has been assigned to a processor by the OS scheduler. 

Waiting


Process Control Block is a data structure that containsinformation of the process related to it. The process control block is also known as a task controlblock, entry of the process table, etc. It is very important for process management as the data
structuring for processes is done in terms of the PCB. 

Structure of the Process Control Block

 
Process Control Block (PCB) The process control stores many data items that are needed for efficient process management. 
Some of these data items are explained with the help of thegiven diagramstructuring for processes is done in terms of the PCB. 

Structure of PCB 


Process State


This specifies the process state i.e. new, ready, running,waiting or terminated. 

Process Number


This shows the number of the particular process. 
This contains the address of the next instruction that needsto be executed in the process. 
PCB continue This specifies the registers that are used by the process.They may include accumulators, index registers, stackpointers, general purpose register.


PCB Continue 

List of Open Files

These are the different files that are associated with the processCPU Scheduling Information
 
The process priority, pointers to scheduling queues etc. is the  CPU scheduling information that is contained in the PCB. This may also include any other scheduling parameters. 

Memory Management Information


The memory management information includes the page tables or the segment tables depending on the memory system used. It also contains the value of the base registers, limit registers etc.
The memory management information includes the page tables 

I/O Status Information 


This information includes the list of I/O devices used by the  process, the list of files etc.
 

Accounting information

 
The time limits, account numbers, amount of CPU used, process numbers etc. are all a part of the PCB accounting information.

User interface


The features of a computer system which allows theuser to interact with it. A user interface, also sometimes called a human-computer interface,comprises both hardware and software components. 

 It handles the interaction between the user and the system. 
 

The types of user interface are as follows 

 
  • command line (cli).
  • graphical user interface (GUI).
  • menu driven(mdi).

Command Line Interface

 
User Operating System Interface Command line interfaces are the oldest of the interfaces discussed here.

It involves the computer responding to commands typed by the operator.This type of interface has the drawback that it requires the operator toremember a range of different commands and is not ideal for novice
command line (cli), graphical user interface (GUI), menu driven(mdi)users.


Graphical User Interface


The graphical user interface is the most popular user interface A GUI uses windows, menus and icons to execute commands.  A mouse is the most common way to navigate through a GUI,although many GUIs allow navigation and execution via a

The advantage of a GUI is the interface visually displays the available functions. Graphical user interfaces (GUI) are sometimes also referred toas WIMP because they use Windows, Icons, Menus and Operators use a pointing device (such as a mouse, touchpad ortrackball) to control a pointer on the screen which then interactswith other on-screen elements.
today. 

keyboard. 
Pointers. 


System Calls


System calls provides an interface to the services made available by an operating System calls are usually made when a process in user mode requires access to a Then it requests the kernel to provide the resource via a system call.  System call is the programmatic way in which a computer program requests a
These calls are generally available as functions written in C and C++
system. 
resource. 

service from the kernel of the OS 





As can be seen from this diagram, the processes execute normally in the user mode until a system call interrupts this.  Then the system call is executed on a priority basis in the kernel After the execution of the system call, the control returns to theuser mode and execution of user processes can be resumed. 

Access to a hardware devices such as a printer, scanner etc.requires a system call.  If a file system requires the creation or deletion of files.Reading and writing from files also require a system call.  Creation and management of new processes. Network connections also require system calls. This includessending and receiving packets.
mode. 

In general, system calls are required in the following situations: In general, system calls are required in the following situations:


Introduction to Linux


Linux is an open-source operating system like other operatingsystems such as Microsoft Windows, Apple Mac OS, iOS, Googleandroid, etc. An operating system is a software that enables the communicationbetween computer hardware and software. It conveys input to get processed by the processor and brings outputto the hardware to display it. This is the basic function of anoperatingsystem. 
to the hardware to display it. This is the basic function of anoperatingsystem.

Evolution of Linux OS


The Linux OS was developed by Linus
Torvalds in 1991, whichsprouted as an idea to improve the UNIX OS.  He suggested improvements but was rejected by UNIX designers.Therefore, he thought of launching an OS, designed in a way thatcould be modified by its users. Nowadays, Linux is the fastest-growing OS. It is used from phones tosupercomputers by almost all major hardware devices.


Multiuser capability


Multiple users can access the same system resources likememory, hard disk, etc. But they have to use different terminals to operate. 

Multitasking


More than one function can be performed simultaneously by dividingthe CPU time intelligently.

Portability


Portability doesn't mean it is smaller in file size or can be carried in pendrives or memory cards. It means that it support different types of hardware. 

Security


It provides security in three ways namely authenticating (by assigningpassword and login ID), authorization (by assigning permission to read, write andexecute) and encryption (converts file into an unreadable format). 

 Live CD/USB: Almost all Linux distros provide live CD/USBso that userscanrun/try it without installing it. 6. Graphical User Interface (X Window system): Linux is command line based OSbut it can be converted to GUI based by installing packages. 
 

Features of Linux 


 Support's customized keyboard

 
As it is used worldwide, hence supports differentlanguages keyboards. 

Application support


It has its own software repository from where users candownload and install many applications. 

File System


Provides hierarchical file system in which files and directories arearranged. 

Open Source


Linux code is freely available to all and is a community based.development p. Live CD/USB: Almost all Linux distros provide live CD/USBso that userscan
The architecture of a Linux System consists of the following layers − 

Architecture of Linux 


Hardware layer


Hardware consists of all peripheral devices (RAM/ HDD/CPU/Printers etc). 

The following illustration shows the architecture of a Linux system − It is the core component of Operating System, interacts directly with hardware,provides low level services to upper layer components. 
Application Layer 
Shell 

Linux kernel is the core part of the operating system. It establishes communicationbetween devices and software. Moreover, it manages system resources. It has four
Kernel 
Hardware 


Responsibilities of Kernel


Device Management


A system has many devices connected to it like CPU, a memory device, sound cards,graphic cards, etc. A kernel stores all the data related to all the devices in the device driver (without thiskernel won't be able to control the devices). Thus kernel knows what a device can do and how to manipulate it to bring out the bestperformance. It also manages communication between all the devices. The kernel has certain rules thathave to be followed by all the devices.
 

Memory management


Another function that kernel has to manage is the memory management. The kernel keeps track of used and unused memory and makes sure that processesshouldn't manipulate data of each other using virtual memory addresses. 

Process management

 
In the process, management kernel assigns enough time and gives priorities to processesbefore handling CPU to other processes. It also deals with security and ownership information. 

Handling system calls


Handling system calls means a programmer can write a query or ask the kernel toperform a task.have to be followed by all the devices. 

Shell/System Libraries

 
An interface to kernel, hiding complexity of kernel's functions from users. The shelltakes commands from the user and executes kernel's functions. System libraries are special programs that help in accessing the kernel's features. A kernel has to be triggered to perform a task.

Application Layer

 
Some examples of end tools are graphic design tools, office suites, browsers,multimedia players, etc.
applications. 

End tools are not required for the operating system but are necessary for a user.  End tools are not required for the operating system but are necessary for a user. 

A file system is the way in which files are named, stored, retrieved as wellas updated on a storage disk or partition. It is the way files are organized on the disk. 

A file system is a logical collection of files on a partition or disk. Linux File System or any file system generally is a layer that is under theoperating system that handles the positioning of your data on the storage;without it, the system cannot knows which file starts from where and endswhere. 
A file system is divided in two segments called User data and Metadata(Filename, size, creation time, accessed time etc)  Linux supports many file systems. Each of these file systems uses its ownmetadata structures to define how data is stored and accessed. 

Introduction to File System 


Major Filesystem types in linux are Ext3, Ext4, VFAT, Swap etc 

Ext3 and Ext4: Ext stand for Extended file system. These are used to create and access logical volume. 

VFAT: It is similar to File Allocation Table(FAT) of Windows and stands forVirtual File Allocation Table. It is used in external medias like Pendrives and all3. Swap: It is used to create swap area in the hard disk, which can be used asvirtual memory. A file system is divided in two segments called User data and Metadata(File

File Types


It refers to the ability of OS to distinguish different types of files such astext, source file, binary files etc.

Ordinary Files: These are the files containing user information. These are text,databases or executable program.

Directory Files: These file contains list of file names and other information related tothese files.

Special Files: These are known as device files. These files represents physical devicelike disks, terminals, printers, networks etc.

Process Environment
Process environment also called process context, contains the address space of a process. 

Menu card just for you !

Select Your favourite topic to learn.

Comments

Trending⚡

Happy birthday Hardik Pandya | In C programming

  Happy birthday Hardik Pandya . Now you are  28 years old. Great achievement you have. Let's we want to talk more about Hardik pandya. He is great cricketer. Pandya is awesome. In this Blog Post we are going to wish pandya " Happy birthday using C program". Let's tune with us till end. Now we have to wish pandya, so we are going to use printf () function printing message to pandya as " Happy birthday Hardik pandya Now you are 28 years old". Hardik pandya was born on 11 October in 1993. Now we are going to declare a variable called as current_age = 2021 - 1993. It calculate current age Of Hardik pandya. See the "Happy birthday pandya" using c programming. If you liked this Blog Post then don't forget to share with your computer science learning friends. Once again " Happy birthday Hardik Pandya sir". Read also Happy Rakshabandhan wish using C program Friendship day 2021 greetings in C

What is programming explained in simple words

Hi my dear friends today in this blog post we are going to know what programming is? In simple words I will explain to you programming. Nowadays we are watching real life use of programming. How computers learn to speak, talk and do the specified complex task for us. We are all keen to know what is exactly programming? Programming is the process of creating instructions that a computer can understand and execute. These instructions, also known as code, are written in a programming language that is specific to the task at hand. The history of programming can be traced back to the mid-20th century, with the development of the first electronic computers. The first programming languages were known as machine languages, which were specific to a particular type of computer. As computers became more sophisticated, high-level programming languages were developed, such as FORTRAN and COBOL, which were easier for humans to read and write. These languages allow programmers to write code t

check number is prime or odd or even using c program

Here is the c program to check if the user entered number is prime ,even and odd. These few lines of code solve three problems. In the above program we used integer type num variable for storing user entered numbers. Then we used the IF condition statement. That's all. IF condition for even number In the First IF statement we have a logic. If the number is divided by two then the reminder should be 0 then the number is an even number else not an even number. That simple logic is implemented in the first if statement. IF condition for odd number In the second IF statement we Implemented odd number logic. We identify odd numbers just by making little change in even number logic. If the number is divided by two then the reminder should not be a zero. Then the number is odd. That's simple logic used to identify whether a number is odd or not an odd number. IF condition for prime number In the third IF condition we implemented the logic of the prime number. In this IF

Graph Data Structure

Graph A graph can be defined as a group of vertices and edges that are used to connect these vertices. A graph can be seen as a cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of having parent child relationship. A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices. A Graph G(V, E) with 5 vertices (A, B, C, D, E) and six edges ((A,B), (B,C), (C,E), (E,D), (D,B), (D,A)) is shown in the following figure. Directed and undirected graph Graph terminology Graph Representation Directed Graph Adjancency Matrix Graph Traversal Depth first search algorithm Directed and undirected graph A graph can be directed or undirected. However, in an undirected graph, edges are not associated with the directions with them. An undirected graph does not have any edges in directions. If an edge exists between ver

How to write programs in Bhai language

Bhai Language Bhai language is fun Programming language , with this language you can makes jokes in hindi. Bhai language written in typescript. It's very funny , easy and amazing language. Keywords of this language written in Hindi . Starting and ending of the program Start program with keyword " hi bhai " and end with " bye bhai ". It's compulsory to add this keyword before starting and end on the program. You write your programming logic inside this hi bhai and bye bhai . How to declare variables in Bhai language We use " bhai ye hai variable_name" keyword for declaring variables. In javascript we use var keyword for declaring variables but here you have to use " bhai ye hai " keyword. If you are declaring string then use " " double quotes. You can use Boolean variable like sahi and galat for true and false . How to print output in Bhai language You have to use " bol bhai " keyword for