3.2.1 Introduction to Operating System
An operating system (OS)
is a large collection of system software, which manages the resources of
computer systems such as memory, storage, processor, I/O devices- alongside acting
as an interface between machine and user. Moreover, it also performs the basic
tasks such as reorganization of peripheral devices, sending- receiving
information to the external sources keeping tasks of files, folders on the disk
and other different utility tasks.
On the other hand, the OS
also acts as an interface between the hardware and the users. It is designed to
handle the basic elements of computer operation such as sending instructions to
hardware devices such as disk drives and computer screens with the help of the
interface provided by the OS. Therefore, the OS understands both the languages:
human language that is high level language and the language of machine that is
machine language. It also allocates system resources such as memory to different
software applications being run. Therefore, it becomes the interpreter between
the computer hardware and the user. For example, suppose we have to save any
message or information to any storage device, then our duty is simply to give
command to the OS. Then, we don't know "how to write" or "where
to write" inside the storage device. now it's the job of the OS to tell
storage devices what to do exactly.
Examples of popular
modern operating systems are Linux, Mac OS, Microsoft Windows and UNIX
etc.
The organization or
architecture of the OS deal with the internal structure of OS, mainly it is
divided into 3 layers as shown in figure below:
Application Software
|
Figure: Architecture of operating system
OS Kernel: A main part of the OS always remains in the main memory
during the running of a computer, called OS kernel. It is the main controlling
part of the OS which controls all the running programs and the hardware
resources. It can directly communicate with the hardware as well as the upper
layers.
Utility Software:
Outside this layer, there is a set of utility programs which are used as system
management tools, also known as housekeeping works of the OS. The main purpose
of these tools is to make the system up to date and efficient. For example,
take the way, scan-disk ,disk-cleanup, disk defragmenter, device drivers, file
compression, backup-recovery, antivirus, web browser and other different
network and internet utilities work.
OS Application:
Application software is developed in order to fulfil the user requirements.
Different application software is available in the market as readymade
software. Some of them are developed on the user's demand called tailored
software. Basic application software is also provided by the OS such as
Notepad, WordPad, Paint and Simple Games etc.
3.2.2 Role of Operating
System
The OS software must keep
track of each hardware resource, determine who gets what, determine when the
user will have access to the resource, allocate how much of the resource the
user will be given, and terminate access at the end of the use period.
The primary purpose of an
OS is to maximize the productivity of a computer system by operating it in the
most efficient manner and minimizing the amount of human intervention required.
Some of the roles of OS are as follows:
·
It acts as an intermediary between the programs
and the computer hardware.
·
Operating system loads programs in the memory
when the power is turned on.
·
It performs basic operations that recognize the
input from the keyboard and after processing, sending the output to the display
screen.
·
It manages data, tracks of files and memory such
as primary, secondary etc.
·
It manages scheduling processes and provides the
tasks to different peripheral devices.
·
Operating system also allows the users to share
the data and software among themselves.
·
It prevents the system from unauthorized users,
hackers, crackers, computer viruses etc.
3.2.3 Functions of an
Operating System (Important Questions)
The functions of
operating systems are:
·
Input/Output (I/O) management : OS
manages the input and output of a computer. This applies to the flow of data
among the computers, terminals and other devices such as monitors, printers
etc. Application programs use the operating system extensively to handle the
input and output devices as needed.
·
Command interpreter : The command
interpreter takes a command from the user and then the OS translates it into a
detailed meaningful instruction, which the computer can understand easily. For
this reason, the main function of command interpreters is to get and execute
the user specified command. In the MS-DOS, command.com is a command
interpreter.
·
Data management : The OS also manages the
storage and retrieval of the data. As the system software handles many of the
details associated with the process, such details are not primary concerns for
users or programmers writing application programs.
·
File management : File management creates
a mechanism of files and directories by making a table of each file and
directories in the storage device, so as to keep track of each element. Then,
it implements different types of efficient searching mechanism of files.
Therefore, this module is responsible for handling the way the data is stored
and retrieved for use in the computer.
The
operating system such as windows manages the disk with FAT, FAT 32 or NTFS file
systems. FAT is the short form of File allocation table. The FAT has the
information about the filename, file size, date and time creation and
allocation on the disk spaces. NTFS stands for New Technology File System. It
has several improvements over FAT, and supports the use of advanced data
structures to improve the performance, reliability, and disk space utilization,
plus additional extensions, such as security.
·
Memory management : Computer systems
include a number of storage devices, say, for example, registers, cache memory,
primary memory, secondary memory etc. Wherever, the processor needs some data
or instructions, it is first searched in the registers and then after the cache
memory; if it isn't available there, then, it looks into the primary memory
(RAM). If still not available, then the data is brought into the main memory
from the hard disk. Thus, the way of loading, accessing and removing the data
from these devices are managed by the operating system.
·
Job management: It recognizes the jobs,
identifies their priorities, determines whether the appropriate main memory and
the secondary memory capability they require are available or not. Then, the
operating system schedules the job and finally runs each job at the appropriate
format with scheduling.
The
technique of maximum utilization of the processor is termed as CPU scheduling.
In this system, several jobs are kept in the memory at one time. When one job
has to wait, the OS takes the CPU away from the job and gives it to another
job. This method continues. Every time one job has to wait, another job may
take over the use of the CPU. Some scheduling algorithms are First come First
Serve, Shortest Job First, Priority scheduling, Round Robin scheduling
etc.
·
Process management : A process is a
program, which is currently in a ready/ running / blocked state (that is
currently loaded in the main memory). There can be only one program, but there
may be multiple processes of the same program. For example, there is only one
program of MS Word on the hard disk, but we can open two different MS Word
documents (processes) at a single time.
When
multiple processes are running, some processes may demand the input/output
devices. In such a case, the process goes to the blocked state until the device
is available. When the concurrent processes are under execution, the CPU time
can be given to a single process at a time. The process which gets the CPU time
is in the running state. The process which is waiting for CPU time is in the
ready state.
One of
the major tasks of an OS module is to manage and schedule the task effectively,
which is performed by the processor. Therefore, the main activities of the
process management are job queuing, job scheduling, keeping track of the status
of each process etc.
·
User interface : An interface is a set of
commands or menus through which a user communicates with a program. A
command-driven interface is the one in which you enter commands whenever, by
using menu-driven, you can select commands from various menus displayed on the
screen. Therefore, it determines how easily you can make the program what you
want. Generally, there are two types of user interfaces: GUI (Graphical User
Interface) and CUI (Command User Interface), which will discuss later in this
chapter.
·
Interrupt-handling : Interrupt is an
event that alters the sequence in which the processor executes instructions.
The OS
provides a feature “interrupter handler” which are the routines that are called
when an interrupt is detected.
Types
of Interrupt:
·
Internal interrupts : Internal interrupts
arise from the illegal use of an instruction or data.
·
External interrupts arise from the I/O
devices, timing device, circuit generated by power supply.
Hardware
interrupts: Many pieces of hardware send interrupt signals to the CPU. When
the CPU notices that signal, it does a hardware interrupt. It is caused by
hardware devices such as keyboard, printer, chips etc.
Software
interrupts: A software interrupt is generated by the processor executing a
specific instruction. It is caused by programs or software devices such as ROM
BIOS.
·
Deadlock prevention : Sometimes, during a
process, a situation arises in which the resource either hardware or software,
shared by two or more processes (for example, printer) cannot continue because
the resource required by a process is held by another resource. In this
situation, both jobs are conflict by the resources. And, such a type of
situation or condition is called a deadlock.
“In an operating
system, a deadlock is a situation which occurs when a process enters a waiting
state because a resource requested by it is being held by another waiting
process which in turn is waiting for another resource.”
For
example, if program “A” captures the hard disk and asks for the printer to
print, and the program “B” captures the printer and asks for the hard disk to
write, then such condition creates a deadlock. Such conditions are posed by the
OS. For that, it takes a suitable action by careful allocation of
resources.
·
Security management : One of the major
tasks of an OS is to secure the data and program while loaded into the memory.
An operating system protects the resources and information of a computer
against destruction and unauthorized access. It protects the hardware and
software from improper use. Some operating systems provide various methods such
as backup, password, scandisk etc. for security.
·
Virtual storage management : As we know,
in multiprogramming, more than one job is loaded in main memory at a time. But,
if the program is larger than the main memory (RAM), then the entire job cannot
be loaded at once inside the memory. In this case, the OS uses the free space
of the secondary memory, which is known as virtual memory.
With this
software, it is possible to increase the capacity of the main memory without
actually increasing its size. This is accomplished by breaking a job into
sequences of instructions, called pages or segments, of RAM and keeping only a
few of this in memory at a time. Then, the remainder memory is kept on the
secondary storage devices.
For
virtual storage management, the following techniques are used:
·
Paging : As the entire job cannot be
loaded at once inside the memory due to the large size of the programs, the OS
follows a different strategy to manage such problems. The most widely used
mechanism is paging. In paging, the primary memory is partitioned into fixed
size called page frame and the job so partitioned into the same size is called
page. Instead of loading the entire job at once, few pages are loaded into the
page-frame of the memory.
·
Swapping: Swapping is a memory management
technique. If the memory is not enough to hold the entire program and data,
swapping is needed to provide the memory to all the programs on the basis
of priority. In this technique, the high priority process is swapped in the
main memory and the low priority process from the main memory is swapped out.
When the high priority process is completed, the low priority process swaps again.
3.2.4 Operating System
Terminology
Multiprogramming:
Multiprogramming allows execution of two or more programs in a main memory of
the computer. In this environment, the processor processes several programs
simultaneously.
“Maximum utilization of
CPU keeping it busy is called Multiprogramming or Concurrent Programming.”
All the programs are kept
in the job pool of the mass storage device and these programs are ready for
processing but the CPU is busy, so these programs wait their turns. When one
processing is completed, the next ready program is fetched from the main memory
for processing. Different forms of multiprogramming OS are multitasking,
multiprocessing, multi-user.
Multitasking:
A system able to process a number of tasks (programs) at a time is called
multitasking. It allows more than one program to run concurrently.
In multitasking, only one
CPU is involved, but it switches from one program to another so quickly that it
gives the appearance of executing all of the programs at the same time. In this
system, more than one task is performed on the priority basis, a high priority
task interrupts a low priority task. There are two basic types of multitasking.
Pre-emptive
Non-Preemptive
In Pre-emptive
multitasking, the OS allows the CPU time slices to each program. OS/2, Windows
95, Windows NT and UNIX use pre-emptive multitasking. Reversely, in
non-pre-emptive multitasking, each program can control the CPU for as long as
it needs. It a program is not using the CPU, however, it can allow another
program use it temporarily. It is also called cooperative multitasking.
Microsoft Window 3.x and MultiFinder (for Macintosh computers) use cooperative
multitasking.
Multiprocessing:
The CPU of any computer is called a processor. Multiprocessing operating system
is one which runs on the computer having more than one processor and all these
processors share some or all of the same memory. Such OS simultaneously
executes two or more jobs at a single time.
Multiprocessing systems
are much more complicated than single-process systems, because the OS must
allocate resources to competing processes in a reasonable manner. This is also
called parallel processing. MVS (Multiple Virtual System/ Storage) and UNIX are
two most commonly used multiprocessing operating systems.
Network and Distributed
System: Network operating system is used when a number of
computers are connected in a network. It works under client/server principle.
The server provides services such as mail, database, printing etc. and client
computer take services provided by the server. In a network operating system,
the users are aware of existence of multiple computers. Each machine runs its
own local users. They are useful for communication between users, sharing
resources and for backup and recovery.
A distributed operating
system manages a group of independent computers and makes them appear to be a
single computer. The processor in a distributed system may be varying in size
and function. They may include small microprocessors, workstations,
minicomputers and large general purpose computer systems. For example, computer
A can run a program on a computer B, using a file located elsewhere on the
network, without the user being aware of where execution is taking place or
where the files are physically located.
No comments:
Post a Comment