Operating System
Operating System
It is software that manages the computer hardware and allows the user
to execute programs in a convenient and efficient manner.
● An operating system is a program on which application programs are
executed.
● To control and coordinate the use of system resources like CPU time,
memory, clock etc.,
● To provide a convenient environment for a user to access the
available resources.
● To increase the productivity of processing resources.
● To use the computer hardware in an efficient manner.
The salient features about Computer System
Organisation are:
● The I/O devices and the CPU both execute concurrently. Some
of the processes are scheduled for the CPU and at the same
time, some are undergoing input/output operations.
● There are multiple device controllers, each in charge of a
particular device such as keyboard, mouse, printer etc.
● There is buffer available for each of the devices. The input
and output data can be stored in these buffers.
● The data is moved from memory to the respective device
buffers by the CPU for I/0 operations and then this data is
moved back from the buffers to memory.
● The device controllers use an interrupt to inform the CPU that
I/0 operation is completed.
Computer System Structure or
Components of Computer System
● A computer system is a collection of hardware and software
components
● Hardware refers to the physical computing equipment.
● Software refers to the programs written to provide services to the
users of the system.
● Every computer system consists of four basic components.
● Those are hardware (Memory, Central Processing Unit and the
Input-Output Unit), Operating System, System and Application
Software and Users.
Computer System Structure or Components of Computer System
2. Multiprocessor Systems
3. Clustered Systems
1.Single Processor Systems
Definition: A single processor system has only one CPU (Central
Processing Unit) that executes all instructions. It performs one task at
a time and switches between tasks using scheduling mechanisms.
Characteristics:
● Limited computational power.
● Simpler and cost-effective for basic tasks.
● Commonly used in personal computers or simple embedded
systems.
Example:
Characteristics:
● Improved performance due to parallel processing.
● More expensive and complex than single-processor systems.
● Used in servers and high-performance computing environments.
● There are two types of Multiprocessor System
Types:
Symmetric Multiprocessing (SMP): All processors are equal and share memory.
The multiprocessing system in each processor performs all types of task within the
operating system.
In this system there exists master slave relationship like one processor defined as master
and others are slave.
Example:
Characteristics:
● Nodes can work together or independently.
● If one node fails, others can take over (fault tolerance).
● Commonly used in cloud computing, data centers, and large-scale applications
Example:
Views
1. User Views: The user's view of the operating system depends on the type of
user.
● If the user is using standalone system, then OS is designed for ease of use
and high performances. Here resource utilization is not given importance.
● If the users are at different terminals connected to a mainframe or
minicomputers, by sharing information and resources, then the OS is designed
to maximize resource utilization. OS is designed such that the CPU time,
memory and I/0 are used efficiently and no single user takes more than the
resource allotted to them.
● Users of hand-held systems, expects the OS to be designed for ease of use
and performance per amount of battery life
2. System Views: Operating system can be viewed as a resource
allocator and control program.
● Resource allocator: The OS acts as a manager of hardware and
software resources. CPU time, memory space, file-storage space,I/0
devices, shared files etc. are the different resources required during
execution of a program.
1. Control access to shared resources like file, memory, I/0 and CPU.
3.The creation, execution and deletion of both user and system processes
5. Schedule a process
permanently
The Memory Management activities handled by the Operating
System
2. It keep track of which parts of memory are currently being used and by
whom.
Any kind of Input that we give to the computer goes through the
operating system. Any output that we get is also acted upon by the
Operating System.
Classification or Types of Operating System
Classification of Operating System based on Processing Method
Features
● Multiple online users can use the same computer at the same time
● Better interaction between users and computers.
● User requests can make in small-time responses.
● It is also called as Multitasking OS
Advantages of Time-Sharing Operating System
● Parallel Processing
● Great Reliability as functions are distributed
properly among several processors, then the
failure of one processor will not halt the system.
● Increased throughput as by increasing the number
of processors, we can expect more work to be
done in less time.
Disadvantages of Multi Processor
Operating System
● Implementation is complex
● Requires resource management and protection.
● processors and memory, making a system more
expensive.
5.Network Operating System
● Network operating systems are those networks that contain two
types of nodes, the servers, and clients It is also called as
Client/Server Network OS.
● The servers host the applications or services for users while clients
use these applications.
● In a client/server system, both the server and client computers
must have certain software installed to connect to each other
securely over a network connection
Advantages of Network Operating System
● Two types
○ Loosely Coupled System: Processor with own resources are not
accessible to other systems
○ Tightly Couple System: Processors share the computer bus,
memory and peripheral devices.
Advantages of Distributed Operating System
● It is more reliable as a failure of one system will not impact the
other computers or the overall system.
● All computers work independently.
● Resources are shared
● The system works at a higher speed as resources are shared
● The host system has less load.
Disadvantages of Distributed Operating System
● Costly setup.
● If the server is failed, then the whole system will fail.
● Complex software is used for such a system.
Kernel and System Call
● A Kernel is a computer program that is the heart and core of an
Operating System. It has control over everything in the system.
● The Kernel is responsible for low-level tasks such as disk
management. memory management, task management, etc.
● It provides an interface between the user and the hardware
components of the system.
● When a process makes a request to the Kernel, then it is called
System Call
Kernel Space and User Space
1. Kernel Space.
The memory space where the core of the operating system (kernel)
executes and provides its services is known as kernel space
2.User Space
The user space is the memory space where all user applications or
application software executes.
Types of Kernel
Operating System Services
1.User interface
2.Program Execution
4.File-System Manipulation
5. Error Detection
6.Communication
7.Resoures Allocation
9.Accounting
System Calls
● When the process is being run, if the process requires certain actions
which need to be carried out by Operating System, the process need to
call the function which can interact with the kernel to complete the
actions. This special type of function call is known as System Calls in OS.
1.Process Control
2. File Management
3. Device Management
4. Information Maintenance
5 Communication
6. Protection
1.Process Control
● Process control is the system call that is used to direct the
processes.
● It performs the tasks of process creation, process termination, etc.
Functions of Protection:
● System calls providing protection include setting the permissions
and getting the permissions.
● Manipulating the permission settings of resources such as files and
disks.
● System calls specify whether particular users can or cannot be
allowed access to certain resources.
PROCESSES
A process is actively running software or a
computer code
.
Component & Description
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
This includes the current activity represented by the value
of Program Counter and the contents of the processor's
registers.
Difference Between Program and Process
Program Process
The program does not have Process has its control block
any control block. called Process Control Block.
In addition to program data, a process
The program has two
also requires additional information
logical components:
required for the management and
code and data.
execution.
2 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.
3 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.
4 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.
5 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
• Long-Term Scheduler
• Short-Term Scheduler
• Medium-Term Scheduler
Long Term Scheduler
• It is also called a job scheduler.
• It determines which programs are admitted to the system for processing.
• It selects processes from the queue and loads them into memory for
execution.
• The primary objective of the job scheduler is to provide a balanced mix of jobs,
such as I/O bound and processor bound.
• It also controls the degree of multiprogramming. i.e the no. of programs
executing concurrently.
• When a process changes the state from new to ready, then there is use of
long-term scheduler.
Short Term Scheduler
Inter-Process Communication
(IPC)
Concurrent execution
Resource sharing
● Inter-Process Communication (IPC):
Cooperating processes interact with each other
via Inter-Process Communication (IPC).
● As they are interacting to each other and sharing
some resources with each other .
● To implement the IPC there are many options
such as pipes, message queues, semaphores, and
shared memory.
● Concurrent execution: These cooperating
processes executes simultaneously.
● Simultaneous execution can be done by
operating system scheduler
● Scheduler helps OS to select the process from
ready queue.
● Because of concurrent execution of several
processes the completion time decreases.
● Resource sharing: Cooperating processes
cooperate by sharing resources including CPU,
memory, and I/O hardware.
● If several processes are sharing resources,
synchronization increases and the response time of
process increase.
• Deadlocks: As cooperating processes shares their
resources, there might be a deadlock condition.
• Deadlock means if p1 process holds the resource A
and wait for B and p2 process hold the B and wait
for A.
• In this condition deadlock occur in cooperating
process.
• To avoid deadlocks, operating systems typically use
algorithms such as the Banker’s algorithm to
● Process scheduling: Cooperating processes runs
simultaneously but after context switch, which
process should be next on CPU to executes, this is
done by the scheduler.
● Scheduler do it by using several scheduling
algorithms such as Round-Robin, FCFS, SJF, Priority
etc.
THREADS IN OPERATING SYSTEM
● A thread is a separate path of execution within a program
● Threading is a programming technique that allows
multiple tasks to be executed simultaneously in a
program.
● This is done by assigning each task its own thread of
control.
• Threads run independently, but share the process's
resources.