Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Operating system
Description: Operating system, it's working, types of operating system

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Operating System Tutorial

OPERATING SYSTEM TUTORIAL

Simply Easy Learning by tutorialspoint
...
com
i

ABOUT THE TUTORIAL

Operating System Tutorial
An operating system (OS) is a collection of software that manages computer hardware resources and provides common
services for computer programs
...

This tutorial will take you through step by step approach while learning Operating System concepts
...


Prerequisites
Before you start proceeding with this tutorial, I'm making an assumption that you are already aware about basic computer concepts
like what is keyboard, mouse, monitor, input, output, primary memory and secondary memory etc
...


Copyright & Disclaimer Notice
 All the content and graphics on this tutorial are the property of tutorialspoint
...
Any content from tutorialspoint
...
com
...

This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site
or its contents including this tutorial
...
com site or this tutorial content contains some
errors, please contact us at webmaster@tutorialspoint
...
i
Audience
...
i
Copyright & Disclaimer Notice
...
1
Definition
...
2
Processor Management
...
3
File Management
...
3

Types of Operating Systems
...
4
Time-sharing operating systems
...
6
Network operating System
...
8
Hard real-time systems
...
8

Operating System Services
...
10
I/O Operation
...
11
Communication
...
12
Resource Management
...
12

Operating System Properties
...
13
Advantages
...
14

Multitasking
...
16
Advantages
...
16

Interactivity
...
17
Distributed Environment
...
18
Advantages
...
19
Process
...
20
Process States
...
22

Operating System Process Scheduling
...
24
Scheduling Queues
...
26
Schedulers
...
27
Short Term Scheduler
...
27
Comparison between Scheduler
...
30

Process Scheduling Algorithms
...
32
Shortest Job First (SJF)
...
34
Round Robin Scheduling
...
36

Operating System Multi-Threading
...
37
Difference between Process and Thread
...
39
Types of Thread
...
40
Advantages
...
40

Kernel Level Threads
...
41
iii

Disadvantages
...
42
Many to Many Model
...
42
One to One Model
...
44

Memory Management
...
47
Dynamic Linking
...
48
Swapping
...
50
Fragmentation
...
52
Segmentation
...
55
Demand Paging
...
59
Disadvantages
...
60
Reference String
...
61
Optimal Page algorithm
...
62
Page Buffering algorithm
...
62
Most frequently Used (LFU) algorithm
...
63
Overview
...
63
Controller
...
64
Polling
...
66
Direct Memory Access (DMA)
...
69

I/O Software
...
70
Application I/O Interface
...
72
Kernel I/O Subsystem
...
74

File System
...
75
File Structure
...
76
Ordinary files
...
76
Special files:
...
77
Sequential access
...
77
Indexed sequential access
...
78
Contiguous Allocation
...
78
Indexed Allocation
...
79
Authentication
...
81
Program Threats
...
83
Computer Security Classifications
...
85
Components of Linux System
...
87
Basic Features
...
89

About tutorialspoint
...
90

iii

1

CHAPTER

Overview
This chapter gives a basic idea about Operating System starting with definition of
operating system, and its functions
...
It

provides users an environment in which a user can execute programs conveniently and
efficiently
...
An operating System controls the
allocation of resources and services such as memory, processors, devices and information
...


TUTORIALS POINT
Simply Easy Learning

Page 1

Following are some of important functions of an operating System
...
Main memory
is a large array of words or bytes where each word or byte has its own address
...
So for a program
to be executed, it must in the main memory
...




Keeps tracks of primary memory i
...
what part of it are in use by whom, what part are
not in use
...




Allocates the memory when the process requests it to do so
...


Processor Management
In multiprogramming environment, OS decides which process gets the processor when and how
much time
...
Operating System does the following
activities for processor management
...
Program responsible for this task is
known as traffic controller
...




De-allocates processor when processor is no longer required
...
Operating System does the
following activities for device management
...
Program responsible for this task is known as the I/O
controller
...




Allocates the device in the efficient way
...


File Management
A file system is normally organized into directories for easy navigation and usage
...
Operating System does the following activities
for file management
...
The collective facilities are often
known as file system
...




Allocates the resources
...


Other Important Activities
Following are some of the important activities that Operating System does
...




Control over system performance -- Recording delays between request for a service
and response from the system
...




Error detecting aids -- Production of dumps, traces, error messages and other
debugging and error detecting aids
...


TUTORIALS POINT
Simply Easy Learning

Page 3

2

CHAPTER

Types of Operating Systems
This section describes various types of Operating Systems
...
Operating systems keep

evolving over the period of time
...


Batch operating system
The users of batch operating system do not interact with the computer directly
...

To speed up processing, jobs with similar needs are batched together and run as a group
...
The operator then sorts programs into
batches with similar requirements
...




Lack of interaction between the user and job
...




Difficult to provide the desired priority
...
Time-sharing or multitasking is a logical extension
of multiprogramming
...
The main difference between Multiprogrammed Batch Systems and
Time-Sharing Systems is that in case of multiprogrammed batch systems, objective is to
maximize processor use, whereas in Time-Sharing Systems objective is to minimize response
time
...
Thus, the user can receive an immediate response
...

That is if n users are present, each user can get time quantum
...

Operating system uses CPU scheduling and multiprogramming to provide each user with a small
portion of a time
...

Advantages of Timesharing operating systems are following



Provide advantage of quick response
...




Reduces CPU idle time
...




Problem of reliability
...




Problem of data communication
...
Data processing jobs are distributed among the processors accordingly to which
one can perform each job most efficiently
...
These are referred as loosely coupled systems or
distributed systems
...
These
processors are referred as sites, nodes, and computers and so on
...




With resource sharing facility user at one site may be able to use the resources
available at another
...




If one site fails in a distributed system, the remaining sites can potentially continue
operating
...




Reduction of the load on the host computer
...


TUTORIALS POINT
Simply Easy Learning

Page 6

Network operating System
Network Operating System runs on a server and and provides server the capability to manage
data, users, groups, security, applications, and other networking functions
...
Examples of network operating systems are Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD
...




Centralized servers are highly stable
...




Upgrades to new technologies and hardware can be easily integrated into the system
...


The disadvantages of network operating systems are following
...




Dependency on a central location for most operations
...


TUTORIALS POINT
Simply Easy Learning

Page 7

Real Time operating System
Real time system is defines as a data processing system in which the time interval required to
process and respond to inputs is so small that it controls the environment
...
The time taken by the system to
respond to an input and display of required updated information is termed as response time
...

Real-time systems are used when there are rigid time requirements on the operation of a
processor or the flow of data and real-time systems can be used as a control device in a
dedicated application
...
For example Scientific experiments, medical imaging systems,
industrial control systems, weapon systems, robots, and home-appliance controllers, Air traffic
control system etc
...


Hard real-time systems
Hard real-time systems guarantee that critical tasks complete on time
...
In these systems virtual
memory is almost never found
...
Critical real-time task gets priority over other tasks and
retains the priority until it completes
...
For example, Multimedia, virtual reality, Advanced Scientific Projects like
undersea exploration and planetary rovers etc
...


A

n Operating System provides services to both the users and to the programs
...




It provides users, services to execute the programs in a convenient manner
...




Program execution



I/O operations



File System manipulation



Communication



Error Detection



Resource Allocation



Protection

TUTORIALS POINT
Simply Easy Learning

Page 9

Program execution
Operating system handles many kinds of activities from user programs to system programs like
printer spooler, name servers, file server etc
...

A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use)
...




Loads a program into memory
...




Handles program's execution
...




Provides a mechanism for process communication
...


I/O Operation
I/O subsystem comprised of I/O devices and their corresponding driver software
...

Operating System manages the communication between user and device drivers
...




I/O operation means read or write operation with any file or any specific I/O device
...




Operating system provides the access to the required I/O device when required
...
Computer can store files on the disk
(secondary storage), for long term storage purpose
...
Each of these media has its
own properties like speed, capacity, data transfer rate and data access methods
...
These
directories may contain files and other directions
...




Program needs to read a file or write a file
...




Permission varies from read-only, read-write, denied and so on
...




Operating System provides an interface to the user to create/delete directories
...


Communication
In case of distributed systems which are a collection of processors that do not share memory,
peripheral devices, or a clock, operating system manages communications between processes
...

OS handles routing and connection strategies, and the problems of contention and security
...




Two processes often require data to be transferred between them
...




Communication may be implemented by two methods either by Shared Memory or by
Message Passing
...
Error may occur in CPU, in I/O devices or in the memory
hardware
...




OS constantly remains aware of possible errors
...


Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles
and files storage are to be allocated to each user or job
...




OS manages all kind of resources using schedulers
...


Protection
Considering computer systems having multiple users the concurrent execution of multiple
processes, then the various processes must be protected from each another's activities
...
Following are the major activities of an operating
system with respect to protection
...




OS ensures that external I/O devices are protected from invalid access attempts
...


TUTORIALS POINT
Simply Easy Learning

Page 12

4

CHAPTER

Operating System Properties
This section discusses various properties of an Operating System
...


Batch processing
Batch processing is a technique in which Operating System collects one programs and data
together in a batch before processing starts
...




OS defines a job which has predefined sequence of commands, programs and data as
a single unit
...




Jobs are processed in the order of submission i
...
first come first served fashion
...


Advantages


Batch processing takes much of the work of the operator to the computer
...


Disadvantages


Difficult to debug program
...




Due to lack of protection scheme, one batch job can affect pending jobs
...
Switches occur so frequently that the users may interact with each
program while it is running
...




The user gives instructions to the operating system or to a program directly, and
receives an immediate response
...




Multitasking Operating Systems are also known as Time-sharing systems
...




A time-shared operating system uses concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time-shared CPU
...




A program that is loaded into memory and is executing is commonly referred to as a
process
...




Since interactive I/O typically runs at people speeds, it may take a long time to
complete
...




Operating system allows the users to share the computer simultaneously
...




As the system switches CPU rapidly from one user/program to the next, each user is
given the impression that he/she has his/her own CPU, whereas actually one CPU is
being shared among many users
...
Multiprogramming assumes a single shared
processor
...

Following figure shows the memory layout for a multiprogramming system
...




The operating system keeps several jobs in memory at a time
...




The operating system picks and begins to execute one of the job in the memory
...




User feels that many programs are allotted CPU almost simultaneously
...




To accommodate many jobs in memory, memory management is required
...
Operating system
does the following activities related to interactivity
...




OS managers input devices to take inputs from the user
...




OS manages output devices to show outputs to the user
...




OS Response time needs to be short since the user submits and waits for the result
...
Operating system does
the following activities related to real time system activity
...




The Operating system must guarantee response to events within fixed periods of time
to ensure correct performance
...
Operating system does the following activities related to distributed environment
...




The processors do not share memory or a clock
...




OS manages the communications between the processors
...


TUTORIALS POINT
Simply Easy Learning

Page 17

Spooling
Spooling is an acronym for simultaneous peripheral operations on line
...
This buffer is a special area in memory or hard disk which is
accessible to I/O devices
...




OS handles I/O device data spooling as devices have different data access rates
...




OS maintains parallel computation because of spooling process as a computer can
perform I/O in parallel fashion
...


Advantages


The spooling operation uses a disk as a very large buffer
...


TUTORIALS POINT
Simply Easy Learning

Page 18

5

CHAPTER

Operating System Processes
This section describes process, process states and process control block (PCB)
...
The execution of a process must progress in a sequential
fashion
...




A process is defined as an entity which represents the basic unit of work to be
implemented in the system
...


S
...
Component & Description

1

Object Program
Code to be executed
...


3

Resources
While executing the program, it may require some resources
...
A process can run to completion only when all
requested resources have been allocated to the process
...


TUTORIALS POINT
Simply Easy Learning

Page 19

Program
A program by itself is not a process
...
Program contains the instructions to be executed by processor
...
A program
does not perform any action by itself
...
The state of a process is defined as the current activity
of the process
...


S
...
State & Description

1

New
The process is being created
...
Ready processes are waiting to
have the processor allocated to them by the operating system so that they can run
...
e
...


4

Waiting
The process is waiting for some event to occur (such as the completion of an I/O
operation)
...


TUTORIALS POINT
Simply Easy Learning

Page 20

TUTORIALS POINT
Simply Easy Learning

Page 21

Process Control Block, PCB
Each process is represented in the operating system by a process control block (PCB) also
called a task control block
...
Operating
system groups all information that needs about particular process
...


S
...
Information & Description

1

Pointer
Pointer points to another process control block
...


2

Process State
Process state may be new, ready, running, waiting and so on
...


4

CPU registers
CPU registers include general purpose register, stack pointers, index registers and
accumulators etc
...


5

Memory management information
This information may include the value of base and limit registers, the page tables, or the
segment tables depending on the memory system used by the operating system
...


6

Accounting information
This information includes the amount of CPU and real time used, time limits, job or
process numbers, account numbers etc
...
The PCB serves as the repository for any information which can vary from
process to process
...
If that
process gets suspended, the contents of the registers are saved on a stack and the pointer to
the particular stack frame is stored in the PCB
...


TUTORIALS POINT
Simply Easy Learning

Page 23

6

CHAPTER

Operating System Process
Scheduling
This section describes process scheduling, scheduling queues and various types of process
schedulers
...

Process scheduling is an essential part of a Multiprogramming operating system
...


Scheduling Queues
Scheduling queues refers to queues of processes or devices
...
This queue consists of all processes in the
system
...
Device queue
is a queue for which multiple processes are waiting for a particular I/O device
...

This figure shows the queuing diagram of process scheduling
...




The circles represent the resources that serve the queues
...


TUTORIALS POINT
Simply Easy Learning

Page 24

Queues are of two types



Ready queue



Device queue

A newly arrived process is put in the ready queue
...
Once the CPU is assigned to a process, then that process will execute
...




The process could issue an I/O request and then it would be placed in an I/O queue
...




The process could be removed forcibly from the CPU, as a result of interrupt and put
back in the ready queue
...


S
...
State & Description

1

Running
When new process is created by Operating System that process enters into the system as
in the running state
...
Each
entry in the queue is a pointer to a particular process
...
Use of dispatcher is as follows
...
If the process has completed or aborted, the process is
discarded
...


TUTORIALS POINT
Simply Easy Learning

Page 26

Schedulers
Schedulers are special system software which handles process scheduling in various ways
...
Schedulers are of three types



Long Term Scheduler



Short Term Scheduler



Medium Term Scheduler

Long Term Scheduler
It is also called job scheduler
...
Job scheduler selects processes from the queue and loads them into
memory for execution
...
The primary
objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and
processor bound
...
If the degree of
multiprogramming is stable, then the average rate of process creation must be equal to the
average departure rate of processes leaving the system
...
Time-sharing
operating systems have no long term scheduler
...


Short Term Scheduler
It is also called CPU scheduler
...
It is the change of ready state to running state of the process
...

Short term scheduler also known as dispatcher, execute most frequently and makes the fine
grained decision of which process to execute next
...


Medium Term Scheduler
Medium term scheduling is part of the swapping
...
It
reduces the degree of multiprogramming
...


TUTORIALS POINT
Simply Easy Learning

Page 27

Running process may become suspended if it makes an I/O request
...
In this condition, to remove the process from
memory and make space for other process, the suspended process is moved to the secondary
storage
...
Swapping may be necessary to improve the process mix
...
N
...


2

Speed is lesser than short
term scheduler

Speed is fastest among
other two

Speed is in between both
short and long term scheduler
...


4

It is almost absent or minimal It is also minimal in time
in time sharing system
sharing system

It is a part of Time sharing
systems
...


TUTORIALS POINT
Simply Easy Learning

It selects those processes
which are ready to
execute

Page 29

Context Switch
A context switch is the mechanism to store and restore the state or context of a CPU in Process
Control block so that a process execution can be resumed from the same point at a later time
...

Context switching is an essential part of a multitasking operating system features
...
The context of a process is represented in the process control
block of a process
...
Context switching can significantly
affect performance as modern computers have a lot of general and status registers to be saved
...
Context switch requires ( n
+ m ) bxK time units to save the state of the processor with n general registers, assuming b are
the store operations are required to save n and m registers of two process control blocks and
each store instruction requires K time units
...
When the process is switched, the following information is stored
...


W

e'll discuss four major scheduling algorithms here which are following



First Come First Serve (FCFS) Scheduling



Shortest-Job-First (SJF) Scheduling



Priority Scheduling



Round Robin(RR) Scheduling



Multilevel Queue Scheduling

TUTORIALS POINT
Simply Easy Learning

Page 31

First Come First Serve (FCFS)


Jobs are executed on first come, first serve basis
...




Poor in performance as average wait time is high
...
55

TUTORIALS POINT
Simply Easy Learning

Page 32

Shortest Job First (SJF)


Best approach to minimize waiting time
...


Wait time of each process is following

Process Wait Time : Service Time - Arrival Time
P0

3-0=3

P1

0-0=0

P2

16 - 2 = 14

P3

8-3=5

Average Wait Time: (3+0+14+5) / 4 = 5
...
Process with highest priority is to be executed first
and so on
...




Priority can be decided based on memory requirements, time requirements or any other
resource requirement
...
25

TUTORIALS POINT
Simply Easy Learning

Page 34

Round Robin Scheduling


Each process is provided a fix time to execute called quantum
...
Process is preempted and other
process executes for given time period
...


Wait time of each process is following

Process Wait Time : Service Time - Arrival Time
P0

(0-0) + (12-3) = 9

P1

(3-1) = 2

P2

6-2) + (15-9) = 10

P3

(9-3) + (18-12) = 12

Average Wait Time: (9+2+10+12) / 4 = 8
...




Each queue can have its own scheduling algorithms
...


TUTORIALS POINT
Simply Easy Learning

Page 36

8

CHAPTER

Operating System Multi-Threading
This section describes thread, types of threads and various thread models
...
A thread is also called a light weight process
...
Threads represent a software approach
to improving performance of operating system by reducing the overhead thread is equivalent to a
classical process
...
Each
thread represents a separate flow of control
...
They also provide a suitable foundation for
parallel execution of applications on shared memory multiprocessors
...


TUTORIALS POINT
Simply Easy Learning

Page 37

Difference between Process and Thread
S
...
Process

Thread

1

Process is heavy weight or resource Thread is light weight taking lesser resources
intensive
...


1

Process switching needs interaction with Thread switching does not need to interact
operating system
...


1

In multiple processing environments each
All threads can share same set of open files,
process executes the same code but has
child processes
...


1

If one process is blocked then no other
While one thread is blocked and waiting,
process can execute until the first
second thread in the same task can run
...


1

Multiple processes without using threads Multiple threaded
use more resources
...


1

In multiple processes each process One thread can read, write or change another
operates independently of the others
...


TUTORIALS POINT
Simply Easy Learning

processes

use

fewer

Page 38

Advantages of Thread


Thread minimizes context switching time
...




Efficient communication
...




Utilization of multiprocessor architectures to a greater scale and efficiency
...


User Level Threads
In this case, application manages thread management kernel is not aware of the existence of
threads
...
The application begins with a single thread and begins running in that
thread
...




User level thread can run on any operating system
...




User level threads are fast to create and manage
...




Multithreaded application cannot take advantage of multiprocessing
...
There is no thread management code in
the application area
...
Any
application can be programmed to be multithreaded
...

The Kernel maintains context information for the process as a whole and for individuals’ threads
within the process
...
The Kernel performs
thread creation, scheduling and management in Kernel space
...


Advantages


Kernel can simultaneously schedule multiple threads from the same process on multiple
processes
...




Kernel routines themselves can multithreaded
...




Transfer of control from one thread to another within same process requires a mode
switch to the Kernel
...

Solaris is a good example of this combined approach
...
Multithreading models are three types



Many to many relationship
...




One to one relationship
...
The number of Kernel threads may be specific to either a particular application or a
particular machine
...
In this model, developers can create as
many user threads as necessary and the corresponding Kernel threads can run in parallels on a
multiprocessor
...
Thread
management is done in user space
...
Only one thread can access the Kernel at a time, so multiple threads are
unable to run in parallel on multiprocessors
...


TUTORIALS POINT
Simply Easy Learning

Page 42

One to One Model
There is one to one relationship of user level thread to the kernel level thread
...
It also another thread to run when a
thread makes a blocking system call
...

Disadvantage of this model is that creating user thread requires the corresponding Kernel
thread
...


TUTORIALS POINT
Simply Easy Learning

Page 43

Difference between User Level & Kernel Level
Thread
S
...
User Level Threads

Kernel Level Thread

1

User level threads are faster to create Kernel level threads are slower to create and
and manage
...


2

Implementation is by a thread library at Operating system supports creation of Kernel
the user level
...


3

User level thread is generic and can run Kernel level thread is specific to the operating
on any operating system
...


4

Multi-threaded application cannot take Kernel
routines
advantage of multiprocessing
...


TUTORIALS POINT
Simply Easy Learning

themselves

can

be

Page 44

9

CHAPTER

Memory Management
This section describes memory management techniques, logical v/s actual address space
and various paging techniques
...
Memory management keeps track of each and every memory location either it
is allocated to some process or it is free
...
It decides which process will get memory at what time
...

Memory management provides protection by using two registers, a base register and a limit
register
...
For example, if the base register holds 300000 and the
limit register is 1209000, then the program can legally access all addresses from 300000 through
411999
...




Load time -- When it is not known at compile time where the process will reside in
memory, then the compiler generates re-locatable code
...
All
routines are kept on disk in a re-locatable load format
...
Other routines methods or modules are loaded on request
...


Dynamic Linking
Linking is the process of collecting and combining various modules of code and data into a
executable file that can be loaded into memory and executed
...
When it combines the libraries at load time, the linking is called static
linking and when this linking is done at the time of execution, it is called as dynamic linking
...


TUTORIALS POINT
Simply Easy Learning

Page 47

Logical versus Physical Address Space
An address generated by the CPU is a logical address whereas address actually available on
memory unit is a physical address
...

Virtual and physical addresses are the same in compile-time and load-time address-binding
schemes
...

The set of all logical addresses generated by a program is referred to as a logical address
space
...

The run-time mapping from virtual to physical address is done by the memory management unit
(MMU) which is a hardware device
...




The value in the base register is added to every address generated by a user process
which is treated as offset at the time it is sent to memory
...




The user program deals with virtual addresses; it never sees the real physical
addresses
...

Backing store is a usually a hard disk drive or any other secondary storage which fast in access
and large enough to accommodate copies of all memory images for all users
...

Major time consuming part of swapping is transfer time
...
Let us assume that the user process is of size 100KB and
the backing store is a standard hard disk with transfer rate of 1 MB per second
...




High Memory -- User processes then held in high memory
...


Memory
Allocation

Description

1

Single-partition
allocation

In this type of allocation, relocation-register scheme is used to protect
user processes from each other, and from changing operating-system
code and data
...

Each logical address must be less than the limit register
...
When a partition is free, a process is selected from the input
queue and is loaded into the free partition
...


S
...


TUTORIALS POINT
Simply Easy Learning

Page 50

Fragmentation
As processes are loaded and removed from memory, the free memory space is broken into little
pieces
...
This problem is known as
Fragmentation
...
N
...


2

Internal
fragmentation

Memory block assigned to process is bigger
...


External fragmentation can be reduced by compaction or shuffle memory contents to place all
free memory together in one large block
...


TUTORIALS POINT
Simply Easy Learning

Page 51

Paging
External fragmentation is avoided by using paging technique
...
When a process is to be executed, it's corresponding pages
are loaded into any available memory frames
...
Operating system keeps track of all free
frames
...

Address generated by CPU is divided into



Page number (p) -- page number is used as an index into a page table which contains
base address of each page in physical memory
...


TUTORIALS POINT
Simply Easy Learning

Page 52

Following figure show the paging table architecture
...
For example, data segments or code segment for each process,
data segment for operating system and so on
...

Unlike paging, segment is having varying sizes and thus eliminates internal fragmentation
...


TUTORIALS POINT
Simply Easy Learning

Page 53

Address generated by CPU is divided into



Segment number (s) -- segment number is used as an index into a segment table
which contains base address of each segment in physical memory and a limit of
segment
...


TUTORIALS POINT
Simply Easy Learning

Page 54

CHAPTER

10
Virtual Memory
This section describes concepts of virtual memory, demand paging and various page
replacement algorithms
...
The main visible advantage of this scheme is that programs can
be larger than physical memory
...

This separation allows an extremely large virtual memory to be provided for programmers when
only a smaller physical memory is available
...




User written error handling routines are used only when an error occured in the data or
computation
...




Many tables are assigned a fixed amount of address space even though only a small
amount of the table is actually used
...




Less number of I/O would be needed to load or swap each user program into memory
...




Each user program could take less physical memory, more programs could be run the
same time, with a corresponding increase in CPU utilization and throughput
...
It can also be implemented in a
segmentation system
...


TUTORIALS POINT
Simply Easy Learning

Page 56

Demand Paging
A demand paging system is quite similar to a paging system with swapping
...
Rather than swapping the entire process into
memory, however, we use a lazy swapper called pager
...
Instead of swapping in a whole process, the pager brings only
those necessary pages into memory
...

Hardware support is required to distinguish between those pages that are in memory and those
pages that are on the disk using the valid-invalid bit scheme
...
Marking a page will have no effect if the process never attempts
to access the page
...


Access to a page marked invalid causes a page-fault trap
...
But page fault can be handled
as following

TUTORIALS POINT
Simply Easy Learning

Page 57

Step

Description

Step 1

Check an internal table for this process, to determine whether the reference
was a valid or it was an invalid memory access
...
If it was valid, but page
have not yet brought in, page in the latter
...


Step 4

Schedule a disk operation to read the desired page into the newly allocated
frame
...


Step 6

Restart the instruction that was interrupted by the illegal address trap
...

Therefore, the operating system reads the desired page into memory and
restarts the process as though the page had always been in memory
...




More efficient use of memory
...
There is no limit on degree of multiprogramming
...




Due to the lack of explicit constraints on jobs address space size
...
Paging
happens whenever a page fault occurs and a free page cannot be used for allocation purpose
accounting to reason that pages are not available or the number of free pages is lower than
required pages
...
This process determines the quality
of the page replacement algorithm: the lesser the time waiting for page-ins, the better is the
algorithm
...
There are many different page replacement algorithms
...


Reference String
The string of memory references is called reference string
...

The latter choice produces a large number of data, where we note two things
...




If we have a reference to a page p, then any immediately following references to page p
will never cause a page fault
...




For example, consider the following sequence of addresses - 123,215,600,1234,76,96



If page size is 100 then the reference string is 1,2,6,12,0,0

TUTORIALS POINT
Simply Easy Learning

Page 60

First In First Out (FIFO) algorithm


Oldest page in main memory is the one which will be selected for replacement
...


Optimal Page algorithm


An optimal page-replacement algorithm has the lowest page-fault rate of all algorithms
...




Replace the page that will not be used for the longest period of time
...


TUTORIALS POINT
Simply Easy Learning

Page 61

Least Recently Used (LRU) algorithm


Page which has not been used for the longest time in main memory is the one which
will be selected for replacement
...


Page Buffering algorithm


To get process start quickly, keep a pool of free frames
...




Write new page in the frame of free pool, mark the page table and restart the process
...


Least frequently Used (LFU) algorithm


Page with the smallest count is the one which will be selected for replacement
...


Most frequently Used (LFU) algorithm


This algorithm is based on the argument that the page with the smallest count was
probably just brought in and has yet to be used
...


Overview

C

omputers operate on many kinds of devices
...
Other devices are more specialized
...

The device communicates with the machine via a connection point termed a port (for example, a
serial port)
...
In
other terms, a bus is a set of wires and a rigidly defined protocol that specifies a set of messages
that can be sent on the wires
...
It usually operates as a bus
...
A serial-port
controller is an example of a simple device controller
...

The SCSI bus controller is often implemented as a separate circuit board (a host adapter) that
plugs into the computer
...
Some devices have their own built-in controllers
...


S
...
Register & Description

1

Status Register
The status register contains bits that can be read by the host
...


2

Control register
The control register can be written by the host to start a command or to change the mode
of a device
...


3

Data-in register
The data-in register is read by the host to get input
...


TUTORIALS POINT
Simply Easy Learning

Page 64

Polling
Polling is a process by which a host waits for controller response
...
The
controller uses/sets the busy bit when it is busy working on a command, and clears the busy bit
when it is ready to accept the next command
...
The host sets the command-ready bit when a command is available
for the controller to execute
...




The host sets the write bit in the command register and writes a byte into the data-out
register
...




When the controller notices that the command-ready bit is set, it sets the busy bit
...




It reads the data-out register to get the byte, and does the I/O to the device
...


TUTORIALS POINT
Simply Easy Learning

Page 65

I/O devices
I/O Devices can be categorized into following category
...
N
...

Examples are printers, video display terminals, keyboard etc
...

Examples are disk and tape drives, sensors, controllers and actuators
...
Examples
are digital line drivers and modems
...
N
...


2

Application
Different devices have different use in the system
...


4

Unit of transfer
Data may be transferred as a stream of bytes or characters or in larger blocks
...


6

Error Conditions
The nature of errors differs widely from one device to another
...
This type of processor is called, a Direct Memory Access
(DMA) controller
...
This approach is
called Direct Memory Access (DMA)
...
DMA is particularly useful on devices
like disks, where many bytes of information can be transferred in single I/O operations
...
For each byte or word transferred, it must provide the memory address and all the
bus signals controlling the data transfer
...

Handshaking is a process between the DMA controller and the device controller
...


Step Description
1

Device driver is instructed to transfer disk data to a buffer address X
...


3

Disk controller starts DMA transfer
...


5

DMA controller transfers bytes to buffer, increases the memory address, decreases the
counter C until C becomes zero
...


TUTORIALS POINT
Simply Easy Learning

Page 68

Device Controllers
A computer system contains a many types of I/O devices and their respective controllers



network card



graphics adapter



disk controller



DVD-ROM controller



serial port



USB



sound card

TUTORIALS POINT
Simply Easy Learning

Page 69

CHAPTER

12
I/O Software
This section describes interrupts, application I/O interface, Kernel Subsystem and device
driver
...
When the CPU checks that a controller has put a signal on the
interrupt request line, the CPU saves a state, such as the current value of the instruction pointer,
and jumps to the interrupt handler routine at a fixed address
...

The basic mechanism of interrupt enables the CPU to respond to an asynchronous event, such
as when a device controller becomes ready for service
...




non-maskable interrupt - Such kind of interrupts are reserved for events like
unrecoverable memory errors
...


The interrupt mechanism accepts an address - a number that selects a specific interrupt
handling routine/function from a small set
...
This vector contains the memory addresses of
specialized interrupt handlers
...
The actual differences
lies kernel level modules called device drivers which are custom tailored to corresponding
devices but show one of the standard interfaces to applications
...
Following are the characteristics of I/O interfaces with respected to
devices
...




Sequential / random-access - A sequential device transfers data in a fixed order
determined by the device, random-access device can be instructed to seek position to
any of the available data storage locations
...




Sharable / dedicated - A sharable device can be used concurrently by several
processes or threads but a dedicated device cannot be used
...




Read-write, read only, or write only - Some devices perform both input and output,
but others support only one data direction that is read only
...
The clock software takes the form of a device driver though a clock
is neither a blocking device nor a character based device
...

The exact function of the clock driver may vary depending on operating system
...


S
...
Task

Description

1

Maintaining the time of the day

The clock driver implements the time of day or
the real time clock function
...


2

As a process is started, the scheduler
initializes the quantum counter in clock ticks
for the process
...
When the counter gets to zero,
long
clock driver calls the scheduler to set up
another process
...


3

Accounting for CPU usage

4

Watchdog timers are the timers set by certain
parts of the system
...


TUTORIALS POINT
Simply Easy Learning

Another function performed by clock driver is
doing CPU accounting
...


Page 72

Kernel I/O Subsystem
Kernel I/O Subsystems responsible to provide many services related to I/O
...




Scheduling - Kernel schedules a set of I/O requests to determine a good order in
which to execute them
...
The Kernel I/O scheduler rearranges the
order of the queue to improve the overall system efficiency and the average response
time experienced by the applications
...
Buffering is done to cope with a speed mismatch between the
producer and consumer of a data stream or to adapt between devices that have
different data transfer sizes
...
Access to the cached copy is more efficient than access to the original
...
The spooling system
copies the queued spool files to the printer one at a time
...
In other operating systems, it is
handled by an in kernel thread
...


TUTORIALS POINT
Simply Easy Learning

Page 73

Device driver
Device driver is a program or routine developed for an I/O device
...
For example a system supports one or a
number of multiple brands of terminals, all slightly different terminals may have a single terminal
driver
...
The job of a device driver is following
...




To see to it that the request is executed
...
If the driver is idle at the time a request arrives, it starts carrying out the request immediately
...


TUTORIALS POINT
Simply Easy Learning

Page 74

CHAPTER

13
File System
This section describes file, file types, file access mechanisms and space allocation
techniques
...
In general, a file is a sequence of bits,
bytes, lines or records whose meaning is defined by the files creator and user
...




A file has a certain defined structure according to its type
...




A source file is a sequence of procedures and functions
...




When operating system defines different file structures, it also contains the code to
support these file structure
...


TUTORIALS POINT
Simply Easy Learning

Page 75

File Type
File type refers to the ability of the operating system to distinguish different types of file such as
text files source files and binary files etc
...

Operating system like MS-DOS and UNIX has the following types of files:

Ordinary files


These are the files that contain user information
...




The user can apply various operations on such files like add, modify, delete or even
remove the entire file
...


Special files:


These files are also known as device files
...


These files are of two types



Character special files - data is handled character by character as in case of terminals
or printers
...


TUTORIALS POINT
Simply Easy Learning

Page 76

File Access Mechanisms
File access mechanism refers to the manner in which the records of a file may be accessed
...
e
...
This access method is the
most primitive one
...


Direct/Random access


Random access file organization provides, accessing the records directly
...




The records need not be in any sequence within the file and they need not be in
adjacent locations on the storage medium
...




An index is created for each file which contains pointers to various blocks
...


TUTORIALS POINT
Simply Easy Learning

Page 77

Space Allocation
Files are allocated disk spaces by operating system
...




Contiguous Allocation



Linked Allocation



Indexed Allocation

Contiguous Allocation


Each file occupies a contiguous address space on disk
...




Easy to implement
...


Linked Allocation


Each file carries a list of links to disk blocks
...




No external fragmentation



Effectively used in sequential access file
...


Indexed Allocation


Provides solutions to problems of contiguous and linked allocation
...




Each file has its own index block which stores the addresses of disk space occupied by
the file
...


TUTORIALS POINT
Simply Easy Learning

Page 78

CHAPTER

14
Operating System Security
This section describes various security related aspects like authentication, one time
password, threats and security classifications
...
If a computer program is run by unauthorized user then he/she may cause severe
damage to computer or data stored in it
...
We're going to
discuss following topics in this article
...
It is the responsibility of the Operating System to create a protection
system which ensures that a user who is running a particular program is authentic
...




User card/key - User need to punch card in card slot, or enter key generated by key
generator in option provided by operating system to login into the system
...


TUTORIALS POINT
Simply Easy Learning

Page 80

One Time passwords
One time passwords provides additional security along with normal authentication
...

Once a one-time password is used then it cannot be used again
...




Random numbers - Users are provided cards having numbers printed along with
corresponding alphabets
...




Secret key - User are provided a hardware device which can create a secret id mapped
with user id
...




Network password - Some commercial applications send one time password to user
on registered mobile/ email which is required to be entered prior to login
...
If a user program
made these process do malicious tasks then it is known as Program Threats
...
Following is the list of some well-known
program threats
...




Trap Door - If a program which is designed to work as required, have a security hole in
its code and perform illegal action without knowledge of user then it is called to have a
trap door
...
It is harder to detect
...
They are
highly dangerous and can modify/delete user files, crash systems
...
As user accesses the program, the virus starts
getting embedded in other files/ programs and can make system unusable for user
...
System threats can be used to launch program threats on a complete network called as
program attack
...
Following is the list of some well-known system threats
...
A Worm process generates its multiple copies
where each copy uses system resources, prevents all other processes to get required
resources
...




Port Scanning - Port scanning is a mechanism or means by which a hacker can
detects system vulnerabilities to make an attack on the system
...
For example user may not be able to use internet if denial of service
attacks browser's content settings
...
S
...
This is widely used
specifications to determine and model the security of systems and of security solutions
...


S
...


Classification
Type

Description

1

Type A

Highest Level
...
Grants a high degree of assurance of process security
...
Have all the properties of a
class C2 system
...
It is of three
types
...




2

B1 - Maintains the security label of each object in the system
...


B3 - Allows creating lists or user groups for access-control to
grant access or revoke access to a given named object
...
It is
of two types
...
UNIX versions are mostly Cl
class
...
Minimum protection
...
1 fall in this
category
...


L

inux is one of popular version of UNIX operating System
...
It is free to use
...
Its
functionality list is quite similar to that of UNIX
...
It is responsible for all major activities of this
operating system
...
Kernel provides the required abstraction to hide low level
hardware details to system or application programs
...
These libraries
implements most of the functionalities of the operating system and do not requires
kernel module's code access rights
...


TUTORIALS POINT
Simply Easy Learning

Page 86

Kernel Mode v/s User Mode
Kernel component code executes in a special privileged mode called kernel mode with full
access to all resources of the computer
...

Kernel runs each process and provides system services to processes, provides protected access
to hardware to processes
...
User programs
and other system programs works in User Mode which has no access to system hardware and
kernel code
...


TUTORIALS POINT
Simply Easy Learning

Page 87

Basic Features
Following are some of the important features of Linux Operating System
...
Linux kernel and application programs support their installation on any kind of
hardware platform
...
Multiple teams works in collaboration to enhance the capability of
Linux operating system and it is continuously evolving
...




Multiprogramming - Linux is a multiprogramming system means multiple applications
can run at same time
...




Shell - Linux provides a special interpreter program which can be used to execute
commands of the operating system
...




Security - Linux provides user security using authentication features like password
protection/ controlled access to specific files/ encryption of data
...




Kernel - Core component of Operating System, interacts directly with hardware,
provides low level services to upper layer components
...
Takes
commands from user and executes kernel's functions
...


TUTORIALS POINT
Simply Easy Learning

Page 89

APPENDIX

A
About tutorialspoint
...

Tutorials Point is aiming to provide the Best Training Materials on highly demanding
technical and managerial subjects like:



























Python
Ruby
HTML5
CSS
JavaScript and related frameworks
Ruby on Rails
JAVA and related technologies
PMP Exams
Earned Value Management
Six Sigma
Parrot
AJAX
PHP Programming
HTML and XHTML
CGI and Perl
C Programming
C++ Programming
XML-RPC
SOAP Communication
HTTP Protocol
Unix Makefile
Web Services
WSDL and UDDI
Wi-Fi and WiMAX
Many more
...
If you think it is
worth to visit this website, kindly share it with your friends and colleagues
...
com
Thanks for visiting us
Title: Operating system
Description: Operating system, it's working, types of operating system