Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 41

Operating System

Rohan R. Kerkar
Table of Content

• Basic Elements of a Computer System

• Instruction Execution

• Operation System
Structural Elements of a Computer System
There are four main Structural Elements:

• Processor: Controls the operation of the computer and


performs its data processing functions. When there is only one
processor, it is often referred to as the central processing unit
(CPU).

• Main memory: Stores data and programs. This memory is


typically volatile: that is, when the computer is shut down, the
contents of the memory are lost. In contrast, the contents of
disk memory are retained even when the computer system is
shut down. Main memory is also referred to as real memory or
primary memory.
Structural Elements of OS
• I/O modules: Move data between the computer and its
external environment. The external environment consists of a
variety of devices, including secondary memory devices (e.g.,
disks), communications equipment, and terminals.

• System bus: Provides for communication among processors,


main memory and I/O modules.
Instruction Execution
A program to be executed by a processor consists of a set of
instructions stored in memory.

In its simplest form, instruction processing consists of two steps:


• The processor reads (fetches) instructions from memory one at
a time and executes each instruction.

• Program execution consists of repeating the process of


instruction fetch and instruction execution. Instruction
execution may involve several operations and depends on the
nature of the instruction.
Instruction Execution
• The processing required for a single instruction is called an
instruction cycle.
• The two steps are referred to as the fetch stage and the execute
stage.
• Program execution halts only if the processor is turned off,
some sort of unrecoverable error occurs or a program
instruction that halts the processor is encountered.
Instruction Execution
• Program Counter (PC) holds the address of the next
instruction to be fetched.

• The fetched instruction is loaded into the Instruction Register


(IR).

• The instruction contains bits that specify the action the


processor is to take.

• The processor interprets the instruction and performs the


required action.
Instruction Execution
The fetch – execute action falls into four categories:
• Processor-memory: Data may be transferred from processor to
memory or from memory to processor.

• Processor-I/O: Data may be transferred to or from a peripheral


device by transferring between the processor and an I/O
module.

• Data processing: The processor may perform some arithmetic


or logic operation on data.

• Control: An instruction may specify that the sequence of


execution be altered.
Operating System

• An operating system (OS) exploits the hardware resources of


one or more processors to provide a set of services to system
users.

• The OS also manages secondary memory and I/O


(input/output) devices on behalf of its users.

• Accordingly, it is important to have some understanding of the


underlying computer system hardware before we begin our
examination of operating systems.
Operating System
Objectives:
Convenience: An OS makes a computer more convenient to use.

Efficiency: An OS allows the computer system resources to be


used in an efficient manner.

Ability to evolve: An OS should be constructed in such a way as


to permit the effective development, testing, and introduction of
new system functions without interfering with service.
Operating System
The Operating System as a User/Computer Interface

End User
Programmer

OS Designer
Application Programs

Utilities

Operating System

Computer Hardware
Operating System
• End user views a computer system in terms of a set of
applications.

• An application can be expressed in a programming language


and is developed by an application programmer.

• A set of system programs is provided to develop an application


programs.
Operating System

• Some of these programs are referred to as utilities, or library


programs.

• OS is most important system program

• OS masks the details of the hardware from the programmer


and provides the programmer with a convenient interface for
using the system
Evolution of Operating System
Serial Processing
• Early computer from late 1940 to the mid 1950.
• The programmer interacted directly with the computer
hardware.
• These machine are called bare machine as they don't have OS.
• Every computer system is programmed in its machine
language.
• Uses Punch Card, paper tapes and language translator
Evolution of Operating System
These early systems presented two main problems:

Scheduling: used sign up sheet to reserve machine time. A user


may sign up for an hour but finishes his job in 45 minutes. This
would result in wasted computer idle time, also the user might
run into the problem not finish his job in allotted time.

Setup time: A single program involves -


• Loading compiler and source program in memory
• Saving the compiled program (object code)
• Loading and linking together object program and common
function.
Evolution of Operating System
• Each of these steps involves the mounting or dismounting
tapes on setting up punch cards.

• If an error occurred, user had to go the beginning of the set up


sequence.

• Thus, a considerable amount of time is spent in setting up the


program to run.

• This mode of operation is turned as serial processing,


reflecting the fact that users access the computer in series.
Evolution of Operating System
Simple Batch System
• Batch is defined as a group of jobs with similar needs.
• The operating system allows users to form batches.
• Computer executes each batch sequentially, processing all jobs
of a batch considering them as a single process called batch
processing
• The central idea behind the simple batch-processing scheme is
the use of a piece of software known as the monitor.
Evolution of Operating System
• With this type of OS, the user no longer has direct access to
the processor, instead, the user submits the job on cards or tape
to a computer operator, who batches the jobs together
sequentially and places the entire batch on an input device, for
use by the monitor.

• Each program is constructed to branch back to the monitor


when it completes processing, at which point the monitor
automatically begins loading the next program.
Evolution of Operating System
There have been two sacrifices:
• Some main memory is now given over to the monitor and
some processor time is consumed by the monitor.
Evolution of Operating System
Multiprogrammed Batch System

• Multiprogramming increases CPU utilization by organizing jobs


in such a manner that CPU has always one job to execute.

• If computer is required to run several programs at the same time,


the processor could be kept busy for the most of the time by
switching its attention from one program to the next.

• Additionally I/O transfer could overlap the processor activity i.e,


while one program is awaiting for an I/O transfer, another
program can use the processor.

• CPU never sits idle.


Operating System Services
OS typically provides services in the following areas:
Program Development: The OS provides a variety of facilities
and services, such as editors and debuggers, to assist the
programmer in creating programs.

Program Execution: A number of steps need to be performed to


execute a program. Instructions and data must be loaded into
main memory, I/O devices and files must be initialized, and other
resources must be prepared. The OS handles these scheduling
duties for the user.
Operating System Services
Access to I/O devices: Each I/O device requires set of
instructions or control signals for operation. The OS provides a
uniform interface that hides these details so that programmers
can access such devices using simple reads and writes.

Controlled access to files: In the case of a system with multiple


users, the OS may provide protection mechanisms to control
access to the files.

System access: For shared or public systems, the OS controls


access to the system by providing protection of resources and
data from unauthorized users
Operating System Services
Error detection and response: A variety of errors can occur
while a computer system is running. OS must provide a response
that clears the error condition with the least impact on running
applications. The response may range from ending the program
that caused the error, to retrying the operation, to simply
reporting the error to the application.

Accounting: A good OS will collect usage statistics for various


resources and monitor performance parameters such as response
time. This information is used to improve performance.
Operating System Structures
Simple structure
• Such operating systems do not have well defined structure and
are small, simple and limited systems.

• The interfaces and levels of functionality are not well


separated. MS-DOS is an example of such operating system.

• In MS-DOS application programs are able to access the basic


I/O routines.

• These types of operating system cause the entire system to


crash if one of the user programs fails.
Operating System Structures
Structure of Simple OS
Operating System Structures
Layered structure
• An OS can be broken into pieces and retain much more
control on system.

• In this structure the OS is broken into number of layers


(levels). The bottom layer (layer 0) is the hardware and the
topmost layer (layer N) is the user interface.

• These layers are so designed that each layer uses the functions
of the lower level layers only.
Operating System Structures
• This simplifies the debugging process as if lower level layers are
debugged and an error occurs during debugging then the error
must be on that layer only as the lower level layers have already
been debugged.

• The main disadvantage of this structure is that at each layer, the


data needs to be modified and passed on which adds overhead to
the system.

• Moreover careful planning of the layers is necessary as a layer


can use only lower level layers.

• UNIX is an example of this structure.


Operating System Structures
Structure of Layered OS
Operating System Structures
Modular structure or approach
• It is considered as the best approach for an OS.
• It involves designing of a modular kernel.
• The kernel has only set of core components and other services
are added as dynamically loadable modules to the kernel either
during run time or boot time.

• It resembles layered structure due to the fact that each kernel


has defined and protected interfaces but it is more flexible
than the layered structure as a module can call any other
module.
Operating System Structures
Structure of Modular OS
Kernel
• Kernel is central component of an
operating system that manages
operations of computer and
hardware.
• It basically manages operations of
memory and CPU time.
• It is core component of an
operating system.
• Kernel acts as a bridge between
applications and data processing
performed at hardware level using
inter-process communication and
system calls.
Kernel
• Kernel loads first into memory when an operating system is
loaded and remains into memory until operating system is shut
down again.

• It is responsible for various tasks such as disk management,


task management, and memory management.

• It decides which process should be allocated to processor to


execute and which process should be kept in main memory to
execute.
Kernel
• It basically acts as an interface between user applications and
hardware.

• The major aim of kernel is to manage communication between


software i.e. user-level applications and hardware i.e., CPU
and disk memory.
Kernel
Objectives of Kernel :
• To establish communication between user level application
and hardware.
• To decide state of incoming processes.
• To control disk management.

• To control memory management.


• To control task management.
Types of Kernel
Monolithic Kernel
• It is one of types of kernel where all operating system services
operate in kernel space. It has dependencies between systems
components. It has huge lines of code which is complex.

• Example :Unix, Linux, Open VMS, XTS-400

• Advantage :
It has good performance.

• Disadvantage :
It ha dependencies between system component and lines of code in
millions.
Types of Kernel
Micro Kernel
• It is kernel types which has minimalist approach. It has virtual
memory and thread scheduling. It is more stable with less
services in kernel space. It puts rest in user space.

• Example : Mach, L4, AmigaOS, Minix, K42

• Advantage :
It is more stable.

• Disadvantage :
There are lots of system calls and context switches.
Types of Kernel
Hybrid Kernel
• It is the combination of both monolithic kernel and
mircrokernel. It has speed and design of monolithic kernel and
modularity and stability of microkernel.

• Example : Windows NT, Netware, BeOS

• Advantage :
It combines both monolithic kernel and microkernel.

• Disadvantage :
It is still similar to monolithic kernel.
Types of Kernel
Exo Kernel
• It is the type of kernel which follows end-to-end principle. It
has fewest hardware abstractions as possible. It allocates
physical resources to applications.

• Example : Nemesis, ExOS

• Advantage :
It has fewest hardware abstractions.

• Disadvantage :
There is more work for application developers.
Types of Kernel
Nano Kernel
• It is the type of kernel that offers hardware abstraction but
without system services. Micro Kernel also does not have
system services therefore the Micro Kernel and Nano Kernel
have become analogous.

• Example : EROS

• Advantage :
It offers hardware abstractions without system services.

• Disadvantage :
It is quite same as Micro kernel hence it is less used.
References
• https://www.youtube.com/watch?v=GjNp0bBrjmU (Video)

• https://www.geeksforgeeks.org/kernel-in-operating-system/

• William_Stallings_Operating_Systems_7th_Edition
(Reference Textbook)

You might also like