Professional Documents
Culture Documents
UNIT-1 Full
UNIT-1 Full
21CST404
REFERENCE BOOKS:
1. D.M Dhamdhere: Operating systems - A concept-based Approach, 3rd Edition, Tata McGraw- Hill, 2012.
ISBN13: 9781259005589
2. P.C.P. Bhatt: Introduction to Operating Systems Concepts and Practice, 3rd Edition, PHI, 2010. ISBN-10:
9788120348363
3. Harvey M Deital: Operating systems, 3rd Edition, Pearson Education, 2011. ISBN: 9788131712894
•Convenience – An operating system improves the use of a machine. Operating systems enable users to get
started on the things they wish to complete quickly without having to cope with the stress of first configuring
the system.
It hides the difficulty in managing the hardware.
•Efficiency – An operating system enables the efficient use of resources. This is due to less time spent
configuring the system.
The management of resources and programs should be done so that no resource is kept idle and
memory is used for no use.
•Ability to evolve – An operating system should be designed in such a way that it allows for the effective
development, testing, and introduction of new features without interfering with service.
This makes the operating system more reliable.
•Management of system resources – It guarantees that resources are shared fairly among various
processes and users.
It is a resource allocator
• Security-An operating system provides the safety and security of data between the user and the hardware.
OS enables multiple users to securely share a computer(system), including files, processes, memory, and
device separately.
VINUTHA M S,DEPT OF CSE,Dr AIT 7
It keeps the system and applications safe through authorization
What are the functions of Operating System?
• Security – For security, modern operating systems employ a firewall. A firewall is a type of security system that monitors all
computer activity and blocks it if it detects a threat.
• Job Accounting – As the operating system keeps track of all the functions of a computer system. Hence, it makes a record of
all the activities taking place on the system. It has an account of all the information about the memory, resources, errors,
etc. Therefore, this information can be used as and when required.
• Control over system performance – The operating system will collect consumption statistics for various resources and
monitor performance indicators such as reaction time, which is the time between requesting a service and receiving a
response from the system.
• Error detecting aids – While a computer system is running, a variety of errors might occur. Error detection guarantees that
data is delivered reliably across susceptible networks. The operating system continuously monitors the system to locate or
recognize problems and protects the system from them.
• Coordination between other software and users – The operating system (OS) allows hardware components to be
coordinated and directs and allocates assemblers, interpreters, compilers, and other software to different users of
the computer system.
• Booting process – The process of starting or restarting a computer is referred to as Booting. Cold booting occurs when a
computer is totally turned off and then turned back on. Warm booting occurs when the computer is restarted. The operating
system (OS) is incharge of booting the computer.
intermediate between System Hardware and End-User. Operating System handles the following responsibilities:
Operating systems are everywhere, from cars and home appliances that include “Internet of Things” devices, to smart
phones, personal computers, enterprise computers, and cloud computing environments.
• Control Program –
The OS is a control program and manage the execution of user program to prevent errors and improper use of the
computer.
Organization of a computer system defines the way system is structured and how features are implemented. The significant
components of Computer organization are ALU, CPU, memory and memory organization.
An organization is done on the basis of architecture. Computer Organization deals with low-level design issues. Organization
expresses the realization of architecture.
Software interrupt
• Computer programs must be in main memory (RAM) to be executed. Main memory is the large memory that the processor
can access directly. It commonly is implemented in a semiconductor technology called dynamic random-access memory
(DRAM). Computers provide Read Only Memory (ROM), whose data cannot be changed.
• All forms of memory provide an array of memory words. Each word has its own address. Interaction is achieved through a
sequence of load or store instructions to specific memory addresses.
• A typical instruction-execution cycle, as executed on a system with a Von Neumann architecture, first fetches an instruction
from memory and stores that instruction in the instruction register. The instruction is then decoded and may cause operands
to be fetched from memory and stored in some internal register. After the instruction on the operands has been executed,
the result may be stored back in memory.
• Ideally, we want the programs and data to reside in main memory permanently. This arrangement usually is not possible for
the following two reasons:
1.Main memory is usually too small to store all needed programs and data permanently.
2.Main memory is a volatile storage device that loses its contents when power is turned off.
1. The processor is executing a program and encounters an instruction relating to I/O operation.
2. The processor then executes that instruction by issuing a command to the appropriate I/O module.
3. The I/O module will perform the requested action based on the I/O command issued by the processor (READ/WRITE) and set the
appropriate bits in the I/O status register.
4. The processor will periodically check the status of the I/O module until it find that the operation is complete.
DMA Structure:
Direct Memory Access (DMA) is a method of handling I/O. Here the device controller directly communicates with memory
without CPU involvement. After setting the resources of I/O devices like buffers, pointers, and counters, the device controller
transfers blocks of data directly to storage without CPU intervention. DMA is generally used for high speed I/O devices. The data
transfer between a fast storage media such as magnetic disk and memory unit is limited by the speed of the CPU. Thus we can allow
the peripherals directly communicate with each other using the memory buses, removing the intervention of the CPU. The DMA
controller takes over the buses to manage the transfer directly between the I/O devices and the memory unit.
Master
sSS
Slave
Asymmetric multiprocessing
Symmetric multiprocessing Dual core Design
5) Blade servers : Are systems in which multiple processor boards, I/O boards, and networking boards are placed in the same
chassis. The difference between these and traditional multiprocessor systems is that each blade processor board boots
independently and runs its own operating system. Some blade-server boards are multiprocessor as well, which blurs the lines
between types of computers. In essence, these servers consist of multiple independent multiprocessor systems.
Description If a System contains only one processor for processing than If a System contains two or more than two processors for processing than it is
it is called single processor system. called multiprocessor
Use of Co- Yes, Single Processors uses multiple Controllers that are In Multi Processor Systems Two Types of approaches are Used:
Processors designed to handle special tasks and can execute limited 1) Symmetric Multiprocessing(SMP)
instruction sets. E.g. DMA Controller, North/South Bridge. 2) Asymmetric Multiprocessing
In Asymmetric Multiprocessing one Processor works as Master and Second
Processor act as Slave
And in Symmetric Multiprocessing each processor performs all the tasks within
the operating system.
Throughput Throughput of Single Processor Systems is less than Throughput of Multiprocessor systems is greater than single processor systems. If
Multiprocessor Systems Because each and every task is a System Contains N Processors then its throughput will be slightly less than N
performed by the same processor. because synchronization must be maintained between two processors and they
also share resource which increases certain amount of overhead.
Cost Economic Single Processor Systems cost more because each processor Multiprocessor Systems cost less than equivalent multiple single processor
requires separate resources.i.e. Mass Storage, Peripherals, systems because they uses same resources on sharing basis.
Power Supplies etc.
Design Process It is Easy to design Single Processor Systems. It is difficult to design Multi Processor Systems because Synchronization must be
maintained between processors otherwise it may result in overloading of one
processor and another processor may remain idle on the same time.
Reliability Less reliable because failure in one processor will result in More reliable because failure of one processor does not halt the entire system but
failure of entire system. only speed will be slow down.
In asymmetric multiprocessing, the processors are not treated In symmetric multiprocessing, all the processors are treated
1.
equally. equally.
2. Tasks of the operating system are done by master processor. Tasks of the operating system are done individual processor.
No Communication between Processors as they are controlled by All processors communicate with another processor by a shared
3.
the master processor. memory.
In asymmetric multiprocessing, process scheduling approach used In symmetric multiprocessing, the process is taken from the ready
4.
is master-slave. queue.
5. Asymmetric multiprocessing systems are cheaper. Symmetric multiprocessing systems are costlier.
6. Asymmetric multiprocessing systems are easier to design. Symmetric multiprocessing systems are complex to design.
7. All processors can exhibit different architecture. The architecture of each processor is the same.
It is simple as here the master processor has access to the data, It is complex as synchronization is required of the processors in
8.
etc. order to maintain the load balance.
10. It is suitable for homogeneous or heterogeneous cores. It is suitable for homogeneous cores.
VINUTHA M S,DEPT OF CSE,Dr AIT 37
Clustered Systems
Clustered systems are two or more individual systems connected together via a network and sharing software resources.
• Clustering provides high availability of resources and services. The service will continue even if one or more systems in the
cluster fail. High availability is generally obtained by storing a copy of files (s/w resources) in the system.
• All the systems of the clustered operating system have independent processing power and capacity i.e. they have their CPUs and
shared storage media. These systems work together with a shared storage media to complete all the tasks. The below diagram
illustrates the meaning of the clustered operating system.
• A cluster operating system is a combination of hardware and software clusters. The hardware clusters help in sharing high-
performance disks between all the computer systems or the nodes. Whereas the software cluster ensures and manages the
working of all the systems together. Each node in the cluster system contains the cluster software. This software keeps an eye on
the entire cluster system and ensures it works properly. If any of the nodes in the cluster system fails, then the rest of the nodes of
the system take control of their resources and try to restart.
The types of clustered operating systems can be divided into three types:
• Asymmetric Clustering Systems
• Symmetric Clustering Systems
• Parallel Cluster Systems.
A time-shared operating system allows many users to share the computer simultaneously. As the system switches rapidly from one user to the next, each
user is given the impression that the entire computer system is dedicated to his use only, even though it is being shared among many users.
Here also basically a context switch is occurring but it is occurring so fast that the user is able to interact with each program separately while it is running.
This way, the user is given the illusion that multiple processes/ tasks are executing simultaneously. But actually only one process/ task is executing at a
particular instant of time. In multitasking, time sharing is best manifested because each running process takes only a fair quantum of the CPU time.
The operating system sets the counter. Every time the clock ticks, the counter is decremented. When the counter reaches 0, an
interrupt occurs.
For instance, a 10-bit counter with a 1-millisecond clock allows interrupts at intervals from 1 millisecond to 1,024 milliseconds, in steps
of 1 millisecond. Before turning over control to the user, the operating system ensures that the timer is set to interrupt. If the timer
interrupts, control transfers automatically to the operating system, which may treat the interrupt as a fatal error or may give the
program more time. Clearly, instructions that modify the content of the timer are privileged. Thus, we can use the timer to prevent a
user program from running too long. A simple technique is to initialize a counter with the amount of time that a program is allowed to
run. A program with a 7-minute time limit, for example, would have its counter initialized to 420.
Every second, the timer interrupts and the counter is decremented by 1. As long as the counter is positive, control is returned to the
user program. When the counter becomes negative, the operating system terminates the program for exceeding the assigned time limit.
• Scalability: It increases the scale of the system as a number of Disadvantages of Distributed System:
processors communicate with more users by accommodating to • Relevant Software for Distributed systems does not exist currently.
improve the responsiveness of the system. • Security possess a problem due to easy access to data as the resources
are shared to multiple systems.
• Fault tolerance: It cares about the reliability of the system if there is • Networking Saturation may cause a hurdle in data transfer i.e., if there
a failure in Hardware or Software, the system continues to operate is a lag in the network then the user will face a problem accessing data.
properly without degrading the performance the system. • In comparison to a single user system, the database associated with
distributed systems is much more complex and challenging to
• Transparency: It hides the complexity of the Distributed Systems to manage.
the Users and Application programs as there should be privacy in • If every node in a distributed system tries to send data at once, the
every system. network may become overloaded.
Windows was the host operating system, and the VMware application was
the virtual machine manager (VMM). The VMM runs the guest operating
systems, manages their resource use, and protects each guest from the
others. Even though modern operating systems are fully capable of running
multiple applications reliably, the use of virtualization continues to grow.
On laptops and desktops, a VMM allows the user to install multiple operating
systems for exploration or to run applications written for operating systems
other than the native host. For example, an Apple laptop running macOS on
the x86 CPU can run a Windows 10 guest to allow execution of Windows
applications.
Companies writing software for multiple operating systems can use That application ran one or more guest copies of Windows or
virtualization to run all of those operating systems on a single physical server other native x86 operating systems, each running its own
for development, testing, and debugging. Within data centers, virtualization applications. Figure shows computer running (a) a single
operating system and (b) three virtual machines
has become a common method of executing and managing computing
environments.
VINUTHA M S,DEPT OF CSE,Dr AIT 60
OPERATING SYSTEM SERVICES
An operating system provides an environment for the execution of
programs. It provides certain services to programs and to the users of • Program Execution - The OS must be able to load a program into RAM, run
those programs the program, and terminate the program, either normally or abnormally
OS provide services for the users of the system, including: • I/O Operations - The OS is responsible for transferring data to and from I/O
• User Interfaces – Almost all operating systems have a user interface devices, including keyboards, terminals, printers, and files. For specific devices,
(UI). This interface can take several forms. special functions are provided (device drivers) by OS.
Most commonly, a graphical user interface (GUI) is used. • File-System Manipulation – Programs need to read and write files or
Here, the interface is a window system with a mouse that serves as a directories. The services required to create or delete files, search for a file, list
pointing device to direct I/O, choose from menus, and make selections the contents of a file and change the file permissions are provided by OS.
and a keyboard to enter text.
Mobile systems such as phones and tablets provide a
touch-screen interface, enabling users to slide their fingers across the
screen or press buttons on the screen to select choices.
Another option is a command-line interface (CLI), which
uses text commands and a method for entering them (say, a keyboard
for typing in commands in a specific format with specific options. In this
commands are given to the system.
Each time you type a command, a program called a ``shell'' accepts
and interprets what you have typed, and sends your command on to
be performed by the operating system. There are four shells available
the ``C'' shell (csh), the ``TC'' shell (tcsh), the ``Bourne'' shell (sh, the
original UNIX shell) and the ``Korn'' shell (ksh). The TC-shell is like the C-
shell (so called because its syntax is similar to the ``C'' language)
A view of operating system services
VINUTHA M S,DEPT OF CSE,Dr AIT 1
OS provide services for the efficient operation of the system,
• Communications - Inter-process communications, IPC, either including:
between processes running on the same processor, or
between processes running on separate processors or
• Resource Allocation – Resources like CPU cycles,
separate machines. May be implemented by using the main memory, storage space, and I/O devices must be
service of OS- like shared memory or message passing. allocated to multiple users and multiple jobs at the
same time.
• Error Detection - Both hardware and software errors must
be detected and handled appropriately by the OS. • Accounting/Logging – There are services in OS to
keep track of system activity and resource usage,
either for billing purposes or for statistical record
Errors may occur in the CPU and memory hardware (such keeping that can be used to optimize future
as power failure and memory error), in I/O devices (such performance.
as a parity error on tape, a connection failure on a
network, or lack of paper in the printer), and in the user • Protection and Security – The owners of
program (such as an arithmetic overflow, an attempt to information (file) in multiuser or networked computer
access an illegal memory location). system may want to control the use of that
information.
When several separate processes execute
concurrently, one process should not interfere with
other or with OS.
Protection involves ensuring that all access to system
resources is controlled. Security of the system from
outsiders must also be done, by means of a password.
• The first problem in designing a system is to define goals and • Beyond this highest design level, the requirements may be much
specifications. Design goals are the objectives of the operating harder to specify. The requirements can, however, be divided into
system. They must be met to fulfill design requirements and they two basic groups
can be used to evaluate the design. 1. User goals (User requirements)
2. System goals (system requirements)
• These goals may not always be technical, but they often have
• User requirements are the features that user care about and
a direct impact on how users perceive their experience with
understand like system should be convenient to use, easy to learn,
an operating system.
reliable, safe and fast.
• While designers need to identify all design goals and prioritize
• System requirements are written for the developers, ie. People
them, they also need to ensure that these goals are who design the OS. Their requirements are like easy to design,
compatible with each other as well as compatible with user implement and maintain, flexible, reliable, error free and efficient.
expectations or expert advice
• At the highest level, the design of the system will be affected • The process of identifying design goals, conflicts, and priorities
by the choice of hardware and the type of system: batch, is often referred to as “goal-driven design.” The goal of this
time shared, single user, multiuser, distributed, real time, or approach is to ensure that each design decision is made with
the best interest of users and other stakeholders in mind.
general purpose.
• Policies determine what is to be done. Mechanisms determine how • If properly separated and implemented, policy changes can be
it is to be implemented. easily adjusted without rewriting the code, just by adjusting
Example: parameters or possibly loading new data / configuration files.
In timer- counter and decrementing counter is the mechanism
and deciding how long the time has to be set is the policies. • Separation of policy and mechanism is a design principle to achieve
flexibility. In other words, adopting a certain mechanism should not
Granting a resource to a process using first come first serve restrict existing policies. The idea behind this concept is to have the
least amount of implementation changes if we decide to change the
algorithm (policy). This policy can be implemented using a
way a particular feature is used.
queue (mechanism).
• The lowest levels of the kernel might be written in assembly • The only disadvantages of implementing an operating system in a
language and C. Higher-level routines might be written in C and higher-level language are reduced speed and increased storage
C++, and system libraries might be written in C++ or even higher- requirements.
level languages .
• major performance improvements in operating systems are more
• Android provides a nice example: its kernel is written mostly in C likely to be the result of better data structures and algorithms
with some assembly language. Most Android system libraries are than of excellent assembly-language code.
written in C or C++, and its application frameworks—which
provide the developer interface to the system—are written • In addition, although operating systems are large, only a small
mostly in Java amount of the code is critical to high performance; the interrupt
handlers, I/O manager, memory manager, and CPU scheduler are
probably the most critical routines.
Disadvantages
1. In a microkernel system, providing services are more costly than in a traditional monolithic system.
2. The performance of a microkernel system might be indifferent and cause issues.
• Modules are similar to layers in that each subsystem has clearly defined tasks and
interfaces, but any module is free to contact any other module, eliminating the
problems of going through multiple intermediary layers.
• The kernel is relatively small in this architecture, similar to microkernels, but the
kernel does not have to implement message passing since modules are free to
contact each other directly. Eg: Solaris, Linux and MacOSX.
• The MacOSX architecture relies on the Mach microkernel for basic system
management services, and the BSD kernel for additional services. Application The overall result resembles a layered system in that each kernel
services and dynamically loadable modules (kernel extensions ) provide the rest of section has defined, protected interfaces; but it is more flexible
the OS functionality. than a layered system, because any module can call any other
module.
The approach is also similar to 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.
VINUTHA M S,DEPT OF CSE,Dr AIT 16
Hybrid Systems
• In practice, very few operating systems adopt a single, strictly • Below these layers is the kernel environment, which consists
defined structure. Instead, they combine different structures, primarily of the Mach microkernel and the BSD UNIX kernel.
resulting in hybrid systems that address performance, security,
and usability issues. • Mach provides memory management; support for remote
procedure calls (RPCs) and interprocess communication (IPC)
• For example, both Linux and Solaris are monolithic, because facilities, including message passing; and thread scheduling.
having the operating system in a single address space provides
very efficient performance. • The BSD component provides a BSD command-line interface,
support for networking and file systems, and an
• However, they are also modular, so that new functionality can implementation of POSIX APIs, including Pthreads.
be dynamically added to the kernel.
• In addition to Mach and BSD, the kernel environment provides
• Windows is largely monolithic as well (again primarily for an I/O kit for development of device drivers and dynamically
performance reasons), but it retains some behavior typical of loadable modules (which Mac OS X refers to as kernel
microkernel systems, including providing support for separate extensions
subsystems (known as operating-system personalities) that run
as user-mode processes. Windows systems also provide
support for dynamically loadable kernel modules.
• MacOSX :The Apple MacOSX operating system uses a hybrid
structure. As shown in Figure, it is a layered system and
consists microkernel. The top layers include the Aqua user
interface and a set of application environments and services.
Notably, the Cocoa environment specifies an API for the
Objective-C programming language, which is used for writing
MacOSX applications.