0% found this document useful (0 votes)
3 views26 pages

OS First Unit Notes 2025

The document provides an overview of operating systems, detailing their functions, needs, and types, including batch, time-sharing, multi-programming, distributed, real-time, and open-source systems. It discusses the services provided by operating systems, such as program execution and resource allocation, as well as the advantages and disadvantages of each type. Additionally, it outlines process management, including the process life cycle and the structure of a process control block.

Uploaded by

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

OS First Unit Notes 2025

The document provides an overview of operating systems, detailing their functions, needs, and types, including batch, time-sharing, multi-programming, distributed, real-time, and open-source systems. It discusses the services provided by operating systems, such as program execution and resource allocation, as well as the advantages and disadvantages of each type. Additionally, it outlines process management, including the process life cycle and the structure of a process control block.

Uploaded by

sshreenidhi23
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

IV SEM BCA OPERATING SYSTEM UNIT I

Operating System
UNIT I-INTRODUCTION
Operating System is System Software that acts as an Interface between the
system hardware and the user, making the tasks easier.
It is important software which runs on a computer and controls the set of instructions
and wisely utilizes each part of the computer.

Needs of Operating System

The following points indicate the need for the operating system:

o More than one program runs at a time in a computer, and all of them require
your computer's CPU and memory. The operating system manages resources for
all those programs. That is why the operating system is required.
o Multitasking is a very critical feature of the OS. With its help, we can run
many programs simultaneously.
o The operating system provides a platform to run any application program in
the computer. Due to which we can do our work with the help of that application.
o It helps the user in file management. Through this, the user can save the data
according to his needs.
o You use your mouse to open the application and click on the menu. All this is
possible due to the modern operating system. This operating system allows you to
do this with the help of GUI (Graphical user interface).
o The operating system creates a communication link between the user and the
computer, allowing the user to run any application program and obtain the
required output properly.

EDURITE COLLEGE OF MANAGEMEN Page 1


IV SEM BCA OPERATING SYSTEM UNIT I

o It is almost impossible for a user to use a computer system without an


operating system. Many processes run simultaneously when a program is
executed, which is not easy for a person to manage.

Services Provided by Operating System


An Operating System provides services to both the users and to the programs.
 It provides programs an environment to execute.
 It provides users the services to execute the programs in a convenient manner.
Following are a few common services provided by an operating system −
 Program execution
 I/O operations
 File System manipulation
 Communication
 Error Detection
 Resource Allocation
 Protection

Types of Operating System


Early operating system:

1. Batch Operating System


Jobs with similar needs are batched together and executed through the
processor s as a group.
Operators sorts jobs as a deck of punch cards into batch with similar needs
Ex: Fortran batch, COBOL batch
Advantages:
1. In a batch processing job execute one after another, saving time from
activities like loading compiler
2. During a batch execution no manual intervention is needed.

EDURITE COLLEGE OF MANAGEMEN Page 2


IV SEM BCA OPERATING SYSTEM UNIT I

Disadvantages:

1. Memory limitation
2. Interaction of I/P and O/P devices directly with CPU.
3. CPU utilization is idle.

This type of operating system does not interact with the computer directly.
There is an operator which takes similar jobs having the same requirement
and groups them into batches.
It is the responsibility of the operator to sort jobs with similar needs.

 The purpose of this operating system was mainly to transfer control from
one job to another as soon as the job was completed.
 The remaining part is used for servicing jobs.

Examples of Batch based Operating System: Payroll System, Bank


Statements.

EDURITE COLLEGE OF MANAGEMEN Page 3


IV SEM BCA OPERATING SYSTEM UNIT I

[Link]-Sharing Operating Systems (Multitasking operating


system/Faire share/Multiprogramming with Round –Robin:)
Each task is given some time to execute so that all the tasks work
smoothly. Each user gets the time of CPU as they use a single system.
These systems are also known as Multitasking Systems.

 The task can be from a single user or different users also. The time that
each task gets to execute is called quantum. After this time interval is
over OS switches over to the next task.
1. Multitasking is the multiprogramming with time sharing
2. Only one CPU but switches between process so quickly that it gives on
illusion all executing at same times.
3. The task in multitasking may refer to multiple thread of the same
program.
4. Main idea is better response time and executing multiple process
together.


Advantages of Time-Sharing OS:
 Each task gets an equal opportunity.
 CPU idle time can be reduced
 Resource Sharing: Time-sharing systems allow multiple users
to share hardware resources such as the CPU, memory, and

EDURITE COLLEGE OF MANAGEMEN Page


4
IV SEM BCA OPERATING SYSTEM UNIT I

peripherals, reducing the cost of hardware and increasing


efficiency.
 Improved Productivity: Time-sharing allows users to work
concurrently, thereby reducing the waiting time for their turn
to use the computer. This increased productivity translates to
more work getting done in less time.
 Improved User Experience: Time-sharing provides an
interactive environment that allows users to communicate
with the computer in real-time, providing a better user
experience than batch processing.
Disadvantages of Time-Sharing OS:
 Reliability problem
 One must have to take care of the security and integrity of
user programs and data
 Data communication problem
 High Overhead: Time-sharing systems have a higher
overhead than other operating systems due to the need for
scheduling, context switching, and other overheads that come
with supporting multiple users.
 Complexity: Time-sharing systems are complex and require
advanced software to manage multiple users simultaneously.
This complexity increases the chance of bugs and errors.
 Security Risks: With multiple users sharing resources, the
risk of security breaches increases. Time-sharing systems
require careful management of user access, authentication,
and authorization to ensure the security of data and software.
Examples of Time-Sharing OS: Unix.

3. Multi-programming operating system


1. Maximize CPU utilization
EDURITE COLLEGE OF MANAGEMEN Page
5
IV SEM BCA OPERATING SYSTEM UNIT I

2. Multiprogramming means more than one process in main


memory which is ready to execute.
3. Process generally requires CPU time and I/O time. So, if
running process perform I/O or some other event which don’t
require CPU then instead of sitting idle, CPU make a context
switch and picks some other process and this idea will
continue.
4. CPU never sits idle unless there is process ready to execute
or at time of context switch.
Advantage:
1. High CPU utilization
2. Less waiting time, response time etc.
3. May be extended to multiuser
4. Now-a-days, it is useful when load is more.

Disadvantages:
1. Difficulties in scheduling
2. Main memory management required
3. Memory fragmentation
4. Paging (Non-contiguous memory allocation)

4. Distributed Operating System – Various autonomous interconnected


computers communicate with each other using a shared communication
networks. Independent systems possess their own memory unit and CPU.

EDURITE COLLEGE OF MANAGEMEN Page


6
IV SEM BCA OPERATING SYSTEM UNIT I

These are referred to as loosely coupled systems or distributed systems.


These system’s processors differ in size and function.
The major benefit of working with these types of the operating system is
that it is always possible that one user can access the files or software
which are not actually present on his system but some other system
connected within this network i.e., remote access is enabled within the
devices connected in that network.

EDURITE COLLEGE OF MANAGEMEN Page


7
IV SEM BCA OPERATING SYSTEM UNIT I

Advantages of Distributed Operating System:


 Failure of one will not affect the other network communication, as all
systems are independent from each other
 Electronic mail increases the data exchange speed
 Since resources are being shared, computation is highly fast and durable
 Load on host computer reduces
 These systems are easily scalable as many systems can be easily added to
the network
 Delay in data processing reduces.

Disadvantages of Distributed Operating System:


 Failure of the main network will stop the entire communication
 To establish distributed systems the language which is used are not well
defined yet
 These types of systems are not readily available as they are very expensive.
Not only that the underlying software is highly complex and not understood
well yet
Examples of Distributed Operating System are- LOCUS.

EDURITE COLLEGE OF MANAGEMEN Page 8


IV SEM BCA OPERATING SYSTEM UNIT I

Special Purpose Systems


There are various classes of computer systems based on their computational speed,
usage, and hardware. The following are some special-purpose systems according
to specific applications. They use:
1. Real-time
2. Handheld and portable systems.

Real-Time Operating System


These types of OS serve real-time systems. The time interval required to process
and respond to inputs is very small. This time interval is called response time.
Real-time systems are used when there are time requirements that are very strict
like missile systems, air traffic control systems, robots, etc.
Two types of Real-Time Operating System which are as follows:
 Hard Real-Time Systems:
These OS are meant for applications where time constraints are very strict and even
the shortest possible delay is not acceptable. These systems are built for saving life
like automatic parachutes or airbags ,medical critical care systems, Aircraft
systems which are required to be readily available in case of any accident. Virtual
memory is rarely found in these systems.
 Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.
Example: online transaction system and live stock price quotation system.

EDURITE COLLEGE OF MANAGEMEN Page 9


IV SEM BCA OPERATING SYSTEM UNIT I

Advantages of RTOS:
 Maximum Consumption: Maximum utilization of devices and system, thus more
output from all the resources
 Task Shifting: The time assigned for shifting tasks in these systems are very less.
For example, in older systems, it takes about 10 microseconds in shifting one task to
another, and in the latest systems, it takes 3 microseconds.
 Focus on Application: Focus on running applications and less importance to
applications which are in the queue.
 Real-time operating system in the embedded system: Since the size of programs
are small, RTOS can also be used in embedded systems like in transport and others.
 Error Free: These types of systems are error-free.
 Memory Allocation: Memory allocation is best managed in these types of systems.

Disadvantages of RTOS:
 Limited Tasks: Very few tasks run at the same time and their concentration is very
less on few applications to avoid errors.
 Use heavy system resources: Sometimes the system resources are not so good and
they are expensive as well.
 Complex Algorithms: The algorithms are very complex and difficult for the
designer to write on.
 Device driver and interrupt signals: It needs specific device drivers and interrupts
signals to respond earliest to interrupts.
 Thread Priority: It is not good to set thread priority as these systems are very less
prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.

Handheld and portable systems: (geeks)


Hand-held systems refer to small portable devices that can be carried along and are
capable of performing normal operations.
They are usually battery-powered. Examples include Personal Digital Assistants
(PDAs), mobile phones, palm-top computers, pocket PCs etc. As they are handheld
devices, their weights and sizes have certain limitations as a result they are equipped

EDURITE COLLEGE OF MANAGEMEN Page 10


IV SEM BCA OPERATING SYSTEM UNIT I

with small memories, slow processors and small display screens, etc.

Open Source Operating System


The term "open source" refers to computer software or applications where the owners
or copyright holders enable the users or third parties to use, see, and edit the product's
source code. The source code of an open-source OS is publicly visible and editable.
The open-source operating system allows the use of code that is freely distributed and
available to anyone and for commercial purposes. Being an open-source application or
program, the program source code of an open-source OS is available. The user may
modify or change those codes and develop new applications according to the user
requirement. Some basic examples of the open-source operating systems are Linux,
Open Solaris, Free RTOS etc.
Advantages
1. Reliable and efficient: The open-source operating systems are most reliable and
efficient. Thousands of eyes monitor these because the source code is public. As a
result, if there are any bugs or errors, they are fixed by the best developers worldwide.

2. Cost-efficient: Most of the open-source operating systems are free. And some of
them are far less expensive than commercially closed products.

3. Flexibility: The great advantage is you may customize it as per your requirement.
And there is creative freedom.

Disadvantages
1. Complicated
It is not as user-friendly as the ones that are closed. To use this software, you must
have a basic understanding of technology.
2, Security risk
Despite the defects having been detected, there is a risk of assaults because the
attackers have access to the source code.
3. No support
If you run across an issue, there is no customer support available to assist you

EDURITE COLLEGE OF MANAGEMEN Page 11


IV SEM BCA OPERATING SYSTEM UNIT I

Process Management

Process: A process is basically a program in execution. The execution of a


process must progress in a sequential fashion.
Memory allocation for Process can be divided into four sections:
1. Stack 2. Heap 3. Text 4. Data

Stack

Heap
Data
Text

1. Stack: The process stack contains the temporary data such as


method/Function parameters, return address and local variables.
2. Heap: This is dynamically allocated memory to a process during its run
time.
3. Text: It contains the executable code. It also contains current activity
represented by the value of program counter and contents of processors
registers.
4. Data: This section contains the global and static variable.

 Text sections are equivalent, the Data, Heap and Stack sections vary for same
program of different users.

EDURITE COLLEGE OF MANAGEMEN Page 12


IV SEM BCA OPERATING SYSTEM UNIT I

Process Life Cycle (Process State)


When a process executes, it passes through different states. These stages may
differ in different operating systems and the names of these states are not
standardized.
1. New: The process is being created.
2. Running: Instructions are being executed.
3. Waiting: The process is waiting for some event to occur (Ex:
I/O completion or reception of a signal)
4. Ready: The process is waiting to be assigned to a processor.
5. Terminated: The process has finished execution.

As a process executes, it changes its state.

Diagram of process state

EDURITE COLLEGE OF MANAGEMEN Page 13


IV SEM BCA OPERATING SYSTEM UNIT I

Process Control Block(PCB) OR Task control Block (TCB):


A process control block is a data structure maintained by OS for
every process. The PCB is identified by an integer process-ID
(PID).It contains many pieces of information associated with a
specific process. These are:
1. Process state: The state may be New, Ready, Running,
Waiting, Halted and so on.
2. Process privileges: This is required to allow /disallow access
to system resources.
3. Program Counter: The counter indicates the address of the
next instruction to be executed for this process
4. Process ID: Unique identification for each of the process in the O/S.
5. CPU register: Various CPU registers (AC,index registers,stack
pointer ,GPR
registers) where process need to be stored for execution for
running state. Along with the program counter ,this state
information must be saved when an interrupt occurs, to allow
the process to be continued correctly afterward
6. CPU-scheduling information: information includes process
priority and other scheduling information which is required to
schedule the process.
7. Memory –management information: this includes the
information of page table, memory limits, segment table
depending on memory system used by the O/S.
8. Accounting Information: This includes the amount of CPU and
real time used, time limits, account numbers, process ID and so
on.

EDURITE COLLEGE OF MANAGEMEN Page 14


IV SEM BCA OPERATING SYSTEM UNIT I

9. I/O status information: Information includes the list of I/O


devices allocated to process, a list of open files and so on.
 The PCB is maintained for a process throughout its life time
and is deleted once the process terminated.
Process ID
State
Program counter

CPU registers

CPU-
scheduling
Information
Memory-
Management
Accounting
information
I/O status
information

………….

Process scheduling
The objective of multiprogramming is to have some process
running at all times, to maximize CPU utilization
The objective of time sharing is to switch the CPU among
processes so frequently that users can interact with each
program while it is running.
To meet these objectives the process scheduler selects an

EDURITE COLLEGE OF MANAGEMEN Page 15


IV SEM BCA OPERATING SYSTEM UNIT I

available process (Possibly from set of several available


process) for program execution on the CPU.
 For a single –process system, there will never be
more than one running process.
 If there are more processes, the rest will have to
wait until the CPU is free and can be rescheduled.
Definition: 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.

Scheduling Queues:

1 Job Queue: As process enters the system, they are put into job
queue, which consist of all processes in the system.
2. Ready Queue: The process that are residing in main memory and
are ready and waiting to execute are kept on a list called the ready
queue.
3. Device queue (I/O waiting Queue):
The processes which are blocked due to unavailability of I/O device
constitute this queue.
The OS can use different policies to manage each queue (FIFO,R-R,
Priority and so on).The Os scheduler determines how to move
processes between the ready and run queues which can only have
one entry per processor core on the system.

EDURITE COLLEGE OF MANAGEMEN Page 16


IV SEM BCA OPERATING SYSTEM UNIT I

EDURITE COLLEGE OF MANAGEMEN Page 17


IV SEM BCA OPERATING SYSTEM UNIT I

Schedulers:
A process migrates between the various scheduling queues through out
its life time purposes. The OS must select for the scheduling processes
from these queues in some fashion. This selection process is carried out
by appropriate scheduler.
Definition: Schedulers are the special system S/W which handles
process scheduling in various ways. Their main task is to select the
jobs to be submitted into system and to decide which process to run.
Schedulers are of three types:

1. Long-Term schedulers
2. Short-Term schedulers.
3. Medium-term schedulers.

1. Long-Term schedulers(JOB schedulers)


 Long term schedulers select process from disk (job-Queue) and
loads them into memory for execution. It controls the degree of
multiprogramming i.e no. of process in the memory. It executes
less frequently than other schedulers. If the degree of
multiprogramming is stable than average rate of process creation is
equal to average departure rate of processes leaving the system. So ,the
long term scheduler is needed to be invoked only when a process
leaves the system.
 The primary goal (objective) of the job scheduler is to provide a
balanced mix of jobs, such as I/O bound and Process-Bound.
 I/O bound: An I/O bound process spends in doing I/O operation
(Ex:C-programming)

EDURITE COLLEGE OF MANAGEMEN Page 18


IV SEM BCA OPERATING SYSTEM UNIT I

 CPU bound /Process bound: It spends more times in doing


computation than I/O opearations ( Ex: Complex sorting program).

2. Short-Term schedulers.(CPU Schedulers):


It selects among the process that are ready (ready queue) and
allocates the CPU to one of them. Short term schedulers is
known as dispatcher, make the decision of which
Process to execute next. It selects a new process for the CPU
quite frequently. It execute at least one in [Link] to the
short duration of time between executions, it is very fast.
3. .Medium-term scheduler:
The main idea behind this scheduler is that sometimes it is
advantageous to remove process from memory and hence
reduce the degree of multiprogramming .At some later time, the
process can be reintroduced into memory and its execution can
be continued from where it had left off. This is called as
swapping .The process is swapped out and swapped in by
medium term scheduler.
 Swapping is necessary to improve the process mix or due to some
changes in memory requirements, the available memory limit is
executed which requires some memory to be freed up.

EDURITE COLLEGE OF MANAGEMEN Page 19


IV SEM BCA OPERATING SYSTEM UNIT I

Comparison among schedulers


Long Term Short term Medium Term
scheduler scheduler scheduler

1 It is a job- It is CPU scheduler It is process


scheduler swapping
scheduler

2 Speed is lesser Speed is fastest Speed is in


than short term among other two between both short
scheduler and long term
scheduler

3. It controls the It provides lesser It reduces the


degree of controls over degree of
Multiprogramming degree of multiprogramming
multiprogramming

4 It is almost absent It is also minimal It is the part of


or minimal in time in time sharing time sharing
sharing system system

EDURITE COLLEGE OF MANAGEMENT Page 20


IV SEM BCA OPERATING SYSTEM UNIT I

It selects process It selects those It can re-introduce


5 from pool (job processes which the process into
queue) and loads are ready to memory and
them into execute execution can be
memory for continued
execution

Context switch:
A context switch is the mechanism to store and restore the state or
context of CPU in process control block (PCB) so that a process
execution can be resumed from the same point at a later time. Using
this technique, a context switch enables multiple processes to share
a single CPU. Context switching is essential part of multitasking
operating features.
When the scheduler switches the CPU from executing one
process to execute another, the state from current running
process is stored into the process control block. After this ,the
state for the process to run next is loaded from its own PCB and
used to set the PC,registers and so on. At that point, the 2nd
process can start executing.
Context switches are automatically intensive since register and
memory state must be saved and restored. To avoid the amount of
context switching time, some H/W systems employs two or more
sets of processor registers when the process is switched, the
following information is stored for later use.
[Link] [Link] information [Link] and limit registers use
[Link] used register [Link] state 6.I/O state information
EDURITE COLLEGE OF MANAGEMENT Page 21
IV SEM BCA OPERATING SYSTEM UNIT I

[Link] information

Operations on Processes: The following operations can be


performed on a process in the operating system:
1. Process creation
2. Process scheduling or dispatching
3. Blocking
4. Preemption
5. Termination.

 Process creation
Process creation is the initial step to process execution. It implies
the creation of a new process for execution. Processes need to be
created in the system for different operations. This can be done by
the following events −
EDURITE COLLEGE OF MANAGEMENT Page 22
IV SEM BCA OPERATING SYSTEM UNIT I

 User request for process creation.


 System initialization
 Execution of a process creation system call by a running process
A process may be created by another process using fork(). The
creating process is called the parent process and the created process
is the child process. A child process can have only one parent but a
parent process may have many children. Both the parent and child
processes have the same memory image, open files, and environment
strings. However, they have distinct address spaces.
A diagram that demonstrates processs creation using fork() is as
follows −

Process Preemption

An interrupt mechanism is used in preemption that suspends the


process executing currently and the next process to execute is
determined by the short-term scheduler. Preemption makes sure that
all processes get some CPU time for execution.
A diagram that demonstrates process preemption is as follows −

EDURITE COLLEGE OF MANAGEMENT Page 23


IV SEM BCA OPERATING SYSTEM UNIT I

Process Blocking
The process is blocked if it is waiting for some event to occur. This
event may be I/O as the I/O events are executed in the main memory
and don't require the processor. After the event is complete, the
process again goes to the ready state.
A diagram that demonstrates process blocking is as follows −

Process Termination
After the process has completed the execution of its last instruction,
it is terminated. The resources held by a process are released after it
is terminated.
A child process can be terminated by its parent process if its task is
no longer relevant. The child process sends its status information to

EDURITE COLLEGE OF MANAGEMENT Page 24


IV SEM BCA OPERATING SYSTEM UNIT I

the parent process before it terminates. Also, when a parent process is


terminated, its child processes are terminated as well as the child
processes cannot run if the parent processes are terminated.
There are many events that may lead to process termination, some
of them are:
1. One process terminating the other process.
2. A problem in the hardware.
3. The process is fully executed, implying that the OS is finished.
4. An operating system might terminate itself due to service errors.

Interprocess communication
Interprocess communication is the mechanism provided by the
operating system that allows processes to communicate with each
other. This communication could involve a process letting another
process know that some event has occurred or the transferring of data
from one process to another.

A process can be of two types:


 Independent process.
 Co-operating process.

An independent process is not affected by the execution of other


processes while a co-operating process can be affected by other
executing processes.
Independent processes don't share any data with other processes
Though one can think that those processes, which are running
independently, will execute very efficiently, in reality, there are

EDURITE COLLEGE OF MANAGEMENT Page 25


IV SEM BCA OPERATING SYSTEM UNIT I

many situations when co-operative nature can be utilized for


increasing Computational speed, convenience, and modularity.

Methods of Cooperating Process communication


Cooperating processes may coordinate with each other by sharing
data or messages. The methods are given below:

1. Cooperation by sharing

The processes may cooperate by sharing data, including variables,


memory, databases, etc

[Link] by Communication

The cooperating processes may cooperate by using messages. If every


process waits for a message from another process to execute a task, it
may cause a deadlock. If a process does not receive any messages, it
may cause Starvation.

EDURITE COLLEGE OF MANAGEMENT Page 26

You might also like