You are on page 1of 51

Dr.

Akhtar Husain, Department of


Computer Science and Information
1

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
2

Technology, FET, MJP Rohilkhand


University
• Execute user programs and make solving
problem easier
• Make the computer system convenient to

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
use
• Use the computer hardware in efficient
manner

3
 OS is a resource allocator
• Manages all resources
• Decides between conflicting requests for efficient
and fair resource use

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 OS is a control program
• Controls execution of programs to prevent errors
and improper use of the computer

4
 No universally accepted definition
 “Everything a vendor ships when you order an operating
system” is a good approximation
• But varies wildly
 “The one program running at all times on the computer” is

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
the kernel.
 Everything else is either
• a system program (ships with the operating system) , or
• an application program.

5
Dr. Akhtar Husain, Department of
Computer Science and Information
6

Technology, FET, MJP Rohilkhand


University
UNIX LINUX DOS MS Windows
Multi User Multi User Single Single User
Multi Multi User Multi Tasking
Tasking Tasking Single
Tasking

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
Command Command Command Graphic User
Line User Line User Line User Interface
Interface Interface, Interface (GUI)
GUI

Network Network Desktop Desktop OS


7
OS OS OS
(1).Process management:- Process management module
takes care of creation and deletion of processes, and
providing mechanisms for synchronization and
communication among processes.

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
(2). Memory management:- Memory management
module takes care of allocation and de-allocation of
memory space to programs in need.
(3). File management:- It takes care of file-related
activities such as organization storage, retrieval,
naming, sharing, and protection of files. 8

(Contd..)
(4). Device Configuration:- Controls peripheral
devices connected to the computer.

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
(4). Interface Platform:- Allows the computer to run
other applications.

9
Dr. Akhtar Husain, Department of
Computer Science and Information
10

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
11

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
12

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
13

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
14

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
15

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
16

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
17

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
18

Technology, FET, MJP Rohilkhand


University
• Computer users like to have many application programs simultaneously
operational. This is necessary because some application programs require
long processing times before the desired results can be produced.
• It is true that by having more than one application program operational, the
time that it takes for each process to complete its task increases. However,
the overall system productivity also increases.
• These simultaneously executing programs are called tasks. Therefore, a

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
system with the capability of multitasking allows users to activate more than
one task, or application program, at a time. An Internet browser that
searches for some information and A word-processing software that is
activated to perform the word-processing task are applications.
• The operating system will switch between tasks based on the tasks current
states and their requirements and priorities.
• Multitasking is only possible when multiprogramming is the fundamental
capability of simultaneously executing pieces of software.
• Most modern operating systems, like UNIX, Linux, and Windows, support 19
multitasking.
Dr. Akhtar Husain, Department of
Computer Science and Information
20

Technology, FET, MJP Rohilkhand


University
• A multithreading operating system is one that is capable of handling
processes and threads at the same time and in which from each
process the system is able to generate more than one thread.
• In such an operating system, there must be facilities for thread
creation, deletion, switching, etc.
• Such an operating system allows users to generate more than one

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
request to a process at a time. For example, a browser can be made
to search simultaneously for more than one topic, even though there
is only one copy of the “browser program” in main memory.
• The multiprogramming methodology and technique are essential in
the implementation of multithreading. In this new environment, a
thread becomes the smallest functional object to which CPU is
assigned.

21
Dr. Akhtar Husain, Department of
Computer Science and Information
22

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
23

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
24

Technology, FET, MJP Rohilkhand


University
Hardware

Operating System (OS)

Programming Language (e.g. PASCAL)

Application Programs (e.g. WORD, EXCEL)

Dr. Akhtar Husain, Department of


Computer Science and Information
25

Technology, FET, MJP Rohilkhand


University
Dr. Akhtar Husain, Department of
Computer Science and Information
26

Technology, FET, MJP Rohilkhand


University
• System Software- Performs essential operation tasks
• Operating system
• Utility programs
• Application Software - Performs specific tasks for

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
users
• Business application
• Communications application
• Multimedia application
• Entertainment and educational software
• Driver Programs (Device Driver)
• small program that allows a specific input or output
device to communicate with the rest of the computer 27
system
 General-purpose OS is very large program
 Various ways to structure ones

• Simple structure – MS-DOS

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
• More complex -- UNIX
• Layered – an abstrcation
• Microkernel -Mach

28
 MS-DOS-written to provide the most functionality
in the least space

• Not divided into modules


• Although MS-DOS has some

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
structure, its interfaces and
level of functionality are not
well separated

29
 UNIX-limited by hardware functionality, the original UNIX
operating system had limited structuring. The UNIX
OS consists of two separable parts.

• System Programs

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
• The Kernel
 Consists of everything below the system-call interface and
above the physical hardware
 Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level
30
Dr. Akhtar Husain, Department of
Computer Science and Information
31

Technology, FET, MJP Rohilkhand


University
 The operating system is divided into a number of
layers (levels), each built on top of lower layers. The
bottom layer (layer 0), is the hardware; the highest
(layer N) is the user interface.

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 With modularity, layers are
selected such that each uses
functions (operations) and
services of only lower-level
layers
32
 Mach example of microkernel
 Moves as much from the kernel into user space
• Mac OS X kernel (Darwin) partly based on Mach
 Communication takes place between user modules using
message passing

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 Benefits:
• Easier to extend a microkernel
• Easier to port the operating system to new architectures
• More reliable (less code is running in kernel mode)
• More secure
 Detriments:
• Performance overhead of user space to kernel space 33
communication
Application File Device user
Program System Driver mode

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
messages messages

Interprocess memory CPU kernel


Communication managment scheduling mode

microkernel

hardware

34
 Process Management
 Memory management
 I/O Device management
 File system

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 Protection
 Network management
 Network services
 User Interface
35
 User Interface
 Program Execution
 I/O Operations
 File system management

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 Communication
 Error detection and handling
 Resources allocation
 Accounting
 Protection 36
 Security
Dr. Akhtar Husain, Department of
Computer Science and Information
37

Technology, FET, MJP Rohilkhand


University
User interface
• All Operating Systems have a user interface. Types
of user Interface are
• Command –line interface, Batch inter face,
GUI

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
Program execution
• Starting of programs, managing their execution and
communicating their results
I/O operations

• Mechanism for initiating and managing I/O operation


38
File System Management
• Creating, maintaining and manipulating files
Communications
• Between processes of the same user and different
users

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
Error detection and handlings

• Protection related issues

• Safety in the case of power failures via backups

• Detecting and desirable states such as printer out of


39
papers
Resources allocations
• Includes processor and I/O scheduling, memory
management
Accounting
• To track user usage of resources for billing and
statistical reasons

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
Protection
• One process must be protected from another

Security

• Security module protects the resources and


40
information of a computer system against destruction

and unauthorized access


 Kernel is the central component of Operating system

 The sole aim of kernel is to manage the communication


between the software(user level application) and the
hardware( CPU, disk memory etc )

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
 When a process makes requests of the kernel, the
request is called a system call. Various kernel designs
differ in how they manage system calls and resources

41
Dr. Akhtar Husain, Department of
Computer Science and Information
42

Technology, FET, MJP Rohilkhand


University
Nano
Monolithic

KERNEL
Hybrid
Micro

Dr. Akhtar Husain, Department of


Computer Science and Information
43

Technology, FET, MJP Rohilkhand


University
 Execute all of their code in the same address space
(kernel space) microkernels try to run most of their
services in user space, aiming to improve
maintainability and modularity of the codebase.

 It runs every basic system service like process and

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
memory management, interrupt handling and I/O
communication, file system etc. in kernel space.
Examples are Linux, Unix.

 In a monolithic kernel, all OS services run along with


the main kernel thread, thus also residing in the
same memory area.
44

(Contd..)
Advantages: It has very good performance
Disadvantages: Difficult to debug and maintain

Dr. Akhtar Husain, Department of


Computer Science and Information
45

Technology, FET, MJP Rohilkhand


University
 Consists of defining a simple abstraction over the
hardware, with a set of primitives or system calls to
implement minimal OS services such as memory
management, multitasking, and inter-process
communication. Other services, including those
normally provided by the kernel, such as networking,

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
are implemented in user-space programs, referred to
as servers.

 Microkernels are easier to maintain than monolithic


kernels, but the large number of system calls and
context switches might slow down the system
because they typically generate more overhead than 46
plain function calls.
(Contd..)
 A microkernel allows the implementation of the
remaining part of the operating system as a normal
application program written in a high-level language,
and the use of different operating systems on top of
the same unchanged kernel.
 It is also possible to dynamically switch among

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
operating systems and to have more than one active
simultaneously.
Advantages:
• Easy to maintain
• Crash resistant(if one server fails still other server
work efficiently)
• Portable
• Smaller in size 47
Disadvantage: Slower processing because of additional
message passing (Contd..)
Monolithic Kernel Micro Kernel

Monolithic Kernel uses Micro Kernel uses message


“signals” and “sockets” queues
Monolithic Kernel Micro Kernel implements
implements everything everything needed for

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
needed for memory memory management in
management in kernel userspace.
space.
The monolithic kernel The microkernel approach
approach handle I/O doesn't handle I/O
communication directly. communication directly. 48

Unstable Stable
 This approach combines the speed and simpler
design of a monolithic kernel with the modularity and
execution safety of a microkernel
 are a compromise between the monolithic and
microkernel designs.

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
49
 Delegates virtually all services — including even the
most basic ones like interrupt controllers or the timer —
to device drivers to make the kernel memory
requirement even smaller than a traditional microkernel

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
50
• A re-entrant kernel enables a process (and it’s threads) to give away the CPU
while in kernel mode. They do not hinder other processes from also entering
kernel mode. This behavior allows CPU to be shared among multiple processes.
• A typical use case is IO wait. The process wants to read a file. It calls a kernel
function for this. Inside the kernel function, the disk controller is asked for the
data. Getting the data will take some time and the function is blocked during
that time.

University
Dr. Akhtar Husain, Department of
Computer Science and Information
Technology, FET, MJP Rohilkhand
• With a re-entrant kernel, the scheduler will assign the CPU to another process
(kernel thread) until an interrupt from the disk controller indicates that the data
is available and our thread can be resumed. This process can still access IO
(which needs kernel functions), like user input. The system stays responsive and
CPU time waste due to IO wait is reduced.
• All Unix kernels are reentrant. This means that several processes may be
executing in Kernel Mode at the same time. Of course, on uniprocessor systems,
only one process can progress, but many can be blocked in Kernel Mode when
waiting for the CPU or the completion of some I/O operation.
• If a hardware interrupt occurs, a reentrant kernel is able to suspend the current
running process even if that process is in Kernel Mode. This capability is very
important, because it improves the throughput of the device controllers that
issue interrupts. 51

You might also like