OS Notes Unit 1 1
OS Notes Unit 1 1
What is OS?
It is a collection of software that manages hardware
resources and provides common services for programs.
When we start using a Computer System, it is the OS which
acts as an interface between the hardware and us.
It is a low level Software which is categorized as a System
Operating System Software and supports a computer's basic functions,
such as memory management, tasks scheduling,
controlling peripherals, etc.
Unit 1 An OS is an interface between a computer user and
hardware. It 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.
1
9/1/2023
Memory Management
The Functions of OS • It refers to management of Primary Memory or Main
Memory. MM is a large array of words or bytes where each
• Process Management word or byte has its own address.
• I/O Device Management
• File Management • MM provides a fast storage that can be accessed directly by
• Network Management the CPU. For a program to be executed, it must in the MM. An
• Main Memory Management OS does the following ac vi es for memory management −
• Secondary Storage Management • Keeps tracks of MM, i.e., what part of it are in use by
• Security Management whom, what part are not in use.
• Command Interpreter System • In multiprogramming, the OS decides which process will
get memory when and how much.
• Control over system performance
• Allocates the memory when a process requests it to do so.
• Job Accounting
• De-allocates the memory when a process no longer needs
• Error Detection and Correction it or has been terminated.
• Coordination between other software and users
2
9/1/2023
Batch OS Characteristics
• The users of a BOS do not interact with the • the CPU executes the jobs in the same sequence that they
are sent to it by the operator, which implies that the task
computer directly. Each user prepares his job on an sent to the CPU first will be executed first. It's known as
off-line device like punched cards and submits it to the 'first come, first serve'
the computer operator. To speed up processing, • The word job refers to the command or instruction that
jobs with similar needs are batched together and the user and the program should perform.
run as a group. The programmers leave their • A BOS runs a set of user-supplied instructions composed
programs with the operator and the operator then of distinct instructions and programs with several
sorts the programs with similar requirements into similarities.
batches. • When a task is successfully executed, the OS releases the
The problems with BOS are: memory space held by that job.
• The user does not interface directly with the OS in a BOS;
• Lack of interaction between the user and the job. rather, all instructions are sent to the operator.
• CPU is often idle, because the speed of the • The operator evaluates the user's instructions and creates
mechanical I/O devices is slower than the CPU. a set of instructions having similar properties.
• Difficult to provide the desired priority.
3
9/1/2023
Advantages Disadvantages
• It isn't easy to forecast how long it will take to • When a job fails once, it must be scheduled to be
completed, and it may take a long time to
complete a job; only batch system processors
complete the task.
know how long it will take to finish the job in line.
• Computer operators must have full knowledge of
• This system can easily manage large jobs again batch systems.
and again. • The batch system is quite difficult to debug.
• The batch process can be divided into several • The computer system and the user have no direct
stages to increase processing speed. interaction.
• When a process is finished, the next job from the • If a job enters an infinite loop, other jobs must
job spool is run without any user interaction. wait for an unknown period of time.
• CPU utilization gets improved.
4
9/1/2023
Multitasking
• Multitasking means working on multiple tasks simultaneously, such Multitasking
as using our computer while listening to music. Also, using a
browser, search for something on the internet and create a word
document that is our assignment. It appears that all of the tasks are Advantages
taking place at the same time. It is not all of the tasks happening
simultaneously; the processor moves between them at such a fast • It provides logical parallelism.
pace that we believe they are happening simultaneously.
• Multitasking is similar to multiprogramming in that the CPU is • It provides a shorter response time.
assigned to a process for a specified period of time, i.e., 'Time
quantum or time slice', after which the CPU 'Context switches' to • It provides CPU utilization.
another process. It runs various programs at the same time.
• The PC requires a huge memory to execute multitasking (RAM or
ROM). Its primary goal is to improve the timing of the CPU's
response. Users can engage with the system during multitasking, Disadvantages
for example, by typing a letter while the printing process is running.
• Multitasking is a highly complicated system. It is based on the time • It couldn't be executed on a slow-speed processor.
slice principle, which assigns a fixed amount of time to each activity
to be completed. It is especially useful when a program requires a • It needs a large amount of storage memory to do
high level of parallelism. It provides a set amount of time for each
program to run. the work.
5
9/1/2023
Timesharing OS
• The TOS allows several users to share
• A TOS allows several users to use a computer from various
locations simultaneously. An OS is a program that makes a computer resources simultaneously. Each user
connection between the user and the system h/w. The TOS takes less CPU time because each command
is built on multiprogramming concepts, in which multiple
jobs are completed simultaneously by constantly switching or action in a time-shared system is short. The
between them. Its switching is lightning quick, allowing TOS use strategic CPU scheduling and
users to interact with every program because it runs
without sharing the system. multiprogramming to offer every user a small
time-shared system. Every user interacts with
• TOS use an interactive computer to allow direct interaction at least one separate program in memory
between the user and the system. The
term 'interactive' refers to the user's direct instructions to during execution, known as a process.
the system or program via an i/p device. The results will be
shown on the o/p devices by the system. The results are
generated faster, and the response time must be shorter
than one second.
Real-time OS
Advantages • A RTOS is a type of OS designed to serve real-time
• It helps to reduce the CPU idle time. applications that process data as it arrives. It completes a
task within a specific time. The logical result of computation
• It offers the benefits of a fast response. and the time required to produce the result determine the
correctness of the system output. It includes methods for
• It avoids the duplication of software. real-time task scheduling. It is primarily used on embedded
• Each job gets an equal opportunity. systems. It is highly useful for timing applications or
activities that are performed within a particular time limit.
It uses strict time limits to drive task execution in an
external environment.
Disadvantages
• Data communication happens in the time- • RTOSs require accurate results and timely results, which
sharing operating system. means that the results must be produced within a certain
time limit, or the system will fail. It is primarily used in
• It has the problem of reliability. control device applications like automobile-engine fuel
injection systems, industrial control systems, weapon
systems, medical imaging systems, etc.
6
9/1/2023
Advantages Disadvantages:
• A RTOS often takes less time to shift from one task to another. Tasks are • A RTOS constantly experiences signal interruptions. As a result,
typically switched in 3 microseconds or less. This type of expedited task the needed drivers must be loaded on the computer in order to
management ensures that key processes are performed on time. get consistent speed. With the help of drivers, an RTOS will be
• An RTOS is a system that is available 24/7 because it produces maximum able to respond quickly whenever an interruption occurs.
results. As a result, it is suited for applications that must run at all times.
Apart from that, an RTOS system can support different MCU systems. • An RTOS focuses on only one application at a time. It is used to
• RTOSs, particularly those based on hard RTOS, are completely error-
maintain accuracy and reduce errors. All other low-priority
free. It ensures a more effective way of handling the errors. applications need to be on waiting.
Furthermore, operating systems experience with jitter, an issue in which • Although a RTOS can focus on specific applications, it is not the
the number of errors between loops is measured. A correctly same as multitasking. They are only designed to run some of the
programmed RTOS can be optimized so that it suffers fewer jitters. tasks.
• An RTOS ensures that the system consumes more resources while • Program crashes may often be experienced while using a RTOS.
keeping all devices active. As a result, a system using RTOS experiences
very little downtime. And also hosting companies to exhibit maximum Unlike a regular OS, an RTOS may not efficiently separate
results while using RTOS. memory domains. As a result, processes would have a problem
• A RTOS focuses on one application at a time. This application will often addressing them.
be the one that is already executing. All others in a queue will be held in • Complex algorithms are behind an RTOS interface. These
a holding pattern. As a result, critical tasks may be performed on time algorithms will be difficult to write for a typical user. Only a
and within the specified deadline to achieve the exact results needed. professional developer will be able to write and understand
them.
7
9/1/2023
Linker is of two types: • Loader : a program that loads the machine codes
• 1. Dynamic Linker:- of a program into the system memory.
• It is implemented during run time.
• It requires less memory.
• It is responsible for loading the program. It is the
• There are many chances of error and failure. bare beginning of the execution of a program.
• Linking stored the program in virtual memory to save • Loading a program involves reading the contents
RAM, so we have need to share library.
of an executable file into memory. Only after the
• 2. Static Linker:- program is loaded on OS starts the program by
• It is implemented during compilation of source program. passing control to the loaded program code. All
• It requires more memory. the OS that supports loading have loader and
• Linking is implemented before execution in static linking. many have loaders permanently in their memory.
• It is faster and portable.
• In static linking there are less chances to error and no
chances to failure.