Chapter 1: Introduction: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edit9on
Chapter 1: Introduction: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edit9on
Chapter 1: Introduction: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edit9on
Operating System Concepts – 9th Edit9on Silberschatz, Galvin and Gagne ©2013
What is an Operating System?
Operating System Concepts – 9th Edition 1.2 Silberschatz, Galvin and Gagne ©2013
Computer System Structure
Computer system can be divided into four components:
Hardware – provides basic computing resources
CPU, memory, I/O devices
Operating system
Controls and coordinates use of hardware among various
applications and users
Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users
Word processors, compilers, web browsers, database
systems, video games
Users
People, machines, other computers
Operating System Concepts – 9th Edition 1.3 Silberschatz, Galvin and Gagne ©2013
Four Components of a Computer System
Operating System Concepts – 9th Edition 1.4 Silberschatz, Galvin and Gagne ©2013
What Operating Systems Do
Operating System Concepts – 9th Edition 1.5 Silberschatz, Galvin and Gagne ©2013
Operating System Definition
OS is a resource allocator
Manages all resources
Decides between conflicting requests for efficient and
fair resource use
OS is a control program
Controls execution of programs to prevent errors and
improper use of the computer
Operating System Concepts – 9th Edition 1.6 Silberschatz, Galvin and Gagne ©2013
Operating System Definition (Cont.)
Operating System Concepts – 9th Edition 1.7 Silberschatz, Galvin and Gagne ©2013
Computer Startup
Operating System Concepts – 9th Edition 1.8 Silberschatz, Galvin and Gagne ©2013
Instruction Cycle
Operating System Concepts – 9th Edition 1.9 Silberschatz, Galvin and Gagne ©2013
Instruction Cycle
Operating System Concepts – 9th Edition 1.10 Silberschatz, Galvin and Gagne ©2013
Instruction Cycle
Operating System Concepts – 9th Edition 1.11 Silberschatz, Galvin and Gagne ©2013
Instruction Cycle
Operating System Concepts – 9th Edition 1.12 Silberschatz, Galvin and Gagne ©2013
Interrupt
In system programming, an interrupt is a signal to the processor emitted
by hardware or software indicating an event that needs immediate
attention.
An interrupt alerts the processor to a high-priority condition requiring the
interruption of the current code the processor is executing.
The processor responds by suspending its current activities, saving its
state, and executing a function called an interrupt handler (or an interrupt
service routine, ISR) to deal with the event.
This interruption is temporary, and, after the interrupt handler finishes,
unless handling the interrupt has emitted a fatal error, the processor
resumes normal activities
Operating System Concepts – 9th Edition 1.13 Silberschatz, Galvin and Gagne ©2013
Types of Interrupt
Operating System Concepts – 9th Edition 1.14 Silberschatz, Galvin and Gagne ©2013
Types of Interrupt
Hardware Interrupts
When the signal for the processor is from an external device or hardware
then this interrupts is known as hardware interrupt.
Let us consider an example: when we press any key on our keyboard to
do some action, then this pressing of the key will generate an interrupt
signal for the processor to perform certain action. Such an interrupt can be
of two types:
Maskable Interrupt
The hardware interrupts which can be delayed when a much high priority
interrupt has occurred at the same time.
Non Maskable Interrupt
Operating System Concepts – 9th Edition 1.15 Silberschatz, Galvin and Gagne ©2013
Types of Interrupt
Software Interrupts
The interrupt that is caused by any internal system of the computer system
is known as a software interrupt. It can also be of two types:
Normal Interrupt
The interrupts that are caused by software instructions are called normal
software interrupts.
Exception
Unplanned interrupts which are produced during the execution of some
program are called exceptions, such as division by zero.
Operating System Concepts – 9th Edition 1.16 Silberschatz, Galvin and Gagne ©2013
Memory Hierarchy
Operating System Concepts – 9th Edition 1.17 Silberschatz, Galvin and Gagne ©2013
Memory Hierarchy
Operating System Concepts – 9th Edition 1.18 Silberschatz, Galvin and Gagne ©2013
Memory Hierarchy
Operating System Concepts – 9th Edition 1.19 Silberschatz, Galvin and Gagne ©2013
Memory Hierarchy
Operating System Concepts – 9th Edition 1.20 Silberschatz, Galvin and Gagne ©2013
Memory Hierarchy
Performance:
Earlier when the computer system was designed without Memory
Hierarchy design, the speed gap increases between the CPU registers
and Main Memory due to large difference in access time. This results in
lower performance of the system and thus, enhancement was required.
This enhancement was made in the form of Memory Hierarchy Design
because of which the performance of the system increases. One of the
most significant ways to increase system performance is minimizing how
far down the memory hierarchy one has to go to manipulate data.
Cost per bit:
As we move from bottom to top in the Hierarchy, the cost per bit
increases i.e. Internal Memory is costlier than External Memory.
Operating System Concepts – 9th Edition 1.21 Silberschatz, Galvin and Gagne ©2013
Cache Memory
Cache Memory is a special very high-speed memory. It is used to speed up
and synchronizing with high-speed CPU. Cache memory is costlier than main
memory or disk memory but economical than CPU registers. Cache memory is
an extremely fast memory type that acts as a buffer between RAM and the
CPU. It holds frequently requested data and instructions so that they are
immediately available to the CPU when needed.
Cache memory is used to reduce the average time to access data from the
Main memory. The cache is a smaller and faster memory which stores copies
of the data from frequently used main memory locations. There are various
different independent caches in a CPU, which stored instruction and data.
Operating System Concepts – 9th Edition 1.22 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.23 Silberschatz, Galvin and Gagne ©2013
Levels of memory
Levels of memory:
Level 1 or Register –
It is a type of memory in which data is stored and accepted that are
immediately stored in CPU. Most commonly used register is accumulator,
Program counter, address register etc.
Level 2 or Cache memory –
It is the fastest memory which has faster access time where data is
temporarily stored for faster access.
Level 3 or Main Memory –
It is memory on which computer works currently it is small in size and once
power is off data no longer stays in this memory
Level 4 or Secondary Memory –
It is external memory which is not fast as main memory but data stays
permanently in this memory
Operating System Concepts – 9th Edition 1.24 Silberschatz, Galvin and Gagne ©2013
Level 1 (L1) cache or Primary Cache
L1 is the primary type cache memory. The Size of the L1 cache very small
comparison to others that is between 2KB to 64KB, it depend on computer
processor. It is a embedded register in the computer
microprocessor(CPU).The Instructions that are required by the CPU that
are firstly searched in L1 Cache. Example of registers are accumulator,
address register,, Program counter etc.
Operating System Concepts – 9th Edition 1.25 Silberschatz, Galvin and Gagne ©2013
Level 3 (L3) cache or Main Memory
The L3 cache is larger in size but also slower in speed than L1 and L2,it's
size is between 1MB to 8MB.In Multicore processors, each core may have
separate L1 and L2,but all core share a common L3 cache. L3 cache double
speed than the RAM.
Operating System Concepts – 9th Edition 1.26 Silberschatz, Galvin and Gagne ©2013
Modes of Transfer
Mode of Transfer:
The binary information that is received from an external device is usually stored
in the memory unit. The information that is transferred from the CPU to the
external device is originated from the memory unit. CPU merely processes the
information but the source and target is always the memory unit. Data transfer
between CPU and the I/O devices may be done in different modes.
Data transfer to and from the peripherals may be done in any of the three
possible ways
Programmed I/O.
Interrupt- initiated I/O.
Direct memory access( DMA).
Operating System Concepts – 9th Edition 1.27 Silberschatz, Galvin and Gagne ©2013
Programmed I/O
Programmed I/O:
It is due to the result of the I/O instructions that are written in the computer
program. Each data item transfer is initiated by an instruction in the program.
Usually the transfer is from a CPU register and memory. In this case it requires
constant monitoring by the CPU of the peripheral devices
Example of Programmed I/O:
In this case, the I/O device does not have direct access to the memory unit. A
transfer from I/O device to memory requires the execution of several
instructions by the CPU, including an input instruction to transfer the data from
device to the CPU and store instruction to transfer the data from CPU to
memory. In programmed I/O, the CPU stays in the program loop until the I/O
unit indicates that it is ready for data transfer. This is a time consuming process
since it needlessly keeps the CPU busy.
Operating System Concepts – 9th Edition 1.28 Silberschatz, Galvin and Gagne ©2013
Interrupt- initiated I/O
Interrupt- initiated I/O:
Since in the above case we saw the CPU is kept busy unnecessarily. This
situation can very well be avoided by using an interrupt driven method for data
transfer. By using interrupt facility and special commands to inform the interface
to issue an interrupt request signal whenever data is available from any device.
In the meantime the CPU can proceed for any other program execution. The
interface meanwhile keeps monitoring the device. Whenever it is determined
that the device is ready for data transfer it initiates an interrupt request signal to
the computer. Upon detection of an external interrupt signal the CPU stops
momentarily the task that it was already performing, branches to the service
program to process the I/O transfer, and then return to the task it was originally
performing.
Operating System Concepts – 9th Edition 1.29 Silberschatz, Galvin and Gagne ©2013
Both the methods programmed I/O and Interrupt-driven I/O require the active
intervention of the processor to transfer data between memory and the I/O
module, and any data transfer must transverse a path through the processor.
Thus both these forms of I/O suffer from two inherent drawbacks.
The I/O transfer rate is limited by the speed with which the processor
can test and service a device.
The processor is tied up in managing an I/O transfer; a number of
instructions must be executed for each I/O transfer.
Operating System Concepts – 9th Edition 1.30 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Direct Memory Access:
DMA is a method of transferring data from the computer's RAM to another part
of the computer without processing it using the CPU. While most data that is
input or output from your computer is processed by the CPU, some data does
not require processing, or can be processed by another device. In these
situations, DMA can save processing time and is a more efficient way to move
data from the computer's memory to other devices.
For example, a sound card may need to access data stored in the computer's
RAM, but since it can process the data itself, it may use DMA to bypass the
CPU. Video cards that support DMA can also access the system memory and
process graphics without needing the CPU
Operating System Concepts – 9th Edition 1.31 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Operating System Concepts – 9th Edition 1.32 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Operating System Concepts – 9th Edition 1.33 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Operating System Concepts – 9th Edition 1.34 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Bus Request :
It is used by the DMA controller to request the CPU to relinquish the control of
the buses.
Bus Grant :
It is activated by the CPU to Inform the external DMA controller that the buses
are in high impedance state and the requesting DMA can take control of the
buses. Once the DMA has taken the control of the buses it transfers the data.
This transfer can take place in many ways.
Operating System Concepts – 9th Edition 1.35 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Types of DMA transfer using DMA controller:
Burst Transfer :
DMA returns the bus after complete data transfer. A register is used as a byte count,
being decremented for each byte transfer, and upon the byte count reaching zero, the
DMAC will release the bus. When the DMAC operates in burst mode, the CPU is
halted for the duration of the data transfer.
Steps involved are:
Bus grant request time.
Transfer the entire block of data at transfer rate of device because the device is
usually slow than the speed at which the data can be transferred to CPU.
Release the control of the bus back to CPU
So, total time taken to transfer the N bytes
= Bus grant request time + (N) * (memory transfer rate) + Bus release control
time.
Operating System Concepts – 9th Edition 1.36 Silberschatz, Galvin and Gagne ©2013
Direct Memory Access:
Cyclic Stealing :
In this DMA controller transfers one word at a time after which it must return the
control of the buses to the CPU. The CPU merely delays its operation for one
memory cycle to allow the direct memory I/O transfer to “steal” one memory cycle.
Steps Involved are:
Buffer the byte into the buffer
Inform the CPU that the device has 1 byte to transfer (i.e. bus grant request)
Transfer the byte (at system bus speed)
Release the control of the bus back to CPU.
Operating System Concepts – 9th Edition 1.37 Silberschatz, Galvin and Gagne ©2013
Types of Operating Systems
Following are some of the most widely used types of Operating system.
1.Simple Batch System
2.Multiprogramming Batch System
3.Multiprocessor System
4.Desktop System
5.Distributed Operating System
6.Clustered System
7.Realtime Operating System
8.Handheld System
Operating System Concepts – 9th Edition 1.38 Silberschatz, Galvin and Gagne ©2013
Batch Operating System
In this type of system, there is no direct interaction between
user and the computer.
The user has to submit a job (written on cards or tape) to a
computer operator.
Then computer operator places a batch of several jobs on an input
device.
Jobs are batched together by type of languages and requirement.
Then a special program, the monitor, manages the execution of
each program in the batch.
The monitor is always in the main memory and available for
execution.
Operating System Concepts – 9th Edition 1.39 Silberschatz, Galvin and Gagne ©2013
Multiprogramming Operating System
In this the operating system picks up and begins to execute one of the jobs
from memory.
Once this job needs an I/O operation operating system switches to another job
(CPU and OS always busy).
Jobs in the memory are always less than the number of jobs on disk(Job Pool).
If several jobs are ready to run at the same time, then the system chooses
which one to run through the process of CPU Scheduling.
In Non-multiprogrammed system, there are moments when CPU sits idle and
does not do any work.
In Multiprogramming system, CPU will never be idle and keeps on processing.
Time Sharing Systems are very similar to Multiprogramming batch systems. In
fact time sharing systems are an extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response time,
while in multiprogramming the prime focus is to maximize the CPU usage.
Operating System Concepts – 9th Edition 1.40 Silberschatz, Galvin and Gagne ©2013
Multiprogramming Operating System
Operating System Concepts – 9th Edition 1.41 Silberschatz, Galvin and Gagne ©2013
Multiprocessor Systems
A Multiprocessor system consists of several processors that share a common
physical memory. Multiprocessor system provides higher computing power and
speed. In multiprocessor system all processors operate under single operating
system. Multiplicity of the processors and how they do act together are transparent
to the others.
Operating System Concepts – 9th Edition 1.42 Silberschatz, Galvin and Gagne ©2013
Desktop Systems
Operating System Concepts – 9th Edition 1.43 Silberschatz, Galvin and Gagne ©2013
Distributed System
Operating System Concepts – 9th Edition 1.44 Silberschatz, Galvin and Gagne ©2013
Common Functions of Interrupts
Operating System Concepts – 9th Edition 1.45 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.46 Silberschatz, Galvin and Gagne ©2013
the computer networks used in these applications consist of a collection of
processors that do not share memory or a clock. Instead, each processor
has its own local memory. The processors communicate with one another
through various communication lines, such as high-speed buses or
telephone lines. These systems are usually referred to as loosely coupled
systems ( or distributed systems)
Operating System Concepts – 9th Edition 1.47 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.48 Silberschatz, Galvin and Gagne ©2013
Kernel
A kernel is the core component of an operating system. Using interprocess
communication and system calls, it acts as a bridge between applications
and the data processing performed at the hardware level.
When an operating system is loaded into memory, the kernel loads first and
remains in memory until the operating system is shut down again. The
kernel is responsible for low-level tasks such as disk management, task
management and memory management.
A computer kernel interfaces between the three major computer hardware
components, providing services between the application/user interface and
the CPU, memory and other hardware I/O devices.
Operating System Concepts – 9th Edition 1.49 Silberschatz, Galvin and Gagne ©2013
The kernel is responsible for:
Operating System Concepts – 9th Edition 1.50 Silberschatz, Galvin and Gagne ©2013
Kernel vs OS
BASIS FOR
KERNEL OPERATING SYSTEM
COMPARISON
Basic Kernel is an important part of the operating system. Operating System is a system program.
Interface Kernel is an interface between software and hardware of the Operating System is an interface
computer. between user and hardware of the
computer.
Purpose Kernel memory management, process management, task In addition to the responsibilities of
management, disk management. Kernel, Operating System is
responsible for protection and security
of the computer.
Operating System Concepts – 9th Edition 1.51 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.52 Silberschatz, Galvin and Gagne ©2013
Types of Kernels
Monolithic Kernels: All operating system services run along the main kernel
thread in a monolithic kernel, which also resides in the same memory area,
thereby providing powerful and rich hardware access.
Microkernels: Define a simple abstraction over hardware that use primitives
or system calls to implement minimum OS services such as multitasking,
memory management and interprocess communication.
Hybrid Kernels: Run a few services in the kernel space to reduce the
performance overhead of traditional microkernels where the kernel code is
still run as a server in the user space.
Nano Kernels: Simplify the memory requirement by delegating services,
including the basic ones like interrupt controllers or timers to device drivers.
Exo Kernels: Allocate physical hardware resources such as processor time
and disk block to other programs, which can link to library operating
systems that use the kernel to simulate operating system abstractions.
Operating System Concepts – 9th Edition 1.53 Silberschatz, Galvin and Gagne ©2013
End of Chapter 1
Operating System Concepts – 9th Edit9on Silberschatz, Galvin and Gagne ©2013