OS Intro
OS Intro
An operating system acts as an intermediary between the user of a computer and computer hardware. The
purpose of an operating system is to provide an environment in which a user can execute programs in a
convenient and efficient manner.
An operating system is software that manages the computer hardware. The hardware must provide
appropriate mechanisms to ensure the correct operation of the computer system and to prevent user
programs from interfering with the proper operation of the system.
Operating System – Definition:
An operating system is a program that controls the execution of application programs and acts as
an interface between the user of a computer and the computer hardware.
A more common definition is that the operating system is the one program running at all times on
the computer (usually called the kernel), with all else being application programs.
An operating system is concerned with the allocation of resources and services, such as memory,
processors, devices, and information. The operating system correspondingly includes programs to
manage these resources, such as a traffic controller, a scheduler, memory management module, I/O
programs, and a file system.
Operating system as User Interface –
1. User
2. System and application programs
3. Operating system
4. Hardware
Every general-purpose computer consists of the hardware, operating system, system programs, and
application programs. The hardware consists of memory, CPU, ALU, and I/O devices, peripheral device,
and storage device. System program consists of compilers, loaders, editors, OS, etc. The application
program consists of business programs, database programs.
When the first electronic computer was developed in 1940, it was created without any operating system.
In early times, users have full access to the computer machine and write a program for each task in
absolute machine language. The programmer can perform and solve only simple mathematical
calculations during the computer generation, and this calculation does not require an operating system.
The first operating system (OS) was created in the early 1950s and was known as GMOS. General
Motors has developed OS for the IBM computer. The second-generation operating system was based
on a single stream batch processing system because it collects all similar jobs in groups or batches and
then submits the jobs to the operating system using a punch card to complete all jobs in a machine. At
each completion of jobs (either normally or abnormally), control transfer to the operating system that is
cleaned after completing one job and then continues to read and initiates the next job in a punch card.
After that, new machines were called mainframes, which were very big and used by professional
operators.
During the late 1960s, operating system designers were very capable of developing a new operating
system that could simultaneously perform multiple tasks in a single computer program called
multiprogramming. The introduction of multiprogramming plays a very important role in developing
operating systems that allow a CPU to be busy every time by performing different tasks on a computer
at the same time. During the third generation, there was a new development of minicomputer's
phenomenal growth starting in 1961 with the DEC PDP-1. These PDP's leads to the creation of personal
computers in the fourth generation.
The fourth generation of operating systems is related to the development of the personal computer.
However, the personal computer is very similar to the minicomputers that were developed in the third
generation. The cost of a personal computer was very high at that time; there were small fractions of
minicomputers costs. A major factor related to creating personal computers was the birth of Microsoft
and the Windows operating system. Microsoft created the first window operating system in 1975. After
introducing the Microsoft Windows OS, Bill Gates and Paul Allen had the vision to take personal
computers to the next level. Therefore, they introduced the MS-DOS in 1981; however, it was very
difficult for the person to understand its cryptic commands. Today, Windows has become the most
popular and most commonly used operating system technology. And then, Windows released various
operating systems such as Windows 95, Windows 98, Windows XP and the latest operating system,
Windows 7. Currently, most Windows users use the Windows 10 operating system. Besides the
Windows operating system, Apple is another popular operating system built in the 1980s, and this
operating system was developed by Steve Jobs, a co-founder of Apple. They named the operating
system Macintosh OS or Mac OS.
Batch Processing :
A series of jobs are executed without any human intervention in Batch processing system. In this set of
jobs with similar needs are batched together and inputted to the computer for execution. It is also called as
Simple Batch System. It is slower in processing than Multiprogramming system.
SPOOLING:-
In a computer system peripheral equipment’s, such as printers and punch card readers etc (batch
processing), are very slow relative to the performance of the rest of the system. Getting input and output
from the system was quickly seen to be a bottleneck. Here comes the need for spool.
Spooling works like a typical request queue where data, instructions and processes from multiple sources
are accumulated for execution later on. Generally, it is maintained on computer’s physical memory,
buffers or the I/O device-specific interrupts. The spool is processed in FIFO manner i.e. whatever first
instruction is there in the queue will be popped and executed.
Spooling stands for "Simultaneous Peripheral Operations Online". So, in a Spooling, more than
one I/O operations can be performed simultaneously i.e. at the time when the CPU is executing some
process then more than one I/O operations can also de done at the same time. The following image
will help us in understanding the concept in a better way:
From the above image, we can see that the input data is stored in some kind of secondary device and
this data is then fetched by the main memory. The benefit of this approach is that, in general, the CPU
works on the data stored in the main memory. Since we can have a number of input devices at a time,
so all these input devices can put the data into the disk or secondary memory. Then, the main memory
will fetch the data one by one from the secondary memory and the CPU will execute some instruction
on that data. Both the main memory and secondary memory are digital in nature, so taking data from
the main to secondary is very fast. Also, when the CPU is executing some task then at that time, the
input devices need not wait for its turn. They can directly put their data in the secondary memory
without waiting for its turn. By doing so, the CPU will be in the execution phase most of the time. So,
the CPU will not be idle in this case.
When the CPU generates some output, then that output is first stored in the main memory and the
main memory transfers that output to the secondary memory and from the secondary memory, the
output will be provided to some output devices. By doing so, again we are saving time because now
the CPU doesn't have to wait for the output device to show the output and this, in turn, increases the
overall execution speed of the system. The CPU will not be held idle in this case.
For example, in a printer spooling, there can be more than one documents that need to be printed. So,
the documents can be stored into the spool and the printer can fetch that documents and print the
document one by one.
Advantages of Spooling
Since there is no interaction of I/O devices with CPU, so the CPU need not wait for the I/O
operation to take place. The I/O operations take a large amount of time.
The CPU is kept busy most of the time and hence it is not in the idle state which is good to
have a situation.
More than one I/O devices can work simultaneously.
In spooling, the I/O of one job can be handled along with some operations of another job.
While in buffering, only one job is handled at a time.
Spooling is more efficient than buffering.
In buffering, there is a small separate area in the memory know as a buffer. But spooling can
make use of the whole memory.
Multiprogramming :
Multiprogramming operating system allows to execute multiple processes by monitoring their process
states and switching in between processes. It executes multiple programs to avoid CPU and memory
underutilization. It is also called as Multi-program Task System. It is faster in processing than Batch
Processing system.
Advantages of Multiprogramming :
Disadvantages of Multiprogramming :
Long time jobs have to wait long
Tracking all processes sometimes difficult
CPU scheduling is required
Requires efficient memory management
User interaction not possible during program execution
Multiprocessing –
In a uni-processor system, only one process executes at a time.
Multiprocessing is the use of two or more CPUs (processors) within a single Computer system. The term
also refers to the ability of a system to support more than one processor within a single computer system.
Now since there are multiple processors available, multiple processes can be executed at a time. These
multi processors share the computer bus, sometimes the clock, memory and peripheral devices also.
Multi processing system’s working –
With the help of multiprocessing, many processes can be executed simultaneously. Say processes
P1, P2, P3 and P4 are waiting for execution. Now in a single processor system, firstly one process
will execute, then the other, then the other and so on.
But with multiprocessing, each process can be assigned to a different processor for its execution. If
its a dual-core processor (2 processors), two processes can be executed simultaneously and thus will
be two times faster, similarly a quad core processor will be four times as fast as a single processor.
Why use multi processing –
The main advantage of multiprocessor system is to get more work done in a shorter period of time.
These types of systems are used when very high speed is required to process a large volume of data.
Multi processing systems can save money in comparison to single processor systems because the
processors can share peripherals and power supplies.
It also provides increased reliability in the sense that if one processor fails, the work does not halt, it
only slows down. e.g. if we have 10 processors and 1 fails, then the work does not halt, rather the
remaining 9 processors can share the work of the 10th processor. Thus the whole system runs only
10 percent slower, rather than failing altogether.
Multiprocessing refers to the hardware (i.e., the CPU units) rather than the software (i.e., running
processes). If the underlying hardware provides more than one processor then that is multiprocessing. It is
the ability of the system to leverage multiple processors’ computing power.
Difference between Multi programming and Multi processing –
A System can be both multi programmed by having multiple programs running at the same time
and multiprocessing by having more than one physical processor. The difference between
multiprocessing and multi programming is that Multiprocessing is basically executing multiple
processes at the same time on multiple processors, whereas multi programming is keeping several
programs in main memory and executing them concurrently using a single CPU only.
Multiprocessing occurs by means of parallel processing whereas Multi programming occurs by
switching from one process to other (phenomenon called as context switching).
* Memory Management: For the execution of a process, the whole process is put into the main
memory and the process is executed and after the execution of the process, the memory is freed and that
memory can be used for other processes. So, it is the duty of the Operating System to manage the
memory by allocating and deallocating the memory for the process.
* I/O Device Management: There are various I/O devices that are present in a system. Various
processes require access to these resources and the process should not directly access these devices. So,
it is the duty of the Operating System to allow the use of I/O devices by the various process that are
requiring these resources.
* File Management: There are various files, folders and directory system in a particular computer. All
these are maintained and managed by the Operating System of the computer. All these files related
information are maintained by using a File Allocation Table or FAT. So, every detail related to the file
i.e. filename, file size, file type, etc is stored in the File Allocation Table. Also, it is the duty of the
Operating System to make sure that the files should not be opened by some unauthorized access.
* Virtual Memory: When the size of the program is larger than the main memory then it is the duty of
the Operating System to load only frequently used pages in the main memory. This is called Virtual
Memory.
* Primary Goal-User convenience: The primary goal of an Operating System is to provide a user-
friendly and convenient environment. We know that it is not compulsory to use the Operating System,
but things become harder when the user has to perform all the process scheduling and converting the
user code into machine code is also very difficult. So, we make the use of an Operating System to act as
an intermediate between us and the hardware. All you need to do is give commands to the Operating
System and the Operating System will do the rest for you. So, the Operating System should be
convenient to use.
* Secondary Goal-Efficient use of a Computer System: The secondary goal of an Operating System
is efficiency. The Operating System should perform all the management of resources in such a way that
the resources are fully utilized and no resource should be held idle if some request to that resource is
there at that instant of time.
Operating System as resource manager:- A computer system has many resources
(hardware and software), which may be require to complete a task. The commonly required resources
are input/output devices, memory, file storage space, CPU etc. The operating system acts as a manager
of the above resources and allocates them to specific programs and users, whenever necessary to
perform a particular task. Therefore operating system is the resource manager i.e. it can manage the
resource of a computer system internally. The resources are processor, memory, files, and I/O
devices. In simple terms, an operating system is the interface between the user and the machine.
Operating system is like a government; In a next manner, the operating system is like a
government , the government collects the money from various services (Public, companies, Taxes etc)
and distribute the money to different development activities.
Same as the OS collects the resources from the network environment as to a system, and grant
the resources to requesting jobs.
A computer has many resources (Hardware and Software), which may be required to complete a
task. The commonly required resources are Input/Output devices, Memory file storage space,
CPU(Central Processing Unit) time and so on.
The operating system acts as the manager of these resources and allocates them to specific
programs and users as necessary for their tasks. Therefore we can say an operating system is a resource
allocator. This is the main features of an operating system.
When a number of computers connected through a network more than one computers trying for a
computer print or a common resource, then the operating system follow same order and manage the
resources in an efficient manner.
Generally, resources sharing in two ways "in time" and "in space". When a resource is a time-
sharing resource, first one of the tasks get the resource for some time, then another and so on.
For example, a CPU in the time-sharing system. In the time-sharing system, OS fixes the time
slot for the CPU. First one of the processes gets the CPU, when the time slot expires, the CPU switch to
the next process in the ready queue. In this example, the CPU is a time resource. CPU Scheduling in
Operating System
The other kind of sharing is the "space sharing". In this method, the users share the space of
resource. For example, the main memory consisting of several processes at a time, so the process of
sharing the resources.
The main difference between "in time" sharing resources and "in space" sharing resources is "in
time" resources are not divided into units, whereas "in space" sharing resources are divided into units.
Operating System as an Abstract machine:-
Extends the basic hardware with added functionality Provides high-level abstractions:
• More programmer friendly
• Common core for all applications
– E.g. File system instead of just registers on a disk controller
It hides the details of the hardware
• Makes application code portable