0% found this document useful (0 votes)
3 views

UNIT_1_OS

An Operating System (OS) is essential software that manages computer hardware and provides services for computer programs, acting as an interface between users and hardware. It performs key functions such as memory management, process scheduling, device management, and file management, ensuring efficient operation of computer systems. Examples of popular operating systems include Windows, Linux, macOS, iOS, and Android.

Uploaded by

Sanjeet.8136
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

UNIT_1_OS

An Operating System (OS) is essential software that manages computer hardware and provides services for computer programs, acting as an interface between users and hardware. It performs key functions such as memory management, process scheduling, device management, and file management, ensuring efficient operation of computer systems. Examples of popular operating systems include Windows, Linux, macOS, iOS, and Android.

Uploaded by

Sanjeet.8136
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

UNIT-I

Introduction of Operating Systems:

An Operating System (OS) is a collection of software that manages computer hardware resources and
provides common services for computer programs. When you start using a Computer System then
it's the Operating System (OS) which acts as an interface between you and the computer hardware.
The operating system is really a low level Software which is categorised as a System Software and
supports a computer's basic functions, such as memory management, tasks scheduling and
controlling peripherals etc.

This simple and easy tutorial will take you through step by step approach while learning Operating
System concepts in detail.

What is Operating System?

An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral devices
such as disk drives and printers.

Generally, a Computer System consists of the following components:

 Computer Users are the users who use the overall computer system.

 Application Softwares are the softwares which users use directly to perform different
activities. These softwares are simple and easy to use like Browsers, Word, Excel, different
Editors, Games etc. These are usually written in high-level languages, such as Python, Java
and C++.

 System Softwares are the softwares which are more complex in nature and they are more
near to computer hardware. These software are usually written in low-level languages like
assembly language and includes Operating Systems (Microsoft Windows, macOS, and Linux),
Compiler, and Assembler etc.

 Computer Hardware includes Monitor, Keyboard, CPU, Disks, Memory, etc.

Operating System - Examples

There are plenty of Operating Systems available in the market which include paid and unpaid (Open
Source). Following are the examples of the few most popular Operating Systems:

 Windows: This is one of the most popular and commercial operating systems developed and
marketed by Microsoft. It has different versions in the market like Windows 8, Windows 10
etc and most of them are paid.

 Linux This is a Unix based and the most loved operating system first released on September
17, 1991 by Linus Torvalds. Today, it has 30+ variants available like Fedora, OpenSUSE,
CentOS, UBuntu etc. Most of them are available free of charges though you can have their
enterprise versions by paying a nominal license fee.

 MacOS This is again a kind of Unix operating system developed and marketed by Apple Inc.
since 2001.

 iOS This is a mobile operating system created and developed by Apple Inc. exclusively for its
mobile devices like iPhone and iPad etc.

 Android This is a mobile Operating System based on a modified version of the Linux kernel
and other open source software, designed primarily for touchscreen mobile devices such as
smartphones and tablets.

Some other old but popular Operating Systems include Solaris, VMS, OS/400, AIX, z/OS, etc.

Functions of an Operating System


Memory Management
The operating system manages the Primary Memory or Main Memory. Main memory is made up of a
large array of bytes or words where each byte or word is assigned a certain address. Main memory is
fast storage and it can be accessed directly by the CPU. For a program to be executed, it should be
first loaded in the main memory. An operating system manages the allocation and deallocation of
memory to various processes and ensures that the other process does not consume the memory
allocated to one process. An Operating System performs the following activities for Memory
Management:

 It keeps track of primary memory, i.e., which bytes of memory are used by which user
program. The memory addresses that have already been allocated and the memory
addresses of the memory that has not yet been used.

 In multiprogramming, the OS decides the order in which processes are granted memory
access, and for how long.

 It Allocates the memory to a process when the process requests it and deallocates the
memory when the process has terminated or is performing an I/O operation.

Processor Management
An operating system manages the processor’s work by allocating various jobs to it and ensuring that
each process receives enough time from the processor to function properly.
Keeps track of the status of processes. The program which performs this task is known as a traffic
controller. Allocates the CPU that is a processor to a process. De-allocates processor when a process
is no longer required.
Device Management

An OS manages device communication via its respective drivers. It performs the following activities
for device management.

 Keeps track of all devices connected to the system. Designates a program responsible for
every device known as the Input/Output controller.

 Decide which process gets access to a certain device and for how long.

 Allocates devices effectively and efficiently. Deallocates devices when they are no longer
required.

 There are various input and output devices. An OS controls the working of these input-
output devices.

 It receives the requests from these devices, performs a specific task, and communicates back
to the requesting process.

File Management

A file system is organized into directories for efficient or easy navigation and usage. These directories
may contain other directories and other files. An Operating System carries out the following file
management activities. It keeps track of where information is stored, user access settings, the status
of every file, and more. These facilities are collectively known as the file system. An OS keeps track of
information regarding the creation, deletion, transfer, copy, and storage of files in an organized way.
It also maintains the integrity of the data stored in these files, including the file directory structure,
by protecting against unauthorized access.

Functions of Operating System

1. It boots the computer

2. It performs basic computer tasks e.g. managing the various peripheral devices e.g. mouse,
keyboard.
3. It provides a user interface, e.g. command line, graphical user interface (GUI)

4. It handles system resources such as computer's memory and sharing of the central processing
unit(CPU) time by various applications or peripheral devices.

5. It provides file management which refers to the way that the operating system manipulates,
stores, retrieves and saves data.

6. Error Handling is done by the operating system. It takes preventive measures whenever required
to avoid errors.

Program vs Process

A program is a set of instructions written in a programming language that


defines a specific task or functionality. A process is an instance of a program
currently being executed by the operating system. It includes program code,
data, and system resources.
For example, here is a simple program written in C programming language −
#include <stdio.h>

int main() {
printf("Hello, World! \n");
return 0;
}
A part of a computer program that performs a well-defined task is known as
an algorithm. A collection of computer programs, libraries and related data are
referred to as a software.
Process
A process is basically a program in execution. The execution of a process must
progress in a sequential fashion.
A process is defined as an entity which represents the basic unit of work to be
implemented in the system.
To put it in simple terms, we write our computer programs in a text file and
when we execute this program, it becomes a process which performs all the
tasks mentioned in the program.
When a program is loaded into the memory and it becomes a process, it can be
divided into four sections ─ stack, heap, text and data. The following image
shows a simplified layout of a process inside main memory −

Stack
The process Stack contains the temporary data such as method/function
parameters, return address and local variables.
Heap
This is dynamically allocated memory to a process during its run time.
Text
This includes the current activity represented by the value of Program Counter and
the contents of the processor's registers.
Data
This section contains the global and static variables.

Process Life Cycle


When a process executes, it passes through different states. These stages may differ
in different operating systems, and the names of these states are also not
standardized.
In general, a process can have one of the following five states at a time.

Start
This is the initial state when a process is first started/created.
Ready
The process is waiting to be assigned to a processor. Ready processes are waiting to
have the processor allocated to them by the operating system so that they can run.
Process may come into this state after Start state or while running it by but
interrupted by the scheduler to assign CPU to some other process.
Running
Once the process has been assigned to a processor by the OS scheduler, the process
state is set to running and the processor executes its instructions.
Waiting
Process moves into the waiting state if it needs to wait for a resource, such as
waiting for user input, or waiting for a file to become available.
Terminated or Exit
Once the process finishes its execution, or it is terminated by the operating system,
it is moved to the terminated state where it waits to be removed from main
memory.

Process Control Block (PCB)


A Process Control Block is a data structure maintained by the Operating System for
every process. The PCB is identified by an integer process ID (PID). A PCB keeps all
the information needed to keep track of a process as listed below in the table –
The architecture of a PCB is completely dependent on Operating System and may
contain different information in different operating systems. Here is a simplified
diagram of a PCB −

The PCB is maintained for a process throughout its lifetime, and is deleted once the
process terminates.
Process State
The current state of the process i.e., whether it is ready, running, waiting, or
whatever.
Process privileges
This is required to allow/disallow access to system resources.
Process ID
Unique identification for each of the process in the operating system.
Pointer
A pointer to parent process.
Program Counter
Program Counter is a pointer to the address of the next instruction to be executed
for this process.
CPU registers
Various CPU registers where process need to be stored for execution for running
state.

CPU Scheduling Information


Process priority and other scheduling information which is required to schedule
the process.

Memory management information


This includes the information of page table, memory limits, Segment table
depending on memory used by the operating system.

Accounting information

This includes the amount of CPU used for process execution, time limits,
execution ID etc.

IO status information
This includes a list of I/O devices allocated to the process.

Operating System - Process Scheduling


The process scheduling is the activity of the process manager that handles the removal of the
running process from the CPU and the selection of another process on the basis of a particular
strategy.

Process scheduling is an essential part of a Multiprogramming operating systems. Such operating


systems allow more than one process to be loaded into the executable memory at a time and the
loaded process shares the CPU using time multiplexing.

Categories of Scheduling
There are two categories of scheduling:

1. Non-preemptive: Here the resource can’t be taken from a process until the process
completes execution. The switching of resources occurs when the running process
terminates and moves to a waiting state.

2. Preemptive: Here the OS allocates the resources to a process for a fixed amount of time.
During resource allocation, the process switches from running state to ready state or from
waiting state to ready state. This switching occurs as the CPU may give priority to other
processes and replace the process with higher priority with the running process.

Process Scheduling Queues


The OS maintains all Process Control Blocks (PCBs) in Process Scheduling Queues. The OS
maintains a separate queue for each of the process states and PCBs of all processes in the same
execution state are placed in the same queue. When the state of a process is changed, its PCB is
unlinked from its current queue and moved to its new state queue.

The Operating System maintains the following important process scheduling queues −

 Job queue − This queue keeps all the processes in the system.

 Ready queue − This queue keeps a set of all processes residing in main memory, ready and
waiting to execute. A new process is always put in this queue.

 Device queues − The processes which are blocked due to unavailability of an I/O device
constitute this queue.

You might also like