Unit-1 Complete
Unit-1 Complete
(KCS-401)
Internal Marks 50
Ens Semester Marks 100
The Operating systems are different according to the three primary characteristics which
are licensing, software compatibility, and complexity.
Licensing
• There are basically three kinds of Operating systems. One is Open Source OS,
another is Free OS and the third is Commercial OS.
• Linux is an open source operating system which means that anyone can download
and modify it for example Ubuntu etc.
• A free OS doesn’t have to be open source. They are free to download and use but
cannot modify them. For example, Google owns Chrome OS and makes it free to
use.
• Commercial operating systems are privately owned by companies that charge money
for them. Examples include Microsoft Windows and Apple macOS. These require to
pay for the right (or license) to use their Operating systems.
Complexity
Operating systems come in basically two editions one is 32-bit and other is 64-bit
editions. The 64-bit edition of an operating system best utilizes random access memory
(RAM).
A computer with a 64-bit CPU can run either a 32-bit or a 64-bit OS, but a computer
with a 32-bit CPU can run only a 32-bit OS.
Convenient
User friendly
• Operating system finds the status of processor and processes, chooses job and its
processor and then allocates processor to process and also de-allocates process
when it’s executed.
• The operating system handles the responsibility of storing any data, system
programs, and user programs in memory. This function of the operating system is
called memory management.
• The OS is also responsible for reallocated the memory from the processes that is
already terminated.
• The resource management is one of the important function handled by the OS. The
OS is the overall in charge of the system resources. Some of the most important
system resources include the main memory RAM, storage space and processor
cycle time.
• The CPU starts the program execution when the OS loads the executable copy of
the program into main memory RAM. The OS allocates the required memory to
execute the program. The OS also allocates another important resource that is
CPU’s processing time.
• An operating system manages the files and directories of computer system. All the
files with different extensions are managed by OS. A file can be defined as a
collection of information or data that is store in the memory of computer system. A
file can be a text file, image file, audio file, video file, and may contain data in any
other form.
• An operating system allow us to create, delete, save, edit files in a computer
system.
• The operating system is helpful in making changes in the stored files and in
replacing them. It also plays an important role in transferring various files to a
device.
• The operating system allocates and de-allocates resources. It regulates which
process gets the file and for what duration. Also, it keeps track of information,
location, uses, status etc.
• This function of operating system is used to manage different devices that are
connected with the computer system.
• An operating system interact with hardware device through specified device
drivers. Operating System manages device communication via their respective
drivers.
• It does the following activities for device management −
Keeps tracks of all devices. I/O controller is responsible for this task
Decides which process gets the device when and for how much time.
Allocates the device in an efficient way.
De-allocates devices.
• Security module protects the data and information of a computer system against
malware threat and authorized access.
• One of the important responsibility of the OS is to provide secure and run time
environment to various processes (both application and system processes) which
are being executed on computer system.
• The system security is another important aspect which is handled by the OS. It
ensures the security of computer system from the various threats and viruses
attacks. An operating system uses various techniques such as authentication,
authorization, cryptography etc. for ensuring security of compute system.
• A command interpreter is the part of OS that interprets and executes command that
are entered interactively by the system user or from a application program.
• The command interpreter is an interface between system and user. There are two
types of user interface:-
Command Line Interface (CLI)
Graphical User Interface (GUI)
• When we are working with tapes, a large amount of CPU time wasted in mounting
tapes or in operating the input/output device as CPU was sitting without any work
to perform.
• To speed up processing, jobs with similar needs are batched together and executed
through processor as a group.
• In the batch system, firstly user prepares his job (program + I/P data + control
instructions) by using punch cards and then he submits the job to the computer
operator. A system has card reader in which punch cards are inserted. Output also
appeared in the form of punch card after processing.
• The operator sorts the jobs as a deck of punch cards into batch with similar needs.
• A batch is the deck of punch cards.
• User cannot interact with batch OS. But operator can interact with OS.
• Batches are executed sequentially. After completion of batch1, batch2 is executed
and so on.
Advantages:
• Processors of the batch systems are aware of the time duration of the job
even when it is present in the queue.
• A new job gets started as soon as the previous job is finished without any
manual intervention; this increases the performance of the system.
• In batch, job execute one after another saving the time for loading and
unloading the compiler and other data,
Disadvantages:
• Operator can not insert batch2 until the completion of batch1.
• Memory limitation.
• There is a lack of interaction between a user and his job. Once a batch of jobs is
submitted for execution, the user is not able to interact with any of his jobs. If a
job requires the user to input data during run time, then the user must wait till
the other jobs of the batch get executed and if an error occurs while the
program is in execution, it can be found only after the completion of all jobs.
Due to this increases the overall execution time.
Dr Manish Gupta, MIT Moradabad
• It may lead to starvation because a particular batch of jobs might take a long time
for their execution of other jobs in other batches have to wait for a long time to
execute.
• CPU may remain idle for a long time in the batch system. If the processes of a
batch need some I/O operation, at that time CPU must wait till the I/O operation
gets completed.
• Insufficient use of CPU because of speed mismatch between fast CPU and slow
devices and CPU cannot take any other job and execute it.
Disadvantages:
• If the main network fails, this will stop the complete communication.
• They are very expensive.
• The underlying software is highly complex.
• A Network Operating System runs on a server and provides the server the
capability to manage data, users, groups, security, applications, and other
networking functions.
• The primary purpose of the network operating system is to allow shared file and
printer access among multiple computers in a network, typically a local area
network (LAN), a private network or to other networks.
• These allow shared access to networking functions on minor or small private
network.
• All the users know the configuration of all the other users in the network, their
private or individual connections etc.
Advantages:
• The servers are Highly stable and centralized
• Servers handle Security concerns
• New technologies and hardware up-gradation can be easily integrated
• Server access is possible remotely from various locations and different types of
systems
Disadvantages:
• Costly servers
• Depended on central location
• Regular updates and maintenance required
Examples:
• MS Windows Server 2003, MS Windows Server 2008, NetWare, BSD etc.
• The processing of the given input or data must be done within the given time
constraints otherwise the system fails.
• The logical result or output of the computation produces by the system and the time
to produce the result describes the accuracy of the system.
• Real-time systems fetch data from sensors after that process it and provide output
before the time constraints as it has well defined fixed time constraints.
• Examples of Real-time systems are medical imaging systems, industrial control
systems, home appliance systems, automobile-engine fuel injection systems, and
weapon systems, etc.
• There are two types of real-time operating systems:
i) Hard real-time systems and
ii) Soft real-time systems.
• In a hard-real time system, the system must perform the task within the given time
constraints. If there is a single failure in the system to meet the deadline is a
complete or catastrophic system failure.
• Air Traffic Control systems, missiles launching, time bomb and nuclear reactor
control systems are some examples of hard real-time systems.
• The multi user operating system uses to use a system by multiple users. In other
word multi user operating system allows a number of users to work simultaneously
on a single computer system. These types of operating systems are specially
designed for the multi user system.
• Examples of multi user operating systems includes Unix, Linux, Windows 2000
and VM - 386.
• Example: In a word processor, one thread (t1) is for displaying graphics, second
thread (t2) for reading keystrokes from the user and a third thread (t3) for
performing spelling and grammar checking in the background.
Advantages
• Responsiveness – It allows a program to continue its execution even if part of it is
blocked or is performing a lengthy operation thereby increasing the responsiveness
to the user.
• Resource sharing – The memory and the resources of the process shared by
threads to which they belong.
• Utilization of Multiprocessor Architecture – In Multiprocessor Architecture each
thread may be running in parallel on a different processor. Multithreading on a
multi-CPU machine increases concurrency.
• Economy – It is costly to allocate memory and resources for process creation.
Threads share resources of the processes to which they belong, it is more
economical to create threads.
• In this concept, two or more user programs can be in main memory and can be
executed concurrently. The CPU can give time to various programs despite sitting
idle when one is busy with I/O operations.
• When one program is waiting for I/O transfer then next program can utilize the
processor. Therefore, several processes can share the time of the CPU.
• OS cannot forcefully remove the program from CPU during execution. Program
itself release CPU when wait for I/O operation.
• CPU is idle when there is no process in main memory or at the time of switching
between processes.
Advantages
• Throughput is increased by utilizing the idle time of the CPU by running other
programs also that are already available in the main memory.
• Waiting Time or response time is lowered by identifying the priority of a job as it
enters in the system and by executing jobs on behalf of their priority.
• May be extended to multiple users.
• Very useful when load is very high. You can open multiple application at the same
time.
Disadvantages
• Cannot assign CPU to next smaller program if CPU is busy in execution of larger
program . Smaller program must wait for a long time.
• Difficult CPU scheduling is required.
• Main memory management is also required.
• Memory fragmentation
• The multiprocessor operating system allows the computer system to use more than
one CPU in a single system for executing more than one or multiple processes at a
same time.
• This OS shares their bus, clock, memory and input/output devices.
• A computer system having multiple CPU process faster than a system which
contains a single CPU. However, all the processors share the same common main
memory (RAM).
• Examples of multiprocessor operating systems are Linux, Unix, windows 2000 etc.
Advantages:
• By permitting parallel processing of different portions of programs, enhances the
performance of the computer systems.
• Multiprocessing provides the facility of built-in backup. If one of the CPUs breaks
down, the other CPUs automatically controls the complete workload until repairs
are made. Thus, a complete breakdown of such a system is very rare, so that
reliability of system increase.
Disadvantages:
• A good performance OS required to schedule, balance and coordinate the input,
output and processing activities of multiple CPUs. To build such type of OS it
requires a large amount of time and highly powered computer working people.
• It is very expensive.
• The main memory of bigger size is required for holding the special OS along with
various users programs.
Multitasking Multiprocessing
1 The execution of more than one process takes The presence of more than one processor in a
place simultaneously. system that can execute large no of instruction in
parallel mode.
2 In this system the no of processor is one. In this system the no of processors are more than
one.
3 It takes more amount of time in process It takes less time in process execution.
execution.
4 In this, jobs are executed one by one at a time. In this, more no of jobs can be executed at a
time.
5 In this system the whole process is depend In this system the whole process is divided
only on one processor. between the multiple processors.
Switching does not present in a real-time system whereas it takes place in a time-
sharing system.
In Time sharing, a process can retain the resources for a fixed amount of time and
can be reallocated to another process after that time but users can share resources in
RTOS.
In RTOS, users should get a response within a fraction of time but if not results are
disastrous. In a time-sharing system, the response should get within fractions of
seconds but if not, the results are not disastrous.
Also, it is important for the Operating System to function in the dual mode because
the Kernel Level programs perform all the bottom level functions of the OS like
process management, Memory management, etc., and if these are altered by the user,
then this can cause an entire system failure. So, for specifying the access to the users
only to the tasks which are of their use, Dual Mode is necessary for an Operating
system.
So, whenever the system works on the user applications, it is in the User mode.
Whenever the user requests for some hardware services, a transition from User mode
to Kernel mode takes place and this is done by changing the mode bit from 1 to 0.
And for returning again into the User mode, the mode bit is again changed to 1.
• The process of loading the OS into the RAM is known as Booting Process.
• The OS is essential system software which effectively handles some of the most
important functions.
• The system user can start using the computer only after the OS is fully loaded into
the RAM. And therefore, the CPU initiates the booting process by activating
another system software called the BIOS.
• BIOS is a small piece of system software placed in a ROM chip on the
motherboard.
• The BIOS is a start up routine present on the mother board in the form of BIOS
chip. The main job of BIOS is to search and load the OS.
• The BIOS is a start up system program that gets activated every time the system is
powered on.
• It is the BIOS that performs initial hardware check on some key components such
as power supply unit (PSU-SMPS) , memory-RAM, processor, display monitor
and keyboard.
• The BIOS initiates the system booting process by starting a self diagnostic test
called POST (Power ON Self Test).
• If the POST test is completed successfully then BIOS will proceed further and
search for a capable OS.
• The BIOS loads the OS into main memory RAM and handover the control to OS.
The CMOS memory chip is a type of miniature volatile memory chip which stores
the data required during the system booting process.
The CMOS battery is used on the motherboard to supply power to CMOS RAM
which stores the user settings and other data required during booting process. The
most commonly used CMOS battery found on most motherboards is the CR2032
Lithium Coin Cell.
The UEFI is a new replacement for the firmware BIOS. In simple words, BIOS is a
small piece of system software placed in a ROM chip on the motherboard.
The UEFI is a latest new advanced version of the BIOS that will be doing the same
job previously done by the BIOS. However, both BIOS and UEFI operate differently.
UEFI offers a presentable GUI interface as compared to the text navigation menu of
the BIOS.
The UEFI has also added number of security features and that has significantly
improved the system security.
• The OS internally use another system software called Driver. The OS interacts
with hardware components through a set of drivers.
• The OS provides the necessary resources and the run time environment to the
various other applications running on the computer.
Simple Structure
Layered structure
Not having very well defined structure. Because these OS designed in very beginning.
It started as small, simple, limited resource and then grew beyond their original scope.
It was written to provide most functionality in least space, not divided into modules
carefully.
No Hardware protection.
• Here, bottom most is the ROM BIOS device drivers, it is like base hardware. Top
of this we have device drivers. Then we have resident system programs and then
application programs.
• The device drivers may have access to basic hardware and resident system
programs have access to the device drivers as well as basic hardware.
Dr Manish Gupta, MIT Moradabad
• The application programs have access to the resident programs as well as basic
hardware.
• The base hardware can be accessed by all things above it. Application program,
resident program, device drivers all can access basic hardware.
• Application programs can access the basic hardware directly without going to levels
below it. When user runs a program and since it is directly accessing the basic
hardware, if the program fails then entire system going to be fail.
• MS DOS was actually written on Intel 8088. This Intel 8088 does not provide Dual
mode or any hardware protection. The designer or developer of this system have no
other option than to just leave this basic hardware accessible by all layers above it.
The bottom layer (layer 0) is the hardware; the highest (layer N) is the user interface.
Each layer hides the existence of certain data structures, operations, and hardware from
higher-level layers. Every layer is having different functionalities.
Disadvantages:
1. Designing of this structure.
We have to be careful and specific in designing and deciding which will be
layers on top of particular layer or which layers will be below of particular layer.
This is necessary because the upper layers can only use the functionalities of the
layers below them.
Eg. A layer which deals with backing storage (disk space used by virtual-memory
algorithms) must be below the layer which deals with memory management.
Because memory management routine needs to use services provided by the
backing storage.
The backing-store driver would normally be above the CPU scheduler, because
the driver may need to wait for I/O and the CPU can be rescheduled during this
time. So we have to be very careful in designing. Dr Manish Gupta, MIT Moradabad
2. Not very much efficient as compared to other structures.
When one layer wants to use services provided by the layers below it. The
request has to go down below each layer one by one. By the time service is
actually provided it may not be very fast.
eg. A user program in layer N want to execute I/O operation. So, in order to
execute I/O operation, it has to get the service from layer 0 (hardware layer).
User program issue system calls and system calls go through all layers one by one
and reach to layer 0. As it passed through all layers one by one, it is not going to
be very efficient. It takes some time to get I/O operation.
3. I/O Operations
A running program that you have may require I/O, which may involve a file or an
I/O device and this I/O operation provided by the OS. An user can not directly
control the I/O devices.
The error can occur anytime and anywhere. The error may occur anywhere in the
computer system like in CPU, in I/O devices or in the memory hardware. There
are some activities that are performed by an operating system:
When error occurs, the system must not break down completely and it should not seize
your computing ability completely. The OS must have a way in which it manages the
errors so that your computing are consistent and still carried on if some errors are
encountered.
OS must help in resource allocation. It allocates the required resource to processes which
are waiting or asking for those resources. OS allocates them in efficient manner such that
all processes get the resources they need and no process keeps waiting for resource.
We should not have scenario where a process keeps waiting for resource and never get it.
We should not have scenario where a resource is hacked by a process and never released.
So the OS manage how the resources are allocated. The allocation must be in such a
away that all the processes gets the resource they need and computing takes place in
efficient manner.
Security means outside access. We should make sure that system is not access from
outsiders who are not allowed to access the system.
• The kernel performs its tasks such as executing processes and handling interrupts,
in kernel space, whereas a user normally does all the tasks such as writing text in a
text editor or running programs in a GUI (graphical user interface) in user space.
Monolithic Kernels are those Kernels where the user services and the kernel services
are implemented in the same memory space i.e. different memory for user services
and kernel services are not used in this case.
By doing so, the size of the Kernel is increased and this, in turn, increases the size of
the Operating System.
As there is no separate User Space and Kernel Space, so the execution of the process
will be faster in Monolithic Kernels.
All the basic system services like process and memory management, interrupt
handling etc were packaged into a single module in kernel space.
Advantages:
It provides CPU scheduling, memory scheduling, file management through System
calls only.
Execution of the process is fast because there is no separate memory space for user
and kernel.
Disadvantages:
If any service fails, then it leads to system failure.
If new services are to be added then the entire Operating System needs to be
modified.
The problem with this is that there are too many functions are packed into one level
and this makes its implementation and maintance very difficult.
Debugging is also difficult. If there is a problem in CPU scheduling then you have to
touch entire kernel.
As we are using User Space and Kernel Space separately, so it reduces the size of the
Kernel and this, in turn, reduces the size of Operating System.
As we are using different spaces for user services and kernel service, so the
communication between application and services is done with the help of message
passing and this, in turn, reduces the speed of execution.
If a program is executed in user mode and if program crashes then entire system is
not going to crash. But if it is running in kernel mode, if a particular program fails
then entire system crashed.
Disadvantages:
Since we are using User Space and Kernel Space separately, so the communication
between these can reduce the overall execution time.
It suffers from performance decrease due to system increase overhead. We know that
message passing used in communication between client program and other services.
Communication has to be done always , there could be system overhead leading to a
decreased performance.
Types Operating Systems types are Kernel types are monolithic kernel and
multiuser, multitasking, micro kernel.
5 multiprocessor, realtime, distributed
etc.
Boot Operating System is the first Kernel is the first program to load when
6 program to load when computer operating system loads.
boots up.
MS Windows: It is designed by Microsoft for home and business purposes. It is GUI based
OS which provides a very user friendly interface.
MS DOS
It is the command line OS which borrowed many ideas from UNIX and other early OS.
Although it is a single user, single tasking OS without any GUI support.
One of the main uses of Spooling is to copy data from one device to another
where in one of the devices is considerable faster than the other device.
Spooling is a process in which data is temporarily held to be used and
executed by a device, program or the system.
Spooling considers the entire secondary memory as a huge buffer which can
store many jobs and data for many operations. The advantage of Spooling is
that it can create a queue of jobs which can be executed in FIFO (First In –
First Out) order to execute the jobs one by one.
Input devices may put their data onto the secondary memory (SPOOL)
which can then be executed one by one by the device. This will make sure
that the CPU is not idle any time. So, we can say that Spooling is a
combination of buffering and queueing.
After the CPU generates some output, this output is first saved in the main
memory. From the main memory, this output is transferred to the secondary
memory and from there the output is sent to the respective output devices.
Disadvantages of Spooling
• Spooling requires a large amount of storage depending on the number of
requests made by the input and the number of input devices connected.
• Because the SPOOL is created in the secondary storage, having many
input devices working at the same time may take up a lot of space on the
secondary storage and thus increase disk traffic. This results in the disk
getting slower and slower as the traffic increases more and more.
Long term (job) scheduler – Due to the smaller size of main memory initially all program
are stored in secondary memory. When they are stored or loaded in the main memory
they are called process. This is the decision of long term scheduler that how many processes
will stay in the ready queue. Hence, in simple words, long term scheduler decides the
degree of multi-programming of system.
Medium term scheduler – Most often, a running process needs I/O operation which doesn’t
requires CPU. Hence during the execution of a process when a I/O operation is required
then the operating system sends that process from running queue to blocked queue.
When a process completes its I/O operation then it should again be shifted to ready
queue. ALL these decisions are taken by the medium-term scheduler. Medium-term
scheduling is a part of swapping.
Short term (CPU) scheduler – When there are lots of processes in main memory initially
all are present in the ready queue. Among all of the process, a single process is to be
selected for execution. This decision is handled by short term scheduler.
Dr Manish Gupta, MIT Moradabad
Scheduler & Dispatcher
A dispatcher is a module, it connects the CPU to the process selected by the short-term
scheduler.
For example, if we have three processes P1, P2, and P3 in the ready state. If we are
using the First Come First Serve approach, then the scheduler will first select the process
P1 and the dispatcher will transfer the process P1 from the ready state to the running
state. After completion of the execution of the process P1, the scheduler will then select
the process P2 and the dispatcher will transfer the process P2 from ready to running
state and so on.
The main function of the dispatcher is switching, it means switching the CPU from one
process to another process.
Another function of the dispatcher is jumping to the proper location in the user program
and ready to start execution.
The time taken by the dispatcher to stop one process and start another running is called
the Dispatch Latency in OS.
The degree of multiprogramming is dependent on the dispatch latency. If the dispatch
latency is increasing, then the degree of multiprogramming decreases.
Dr Manish Gupta, MIT Moradabad
Dr Manish Gupta, MIT Moradabad
Difference between the Scheduler and Dispatcher
Scheduler Dispatcher
The scheduler selects a process from a list of The dispatcher transfers the process selected by
the short-term scheduler from one state to
processes by applying some process scheduling
another.
algorithm.
For selecting a process, the scheduler uses some The dispatcher doesn't use any kind of
process scheduling algorithm like FCFS, Round- scheduling algorithms.
Robin, SJF, etc.
The only duty of a scheduler is to select a process But apart from transferring a process from one
from a list of processes. state to another, the dispatcher can also be used
for switching to user mode. Also, the dispatcher
can be used to jump to a proper location when
the process is restarted.
But if program is executing in user mode, and it happens to crash then entire system
does not crash or entire system does not come to halt
So user mode is safer mode of operation. User mode is safe, so most of the
programs execute in user mode.
So when the program makes a call to the OS saying that I need to use particular
resource, the context switch happens where user mode switch to kernel mode so that
program can use those resources.
The call that program can make to access the resources or go to kernel mode
known as System Call.
• Bare Machine is a logic hardware in the computer system which can execute the
programs in the processor without using the Operating System. Till now we have
studied that we cannot execute any process inside the processor without the
Operating System. But, with the Bare Machine, it is possible.
• In the early days, before the Operating systems were developed, the instructions
were executed directly on the hardware without any interfering software. But the only
drawback was that the Bare Machine accepts the program and instructions in
Machine Language. Due to this, only the trained people who were qualified in the
computer field and were able to understand and instruct the computer in Machine
language were able to operate on a computer.
• Due to this reason, the Bare Machine was termed as inefficient and cumbersome
after the development of different Operating Systems.
• The Resident Monitor is a code which runs on Bare Machine. Its acts like an
operating system which controls everything inside a processor and performs all the
functions. The Resident Monitor is thus also known as the Job Sequencer because
like the Operating system, it also sequences the jobs and sends it to the processor
for execution. After the jobs are scheduled, the Resident Monitor loads the Programs
one by one into the main memory according to their sequence. The advantage of
using a Resident Monitor over an Operating System is that there is no gap or lag
between the program executions. So, the processing is faster in the Resident
Monitors.