NEP-OS - Unit 1
NEP-OS - Unit 1
NEP - OS
UNIT 1
Introduction to OS
-In the Computer System (comprises of Hardware and software),
- Hardware - understand machine code (in the form of 0 and 1) which
doesn't make any sense to a naive user.
-We need a system which can act as an intermediary and manage all the
processes and resources present in the system.
Introduction to OS
-A Computer System consists of
- Users (people who are using the computer)
- Application Programs (Compilers, Databases, Games, Video player,
Browsers, etc.)
- System Programs (Shells, Editors, Compilers, etc.)
- Operating System ( A special program which acts as an interface
between user and hardware )
- Hardware ( CPU, Disks, Memory, etc)
Introduction to OS
Definition:
An operating system acts as an intermediary between the user of a
computer and computer hardware. In short its an interface between
computer hardware and user.
Introduction to OS
The operating system has been evolving through the years. The
following table shows the history of OS.
Era Key Developments Examples
Input/output devices:
Allows users to interact with the computer.
Arithmetic logic unit (ALU):
A circuit board in the CPU that performs mathematical and logical
operations.
Accumulator register:
Temporarily stores data from memory before transferring it to the ALU.
How the OS works
• The OS acts as an interface between the user and the hardware.
• The OS manages the computer's hardware and software resources.
• The OS assigns resources among programs, such as memory, processors,
and input/output devices.
• The OS runs all the time on the computer, usually called the kernel.
Characteristics of Operating Systems
Device Management:
- The operating system keeps track of all the devices.
- So, it is also called the Input/output controller that decides which
process gets the device, when, and for how much time.
File Management:
- It allocates and de-allocates the resources and also decides who
gets the resource.
Job Accounting:
- It keeps track of time and resources used by various jobs or users.
Characteristics of Operating Systems
Error-detecting Aids:
- These contain methods that include the production of dumps,
traces, error messages, and other debugging and error-detecting
methods.
Memory Management:
- It is responsible for managing the primary memory of a computer,
including what part of it are in use by whom also check how much
amount free or used and allocate process
Processor Management:
- It allocates the processor to a process and then de-allocates the
processor when it is no longer required or the job is done.
Characteristics of Operating Systems
Ability to Evolve:
- An OS should be constructed in such a way as to permit the
effective development, testing, and introduction of new system
functions at the same time without interfering with service.
Throughput:
- An OS should be constructed so that It can give maximum
throughput (Number of tasks per unit time).
Types of Operating Systems (OS)
-Types of OS
1. Batch Os
2. Multiprogramming OS
3. Multitasking OS
4. Multiprocessing OS
5. Network OS
6. Time Sharing OS
7. Real Time OS
8. Distributed OS
Types of Operating Systems (OS)
1. Batch OS:
- Invented in 1970 - Similar types of – jabs batched together – executed in time
- People were used to single computer – called – mainframe
- Access is given to more than one person
- They submit their respective jobs to system – for execution
- System collect – all jobs in queue – FCFS manner – then executes the jobs one
by one
- The user collects – output when all jobs are executed
Types of Operating Systems (OS)
1. Batch OS:
- Purpose is to transfer the control from one job to another
- Contains resident monitor –part of main memory – remaining part is served
for job processing.
-
Types of Operating Systems (OS)
1. Batch OS:
- Advantages :
- It has increased efficiency, like a resident monitor that eliminates
CPU idle time between jobs to enable it to smoothen the
switching of tasks.
- The automatic handling of the processing of jobs
- Resource utilization is appropriate – resources are not idle
- Well present – in payroll – keep processing jobs in batches
- Complex jobs executed – without any intermission
- Group of jobs removes many – manual setup
- It logs and – deals with error at the time – when batch is over
Types of Operating Systems (OS)
1. Batch OS:
Disadvantages :
- Batch OS – suffers from starvation
- There are five jobs J1, J2, J3, J4, and J5, present in the batch. If the
execution time of J1 is very high, then the other four jobs will never be
executed, or they will have to wait for a very long time. Hence the other
processes get starved.
- Not interactive
- Batch Os is not supportive is jobs are dependent on user i/p
- If job require – i/p as input 2 number then it will not work
- Delayed output:
- Jobs submitted in batches – sends batch wise output
- Difficult to Debug:
- Once entire batch is processed then it will displays errors of all jobs
Types of Operating Systems (OS)
1. Batch OS:
Disadvantages :
- Requires knowledge of Job Scheduling:
- Large job causes delay:
- If batch has – large job to get executed – then processing needs
delay – therefore slow down the system performance
How it works
Similar jobs are grouped together into batches
The jobs are placed in a queue, first come, first served
The jobs are executed one at a time, without manual intervention
Example
Credit card companies use batch processing to generate monthly
bills for customers
Types of Operating Systems (OS)
Advantages:
- Throughput increases – as one program to execute
- Response time to be get – reduced
- Maximum utilization of resources
- Multiple programs are running simultaneously – so more task are
completed –enhance throughput of the system
- If program is waiting for I/O operation – processor does not get idle –
it takes another job for execution.
- System support short & long jobs to get executed in parallel – which
makes dynamic support for job execution
Types of Operating Systems (OS)
Disadvantages:
- Resource utilization is more – but do not provide interaction of user
with system – Also Multiple program execution – increases – system
complexity – as needs more resources to be get utilized
- Requires more memory – as multiple program are running
- The operating system has to switch between the running processes
continuously, and this leads to scheduling overhead and reduces
performance.
- As several concurrent operations access shared resources
simultaneously, the system is likely to experience deadlocks: two or
more processes waiting for each other for further actions.
- Resource contention due to competition for scarce resources could
Types of Operating Systems (OS)
Working
-Concurrent execution of processes
-Processes are divided and allotted among multiple processor
-Which enhance throughput, good resource allocation, smooth distribution of
workload, fault tolerance (means if one processor fails – other processor continue
with work)
-Types 1) Symmetric Multiprocessing 2) Asymmetric Multiprocessing
Types of Operating Systems (OS)
Symmetric Multiprocessing:
-Every processor – has same copy of OS – they share memory, I/O
devices – each processor can do any task – workload is balanced among
them – if one processor fails other can continue
Asymmetric Multiprocessing:
- One processor controls other processor – manages the task given to
other processor – master processor – provides task to OS – the other
processor performs specific task – system performance is balanced but
some time it is bottlenecked if work loaded more on master processor.
Types of Operating Systems (OS)
Advantages:
-Increased reliability : as multiple processor are present – if one failed –
task is given to another one.
-Increased Throughput: Multiple jobs are done by – multiple processor
than single processor system
-Efficient Resource Utilization: productive on resource utilization
-Parallelism: Many processes run at same time – execution speed
increased
-Scalability: As workload increased – more processor can be get added
Types of Operating Systems (OS)
Disadvantages:
-Complexity: As number of processor are more – distribution of task is
complicated task
-Increased Cost: More hardware are added – which increases cost
-Communication Overhead: Communication among processor for
distribution of task over headed as multiple tasks are running
-Software Compatibility Problems: generally most software is not
designed properly with multiprocessing
Example
- Windows, linux, Unix,
Types of Operating Systems (OS)
Disadvantages:
-If one node or server fails – effect whole system so reliability
decreases
-Security must be robust – as unauthorized user access is restricted
-Needs skilled n/w administrator – who handles system performance –
security & troubleshooting
-If n/w size is to large – then traffic is heavy – which degrade with time
if not monitored & maintained
Types of Operating Systems (OS)
Advantages:
-Easy to develop – design – implement under real time OS
-Maximum utilization of resources
-Fast response to events
-High reliability
-Strict scheduling
Disadvantages:
-Very expensive
-Resource intensive
-Less multitasking support
-Lack of adaptability
-Demand specific s/w
Types of Operating Systems (OS)
Examples
QNX Neutrino: A POSIX-compliant RTOS used in industries like
automotive, medical devices, and robotics
Wind River VxWorks: A commercial RTOS used in high-performance
applications
SafeRTOS: A commercial RTOS from Wittenstein
FreeRTOS: An open-source RTOS from Amazon Web Services
RT-Thread: An open-source RTOS
Mbed OS: An RTOS that can be used to develop projects
Types of Operating Systems (OS)
Advantages:
-effective utilization and sharing of resources.
-helps decrease CPU idle and response time
-allows various users to access and interact with their programs at the
same time, and it leads to greater productivity.
-better memory management because it swaps programs into and out
of main memory efficiently.
Disadvantages:
-Data transmission rate is high
-integrity and security of the user programs loaded in memory
-Management of time sharing is more complicated
-more and more users get hooked to the system, it degrades due to
resource contention.
-However, with time, context switches between tasks will incur
overheads, thereby impacting the overall efficiency of the system.
Types of Operating Systems (OS)
Example:
Examples of time-sharing operating systems include:
UNIX: A time-sharing operating system
Linux: A time-sharing operating system
Windows NT: A time-sharing operating system
Windows 2000 server: A time-sharing operating system
Multics: A time-sharing operating system
TOPS-10 (DEC): A time-sharing operating system
TOPS-20 (DEC): A time-sharing operating system
VMS: A time-sharing operating system
Solaris: A time-sharing operating system
Mac OS X: A time-sharing operating system
Types of Operating Systems (OS)
Disadvantages:
-Cost is high
-Managing system is complex as work is distributed
-Security may be less with nodes
-System highly depends on network stability
Function of Operating System
Memory Management
Processor Management
Device Management
File Management
Network Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Function of Operating System
Memory Management :
-Management of main memory – main memory is large array of bytes /
words – where each byte has its own address - Main memory directly
accessed by CPU – to execute any program must be in main memory
-Functions
- Keeps tracks of primary memory, i.e., what part of it are in use by
whom, what part are not in use.
- In multiprogramming, the OS decides which process will get
memory when and how much.
- Allocates the memory when a process requests it to do so.
- De-allocates the memory when a process no longer needs it or has
been terminated.
Function of Operating System
Processor Management :
-OS decides which process get processor – also for how much time –
also called as processor scheduling
-Functions
- 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.
- De-allocates processor when a process is no longer required.
Device management:
-OS manages device communication through – device drivers
-Function
- Keeps tracks of all devices. Program responsible for this task is
known as the I/O controller.
- Decides which process gets the device when and for how much
time.
- Allocates the device in the efficient way.
- De-allocates devices.
Function of Operating System
File Management :
-Files are organized into various directories – so access is done easily
-Functions
- Keeps track of information, location, uses, status etc. The collective
facilities are often known as file system.
- Decides who gets the resources.
- Allocates the resources.
- De-allocates the resources.
Security:
-Usage of password – to prevent unauthorized access
Control over System Performance:
-Record delay between request and response from system
Job Accounting:
-Keep track of which process used a resource for how much time
Error Detecting Aids:
-OS provides various techniques to detect error
Coordination between other s/w and user:
- Coordination in various s/w and user – to easy access
System Calls
Simple structure:
-System do not have – well defined structure
-They are small – simple and limited
-Interface and level of functionality are not well separated
-MS – DOS is the best example
-In this application prog. –access basic i/o routines
-System crash if any one the prog. Fails.
-Advantages:
-Because there are only a few interfaces and levels,
-it is simple to develop.
-Because there are fewer layers between the hardware
and the applications, it offers superior performance.
Operating System Structure
Simple structure:
-Disadvantages:
-OS breaks if any one program fails
-As layers are interconnected – so less data abstraction
-OS operations are accessible to all layer – so overload is more on
system and – it results in system failure
Operating System Structure
Monolithic structure:
-OS is designed in such a way that – it provide all services – such as
memory management – process management – file management –
device management – are placed in single large binary.
-This means all code runs on kernel space
-No separation between user and kernel level process
-Main advantage – system call can be made directly to kernel – without
any overhead of message passing between user and kernel.
-Design is simple
-Also all OS services are provided in single binary (means single
executable file)
Operating System Structure
Monolithic structure:
Advantages:
-Simple to design as all OS services are on
kernel space. - All services are on same
address area – so kernel runs fast – than
other system. – Also utilization of same
address – speed up task – reduce time
allocation of address
Disadvantages:
-Services are interconnected – so any one
fails – entire system fails.
-Not adaptable – so launching new service
is difficult.
Operating System Structure
Layered structure:
-OS is divided into multiple layers layer 0 lowest layer – contains
hardware layer n – contains user interface layer
-Layers are organized hierarchically – so top layer uses the capabilities of
lower level
-Functionality of each layer is separated – abstraction is achieved
-As layered structure is hierarchical – lower layer are debugged before
upper layer – so present layers is only examined
Operating System Structure
Layered structure:
Advantages:
-Work is distributed in layer – where each layer will has its own
responsibility – also abstraction is maintained.
-Debugging is simple – as lower layer are examined first
Disadvantages:
-Performance degrades as layers are increased
-Layer construction requires more careful design as upper layer uses the
capabilities of lower layer
Operating System Structure
Process: Definition:
-In an operating system, a process is a running program. Processes go
through different states while executing, and understanding these states
helps the operating system manage processes.
How processes work
A process is the fundamental unit of work that must be implemented in
a system.
A process is created when a computer program is run.
A process is made up of four parts: stack, heap, text, and data.
A process goes from a new state to a ready state after being loaded into
the main memory.
A process waits in the ready state for the processor to execute it.
Process
Process States
Process States:
-Process from its
creation to
termination goes
through various
states
-States :
- New
- Ready
- Running
- Block or wait
- Completion or
Termination
- Suspended
Process States
Process States:
1. New:
-OS picks a program/process into main memory – is called new process.
-It means process is created but not yet ready to run
-For example: When a user double-clicks on an application icon
-How OS work with new state:
- The operating system allocates memory and resources for the
process
- The program code is loaded into memory - Initial data structures
are set up.
-Long term scheduler brought process – in ready queue – so now
process is ready for execution – long term scheduler select good CPU
bound & I/O bound process- also determine how many processes can be
Process States
Process States:
2. Ready:
-In an operating system, the ready state is when a process is ready to
run but is waiting for the CPU to be assigned.
-Processes in the ready state are kept in a queue called the ready
queue.
-Once the process created & loaded into main memory – then it is ready
state
-Process enter in ready state after I/O
-Example:
-Opening multiple tabs in a web browser: When you open several
tabs in a web browser, each tab is considered a separate process. While
you are actively using one tab, the other open tabs are in a "ready
Process States
Process States:
3. Running:
-The "running state" refers to when a process is actively being executed
by the CPU, meaning its instructions are currently being carried out by
the processor; essentially, the process is actively doing work at that
moment.
-In single core – at a time only one process is running
-A process can move from running to waiting state – if it wants to
perform I/O operation. – It means currently word application is running
so suppose if want to read the data from browser and copy & paste on
word then temporarily current process is paused.
Process States
Process States:
4. Block or Wait State:
-In an operating system, a "block" or "wait" state refers to when a
process is temporarily suspended because it needs to wait for a specific
event to occur, like user input, a resource to become available, or an I/O
operation to complete, essentially pausing its execution until the
required condition is met;
-an example would be a program waiting for data to be read from a
hard drive before it can continue processing.
-So if resources are unavailable then – process is transferred to block
state.
-After availability of resources the process gets signal – and process is
transferred from block to ready state.
Process States
Process States:
4. Block or Wait State:
-In an operating system, a "block" or "wait" state refers to when a
process is temporarily suspended because it needs to wait for a specific
event to occur, like user input, a resource to become available, or an I/O
operation to complete, essentially pausing its execution until the
required condition is met;
-an example would be a program waiting for data to be read from a
hard drive before it can continue processing.
-So if resources are unavailable then – process is transferred to block
state.
-After availability of resources the process gets signal – and process is
transferred from block to ready state.
Process States
Process States:
4. Block or Wait State:
-In an operating system, a "block" or "wait" state refers to when a
process is temporarily suspended because it needs to wait for a specific
event to occur, like user input, a resource to become available, or an I/O
operation to complete, essentially pausing its execution until the
required condition is met;
-an example would be a program waiting for data to be read from a
hard drive before it can continue processing.
-So if resources are unavailable then – process is transferred to block
state.
-After availability of resources the process gets signal – and process is
transferred from block to ready state.
Process States
Process States:
5. Termination State:
-In an operating system, the "termination state" refers to the final stage
of a process where it has completely finished executing its instructions
and is no longer active, essentially meaning the process has ended.
- An example would be closing a calculator app on your computer,
where the process is moved to the terminated state once you close the
application.
-Upon termination the process releases – all the resources allocated to
it like memory, CPU time etc.
-OS removes the PCB allocated to a process
-Example : normal exit – error exit – forced termination
Process States
Process States:
6. Suspended Ready State:
-In an operating system, a "suspended ready" state refers to a process
that was previously in a ready state to be executed by the CPU, but has
been temporarily moved to secondary storage (like a hard disk) due to
memory limitation.
-It means that it is currently not actively ready to run but can be
brought back to the ready state when needed; essentially, it's "waiting
on the sidelines" until enough memory becomes available.
-Example – a large application is trying to open – at the same multiple
programs are running – systems main memory is full – so newly open
application – might not having enough space – so now process may get
placed in suspended ready state till space gets available.
Process States
Process States:
7. Suspended wait State:
-A "suspended wait state" in an operating system refers to a process
that is currently waiting for an event to occur, but has been temporarily
moved to secondary storage (like a hard disk) because the main
memory is full.
-So essentially "parking" the process until space becomes available; this
usually happens when a higher priority process needs to be executed
immediately, effectively putting the waiting process on hold.
-Here process moves from main memory to secondary memory as
higher priority processes are arrived.
Process Control Block
THANK YOU.