Operatig System
Operatig System
Operatig System
Syllabus:
We need a system which can act as an intermediary and manage all the processes
and resources present in the system.
Operating System:
• Every computer system must have at least one operating system to run other
programs. Applications like Browsers, MS Office, Notepad Games, etc.,
need some environment to run and perform its tasks.
• The OS helps you to communicate with the computer without knowing how
to speak the computer's language.
• It is not possible for the user to use any computer or mobile device without
having an operating system.
• Processor management: it involves putting the tasks into order and pairing
them into manageable size before they go to the CPU.
After creating the jobs, hand it over to the computer operator; then the operator
sort or creates the similar types of batches like B2, B3, and B4. Now, the
computer operator submits batches into the CPU to execute the jobs one by one.
After that, CPUs start executing jobs, and when all jobs are finished, the
computer operator provides the output to the user.
1. Starvation
Batch processing suffers from starvation. If there are five jobs J1, J2, J3, J4, J4 and
J5 present in the batch. If the execution time of J1 is very high then other four jobs
will never be going to get executed or they will have to wait for a very high time.
Hence the other processes get starved.
2. Not Interactive
Batch Processing is not suitable for the jobs which are dependent on the user's
input. If a job requires the input of two numbers from the console then it will never
be going to get it in the batch processing scenario since the user is not present at
the time of execution.
Due to the CPU's underutilization and the waiting for I/O resource till that CPU
remains idle. It shows the improper use of system resources. Hence, the
operating system introduces a new concept that is known as
multiprogramming.
The operating system loads a set of jobs from job pool into main memory and
begins to execute.During execution, the job may have to wait for some task,
such as an I/O operation, to complete.
It is the type of operating system that allows us to connect many people located at
different locations to share and use a specific system at a single time.
Furthermore, it provides each user his terminal for input or output that impacts the
program or processor currently running on the system.
It represents the CPU's time is shared between many user processes. Or, the
processor's time that is shared between multiple users simultaneously termed as
time-sharing.
Since each action in this system is short, only a little CPU time is needed for each
user. The system switches rapidly from one user to the next so each user feels as
if the entire computer system is dedicated to his use, even though it is being shared
by many users.
CPU time is divided among all the users on scheduled basis. Short period of time
during that a user gets attention of the CPU; is known as a time slice or a quantum.
For example, real-life situations governing an automatic car, traffic signal, nuclear
reactor or an aircraft require an immediate response to complete tasks within a
specified time delay. Hence, a real-time operating system must be fast and
responsive for an embedded system, weapon system, robots, scientific research &
experiments and various real-time objects.
These types of OS are used with those required to complete critical tasks within the
defined time limit. If the response time is high, it is not accepted by the system or
may face serious issues like a system failure. In a hard real-time system, the
secondary storage is either limited or missing, so these system stored data in the
ROM.
A soft real-time system is a less restrictive system that can accept software and
hardware resources delays by the operating system. In a soft real-time system, a
critical task prioritizes less important tasks, and that priority retains active until
completion of the task. Also, a time limit is set for a specific job, which enables
short time delays for further tasks that are acceptable. For example, computer audio
or video, virtual reality, reservation system, projects like undersea, etc.
Each node contains specific software that communicates with the global aggregate
operating system. With the ease of a distributed system, the programmer or
developer can easily access any operating system and resource to execute the
computational tasks and achieve a common goal.
One user can access the files or software which are not actually present on his
system but some other system connected within this network.i.e., remote access is
enabled within the devices connected in that network.
Multiple central processors are used by Distributed systems to serve multiple real-
time applications and multiple users. Jobs are distributed among the processors.
Example: LOCUS, Windows server 2003, Windows server 2008, Windows server
2012, Ubuntu.
The Embedded operating system is the specific purpose operating system used in
the computer system's embedded hardware configuration. These operating systems
are designed to work on dedicated devices like automated teller machines (ATMs),
airplane systems, digital home assistants, and the internet of things (IoT) devices.
The components of a cluster are usually connected to each other through fast local
area network. “Load balancing" clusters are configurations in which cluster-nodes
share computational workload to provide better overall performance.
For example, a web server cluster may assign different queries to different nodes,
so the overall response time will be optimized.
Cluster system has several nodes, and they contain individual cluster software.
This software helps to monitor entire cluster system. When, any one node of
cluster system gets halt, then other nodes manage of its storage system as well as
resources, and then you can try to restart this system.
An Operating System provides services to both the users and to the programs.
• Process management
• Error handling
• Resource management
• Communication
• Accounting
• Protection and security
• Interface
• Program execution
Process management:
A program does nothing unless their instructions are executed by a CPU.A process
is a program in execution. A time shared user program such as a complier is a
process. A word processing program being run by an individual user on a pc is a
process. A system task such as sending output to a printer is also a process. A
process needs certain resources including CPU time, memory files & I/O devices
to accomplish its task. These resources are either given to the process when it is
created or allocated to it while it is running.
Error Handling:
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O
devices or in the memory hardware. Following are the major activities of an
operating system with respect to error handling −
Resource management:
If a computer system has multi users & allow the concurrent execution of multiple
processes then the various processes must be protected from one another’s
activities. For that purpose, mechanisms ensure that files, memory segments, CPU
& other resources can be operated on by only those processes that have gained
proper authorization from the OS.
Protection involves ensuring that all access to system resources is controlled.
Security of the system from outsiders requires user authentication, extends to
defending external I/O devices from invalid access attempts.
Communications:
Accounting:
Accounting means to keep track of which users use how much and what kinds of
computer resources.
This service of the operating system keeps track of which users are using how
much and what kinds of computer resources have been used for accounting or
simply to accumulate usage statistics.
User Interface:
Usually Operating system comes in two forms or types. Depending on the interface
their types have been further subdivided. These are:
• Command line interface
• Graphical User Interface
The command line interface (CLI) usually deals with using text commands and a
technique for entering those commands. Another type is the graphical user
interface (GUI): which is a window system with a pointing device (like mouse or
trackball) to point to the I/O, choose from menus driven interface and to make
choices viewing from a number of lists and a keyboard to entry the texts.
Program execution:
The operating system must have the capability to load a program into memory and
execute that program. Furthermore, the program must be able to end its execution,
either normally or abnormally / forcefully.
Operating system loads a program into memory, Executes the program, Handles
program's execution, Provides a mechanism for process synchronization.(resource
conflict),Provides a mechanism for process communication. Provides a mechanism
for deadlock handling.
System Calls:
System calls provide the interface between a process & the OS. These are usually
available in the form of assembly language instruction. Some systems allow
system calls to be made directly from a high level language program like C, BCPL
and PERL etc. systems calls occur in different ways depending on the computer in
use.
System calls are entry point to access operating system services.
In general, system calls are required in the following situations −
• If a file system requires the creation or deletion of files. Reading and
writing from files also require a system call.
• Creation and management of new processes.
• Network connections also require system calls. This includes sending and
receiving packets.
• Access to a hardware devices such as a printer, scanner etc. requires a
system call.
As can be seen from this diagram, the processes execute normally in the user mode
until a system call interrupts this. Then the system call is executed on a priority
basis in the kernel mode. After the execution of the system call, the control returns
to the user mode and execution of user processes can be resumed.
There are mainly five types of system calls. These are explained in detail as follows −
Process Control
These system calls deal with processes such as process creation, process termination etc.
File Management
These system calls are responsible for file manipulation such as creating a file, reading a file,
writing into a file etc.
• Create a file
• Delete file
• Open and close file
Device Management
These system calls are responsible for device manipulation such as reading from device buffers,
writing into device buffers etc.
Information Maintenance
These system calls handle information and its transfer between the operating system and the user
program.
Communication
These system calls are useful for interprocess communication. They also deal with creating and
deleting a communication connection.
System Programs:
System programs provide a convenient environment for program development & execution.
Mostly user’s view of operating system is defined by system programs not by actual system call.
Some system program simply provides user interface to system calls, others are considerably
more complex.
1. Programming-Language support:
Compilers, assemblers, debuggers and interpreters for common programming languages (such as
C, C++, Java, Visual Basic, and PERL) are often provided to the user with the operating system.
2. Status Information:
Some programs simply ask the system for the date, time, and amount of available memory or
disk space, number of users. Status information system program provides information regarding
users and system.
3. File management:
File is the location to store data. user can store data permanently on to storage by using file.
These programs create, delete, copy, rename, print, serach,share files and directories.
Several text editors may be available to create and modify the content of files stored on disk or
other storage devices.
Once a program is compiled, it must be loaded into memory to be executed. The system may
provide absolute loaders, relocatable loaders, and overlay loaders.
A loader is part of an operating system that is responsible for loading programs and libraries.
6. Communications:
These programs provide the mechanism for creating virtual connections among processes users
and different computer systems.
Virtual connections among processes, users and computer systems are provided by
communication system programs.
User can send messages to other user on their screen; User can send e-mail, browsing on web
pages, remote login, and transformation of files from one user to another.
Simple Structure:
Many commercial systems do not have well-defined structures. Frequently, such operating
systems started as small, simple, and limited systems and then grew beyond their original scope.
MS-DOS is an example of such a system.
It was written to provide the most functionality in the least space, so it was not divided into
modules carefully. In MS-DOS, the interfaces and levels of functionality are not well separated.
For instance, application programs are able to access the basic I/O routines to write directly to
the display and disk drives. Such freedom leaves MS-DOS vulnerable to errant (or malicious)
programs, causing entire system crashes when user programs fail.
Monolithic Structure:
It consists of two separable parts: the kernel and the system programs. The kernel is further
separated into a series of interfaces and device drivers, which have been added and expanded
over the years as UNIX has evolved.
Layered Structure:
Layered approach, in which the operating system is broken up into a number of layers (levels).
The bottom layer (layer 0) is the hardware; the highest (layer N) is the user interface.
This approach simplifies debugging and system verification. The first layer can be debugged
without any concern for the rest of the system, because, by definition, it uses only the basic
hardware (which is assumed correct) to implement its functions. Once the first layer is debugged,
its correct functioning can be assumed while the second layer is debugged, and so on. If an error
is found during the debugging of a particular layer, the error must be on that layer, because the
layers below it are already debugged.
Thus, the design and implementation of the system is simplified. Each layer is implemented
with only those operations provided by lower level layers. A layer does not need to know how
these operations are implemented; it needs to know only what these operations do. Hence, each
layer hides the existence of certain data structures, operations, and hardware from higher-level
layers.
The major difficulty with the layered approach involves appropriately defining the various
layers.
Microkernel:
Modules:
Implemented dynamically. The overall result resembles a layered system in that each kernel
section has defined, protected interfaces; but it is more flexible than a layered system in that any
module can call any other module. The approach is like the microkernel approach in that the
primary module has only core functions and knowledge of how to load and communicate with
other modules; but it is more efficient, because modules do not need to invoke message passing
in order to communicate.
Virtual Machines:
By using CPU scheduling & virtual memory techniques an operating system can create the
illusion of multiple processes, each executing on its own processors & own virtual memory.
Each processor is provided a virtual copy of the underlying computer.
The resources of the computer are shared to create the virtual machines. CPU scheduling can be
used to create the appearance that users have their own processor.
Virtual Machine abstracts the hardware of our personal computer such as CPU, disk drives,
memory, NIC (Network Interface Card) etc, into many different execution environments
thereby creating the illusion that each separate execution environment is running its own private
computer.
Advantages:
• There are no protection problems because each virtual machine is completely isolated
from all other virtual machines.
• Virtual machine can provide an instruction set architecture that differs from real
computers.
• Easy maintenance, availability and convenient recovery.
Disadvantages:
• Virtual machines are not as efficient as a real one when accessing the hardware.
Implementation of Virtual Machine:
Just as physical machine has two modes
User mode
Kernel mode
Virtual Machine software will always runs in kernel mode.
Virtual machine itself will runs in user mode
Consequently there will have two virtual modes as like virtual user mode and virtual kernel
mode of physical user mode.
Virtual user mode
Virtual Kernel mode
Both of which run in a physical user mode.
These are −
User Goals
The operating system should be convenient, easy to use, reliable, safe and fast according to the
users. However, these specifications are not very useful as there is no set method to achieve these
goals.
System Goals
The operating system should be easy to design, implement and maintain. These are specifications
required by those who create, maintain and operate the operating system. But there is not specific
method to achieve these goals as well.
Operating System Mechanisms and Policies:
There is no specific way to design an operating system as it is a highly creative task. However,
there are general software principles that are applicable to all operating systems.
Difference between mechanism and policy is that mechanism shows how to do something and
policy shows what to do. Policies may change over time and this would lead to changes in
mechanism. So, it is better to have a general mechanism that would require few changes even
when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are required in
mechanism if policy changes.
If a policy favors I/O intensive processes over CPU intensive processes, then a policy change to
preference of CPU intensive processes will not change the mechanism.
System Generations:
Developer can design, code and implement an OS specifically for one machine. Or other choice
is to design OS to run on any of a class of machines with variety of peripheral configurations.
If operating system is general then it should be configured according to particular hardware and
software environment. The system must be configured or generated for each specific computer, a
process sometimes known as system generation (SYSGEN).
Once this information is determined, it can be used in several ways. It can be used by the system
administrator to modify a copy of the source code of the OS. OS is then completely compiled. It
is also possible to construct a system that is completely table driven. All the code is always part
of the system and selection occurs at execution time rather than compile time or link time.
System Boot:
Procedure of starting computer by loading the kernel in main memory is known as booting
system.
Hardware doesn’t know how to load kernel in memory, On most computer systems, a small
piece of code known as the bootstrap program or bootstrap loader, it locates the kernel and help
to load that kernel into main memory. Bootstrap loader program resides in ROM.
This program is in the form of read-only (ROM), because RAM is an unknown state at system
start up.ROM is convenient because it needs no initialization and can’t be affected by computer
virus.ROM-read only memory can’t be modified.ROM-Content never erased.
The bootstrap program can perform a variety of tasks. Usually, one task is to run diagnostics to
determine the state of the machine. If the diagnostics pass, the program can continue with the
booting steps. It can also initialize all aspects of the system, from CPU registers to device
controllers and the contents of main memory. Sooner or later, it starts the operating system.
Some systems—such as cellular phones, PDAs, and game consoles—store the entire operating
system in ROM.
Storing the operating system in ROM is suitable for small operating systems, simple supporting
hardware, and rugged operation. A problem with this approach is that changing the bootstrap
code requires changing the ROM hardware chips. Some systems resolve this problem by using
erasable programmable read-only memory (EPROM), which is read only except when explicitly
given a command to become writable. All forms of ROM are also known as firmware, since their
characteristics fall somewhere between those of hardware and those of software.
A problem with firmware in general is that executing code there is slower than executing code in
RAM. Some systems store the operating system in firmware and copy it to RAM for fast
execution. A final issue with firmware is that it is relatively expensive, so usually only small
amounts are available.