DCA6201 Operating System (All Units) PDF
DCA6201 Operating System (All Units) PDF
DCA6201 Operating System (All Units) PDF
OPERATING SYSTEM(DCA6201)
CONTENT
Structure:
3.1 Introduction (Page : 33)
Objectives (Page : 34)
3.2 Process State (Page : 34)
3.3 Process Control Block (Page : 35)
3.4 Process Scheduling (Page : 36)
3.5 Operation on Processes (Page : 41)
3.6 Co-operating Processes (Page : 43)
3.7 Threads (Page : 44)
3.8 Summary (Page : 48)
3.9 Terminal Questions (Page : 48)
3.10 Answers (Page : 49)
Structure:
4.1 Introduction (Page : 51)
Objectives (Page : 51)
4.2 Basic Concepts of Scheduling (Page : 51)
4.3 Scheduling Algorithms (Page : 55)
4.4 Evaluation of CPU Scheduling Algorithms (Page : 66)
4.5 Summary (Page : 70)
4.6 Terminal Questions (Page : 70)
4.7 Answers (Page : 71)
Structure:
5.1 Introduction (Page : 72)
Objectives (Page : 72)
5.2 Interprocess Communication (Page : 73)
5.3 The Critical-Section Problem (Page : 80)
5.4 Semaphores (Page : 86)
5.5 Monitors (Page : 87)
5.6 Hardware Assistance (Page : 88)
5.7 Summary (Page : 89)
5.8 Terminal Questions (Page : 90)
5.9 Answers (Page : 90)
Unit 6 Deadlocks (Page : 92-113)
Structure:
6.1 Introduction (page : 92)
Objectives (Page : 93)
6.2 System Model (Page : 93)
6.3 Deadlock Characterization (Page : 94)
Necessary conditions for deadlock (Page : 94)
Resource-allocation graph (Page : 94)
6.4 Deadlock Handling (Page : 97)
6.5 Deadlock Prevention (Page : 98)
6.6 Deadlock Avoidance (Page : 100)
Safe state (Page : 100)
Resource-allocation graph algorithm (Page : 102)
Banker’s algorithm (Page : 104)
6.7 Deadlock Detection (Page : 107)
Single instance of a resource (Page : 107)
Multiple instances of a resource (Page : 108)
Recovery from deadlock (Page : 110)
6.8 Summary (Page : 112)
6.9 Terminal Questions (Page : 112)
6.10 Answers (Page : 112)
Structure:
7.1 Introduction (Page : 114)
Objectives (Page : 115)
7.2 Logical vs. Physical Address Space (Page : 115)
7.3 Swapping (Page : 116)
7.4 Contiguous Allocation (Page : 117)
Single partition allocation (Page : 118)
Multiple partition allocation (Page : 119)
Fragmentation (Page : 121)
7.5 Paging (Page : 122)
Concept of paging (Page : 123)
Page table implementation (Page : 126)
7.6 Segmentation (Page : 127)
Concept of segmentation (Page : 128)
Segmentation hardware (Page : 128)
External fragmentation (Page : 130)
7.7 Summary (Page : 131)
7.8 Terminal Questions (Page : 131)
7.9 Answers (Page : 132)
Structure:
8.1 Introduction (Page : 134)
Objectives (Page : 135)
8.2 Need for Virtual Memory Technique (Page : 135)
8.3 Demand Paging (Page : 136)
8.4 Concept of Page Replacement (Page : 139)
8.5 Page Replacement Algorithms (Page : 141)
FIFO page replacement algorithm (Page : 141)
Optimal algorithm (Page : 143)
LRU page replacement algorithm (Page : 143)
8.6 Thrashing (Page : 145)
Causes for thrashing (Page : 145)
Working set model (Page : 146)
Page fault frequency (Page : 147)
8.7 Summary (Page : 148)
8.8 Terminal Questions (Page : 148)
8.9 Answers (Page : 148)
Structure:
9.1 Introduction (Page : 151)
Objectives (Page : 151)
9.2 Concept of a File (Page : 151)
Attributes of a file (Page : 152)
Operations on files (Page : 152)
Types of files (Page : 153)
Structure of file (Page : 154)
9.3 File Access Methods (Page : 155)
Sequential access (Page : 155)
Direct access (Page : 156)
Indexed sequential access (Page : 156)
9.4 Directory Structure (Page : 156)
Single-level directory (Page : 157)
Two-level directory (Page : 157)
Tree-structured directories (Page : 158)
9.5 Allocation Methods (Page : 160)
Contiguous allocation (Page : 160)
Linked allocation (Page : 161)
Indexed allocation (Page : 163)
Performance comparison (Page : 164)
9.6 Free Space Management (Page : 165)
Bit vector (Page : 165)
Linked list (Page : 165)
Grouping (Page : 166)
Counting (Page : 166)
9.7 Directory Implementation (Page : 166)
Linear list (Page : 166)
Hash table (Page : 167)
9.8 Summary (Page : 168)
9.9 Terminal Questions (Page : 168)
9.10 Answers (Page : 168)
Structure:
10.1 Introduction (Page : 169)
Objectives (Page : 170)
10.2 I/O Structure (Page : 170)
10.3 I/O Control Strategies (Page : 172)
Program-controlled I/O (Page : 173)
Interrupt-controlled I/O (Page : 175)
Direct memory access (Page : 176)
10.4 The I/O Address Space (Page : 181)
10.5 Summary (Page : 182)
10.6 Terminal Questions (Page : 182)
10.7 Answers (Page : 183)
Structure:
11.1 Introduction (Page : 184)
Objectives (Page : 184)
11.2 Centralized and Distributed Processing (Page : 184)
11.3 Network Operating System (NOS) Architecture (Page : 188)
11.4 Functions of NOS (Page : 191)
11.5 Global Operating System (GOS) (Page : 193)
11.6 Remote Procedure Call (RPC) (Page : 196)
11.7 Distributed File Management (Page : 199)
11.8 Summary (Page : 200)
11.9 Terminal Questions (Page : 200)
11.10 Answers (Page : 201)
Structure:
12.1 Introduction (Page : 202)
Objectives (Page : 202)
12.2 Attacks on Security (Page : 203)
12.3 Computer Worms (Page : 205)
12.4 Computer Virus (Page : 206)
12.5 Security Design Principles (Page : 208)
12.6 Authentication (Page : 208)
12.7 Protection Mechanism (Page : 209)
12.8 Encryption (Page : 212)
12.9 Security in Distributed Environment (Page : 214)
12.10 Summary (Page : 217)
12.11 Terminal Questions (Page : 217)
12.12 Answers (Page : 217)
***
Operating Systems Unit 1
1.1 Introduction
Dear student, you know that software is a collection of programs. The
computer software can be divided into two main categories: application
software and system software. Application software consists of the
programs for performing tasks particular to the machine's utilization.
Examples of application software include spreadsheets, database systems,
desktop publishing systems, program development software and games.
Application software is generally what we think of when someone speaks of
computer programs. This software is designed to solve a particular problem
for users.
On the other hand, system software is more transparent and less noticed by
the typical computer user. This software provides a general programming
environment in which programmers can create specific applications to suit
their needs. This environment provides new functions that are not available
at the hardware level and performs tasks related to executing the application
program. System software acts as an interface between the hardware of the
computer and the application software that users need to run on the
computer. The most important type of system software is the operating
system.
Objectives:
After studying this unit, you should be able to:
define and describe the functions of operating system
explain the evolution of operating systems
discuss the operating system structures
from one job to another. The operating system was resident in memory
(Figure 1.1).
Operating
system
User
area
To speed up processing, jobs with the same needs were batched together
and executed as a group. For example, all FORTRAN jobs were batched
together for execution; all COBOL jobs were batched together for execution
and so on. Thus batch operating systems came into existence.
Even though processing speed increased to a large extent because of batch
processing, the CPU was often idle. This is because of the disparity
between operating speeds of electronic devices like the CPU and the
mechanical I/O devices. CPU operates in the microsecond / nanosecond
ranges whereas I/O devices work in the second / minute range. To
overcome this problem the concept of SPOOLING came into picture.
Instead of reading from slow input devices like card readers into the
computer memory and then processing the job, the input is first read into the
disk. When the job is processed or executed, the input is read directly from
the disk. Similarly when a job is executed for printing, the output is written
into a buffer on the disk and actually printed later. This form of processing is
known as spooling an acronym for Simultaneous Peripheral Operation On
Line. Spooling uses the disk as a large buffer to read ahead as possible on
input devices and for storing output until output devices are available to
accept them.
Spooling overlaps I/O of one job with the computation of other jobs. For
example, spooler may be reading the input of one job while printing the
output of another and executing a third job (Figure 1.2).
Disk
I/O
several ready jobs in memory for execution by the CPU is called CPU
scheduling.
Operating
system
Job 1
Job 2
User area
Job 3
User area
Job 4
User area
Fig. 1.3: Memory layout for multi-programmed system
User area
1.3.3 Time-sharing Operating Systems
Multi-programmed batch systems are suited for executing large jobs that
need very little or no user interaction. On the other hand interactive jobs
need on-line communication between the user and the system. Time-
sharing / multi tasking is a logical extension of multi-programming. It
provides interactive use of the system.
CPU scheduling and multi-programming provide each user one time slice
(slot) in a time-shared system. A program in execution is referred to as a
process. A process executes for one time slice at a time. A process may
need more than one time slice to complete. During a time slice a process
may finish execution or go for an I/O. The I/O in this case is usually
interactive like a user response from the keyboard or a display on the
monitor. The CPU switches between processes at the end of a time slice.
The switching between processes is so fast that the user gets the illusion
that the CPU is executing only one user’s process.
Time-sharing operating systems are more complex than multi-programmed
operating systems. This is because in multi-programming several jobs must
be kept simultaneously in memory, which requires some form of memory
management and protection. Jobs may have to be swapped in and out of
main memory to the secondary memory. To achieve this goal a technique
called virtual memory is used.
The several areas in which this type is useful are multimedia, virtual reality
and advance scientific projects such as exploration and planetary rovers.
Because of the expanded uses for soft real-time functionality, it is finding its
way into most current operating systems, including major versions of Unix
and Windows NT OS.
Self Assessment Questions
1. Operating System is a System Software which provides an environment
to help the user to execute the programs. (True / False)
2. A form of processing known as spooling is an acronym for __________..
3. Disk Operating System (DOS) is an example for __________.
a) PC OS
b) Multi-processor OS
c) Distributed OS
d) Real Time OS
Typically, the bottom layer is concerned with machine hardware and the top
layer is concerned with users (Or operators).
The layered approach has all the advantages of modular design. In modular
design, the system is divided into several modules and each module is
designed independently. Likewise in layered approach each layer can be
designed, coded and tested independently. Consequently the layered
approach considerably simplifies the design, specification and
implementation of an operating system. However, a drawback of the layered
approach is that operating system functions must be carefully assigned to
various layers because a layer can make use only of the functionality
provided by the layer beneath it.
A classic example of the layered approach is the THE operating system,
which consists of six layers. Figure 1.4 shows these layers with their
associated functions.
1.5 Summary
Let’s summarize the important points you learnt in this unit:
An operating system is a collection of programs that is an intermediary
between a user and the computer hardware.
It performs various functions such as process management, input output
management, file management, managing use of main memory,
providing security to user jobs and files etc.
In simple batch operating system, to speed up processing, jobs with the
same needs were batched together and executed as a group.
The primary objective of a multi-programmed operating system is to
maximize the number of programs executed by a computer in a specified
period and keep all the units of the computer simultaneously busy.
A time shared operating system allows a number of users to
simultaneously use a computer. The primary objective of a time shared
operating system is to provide fast response to each user of the
computer.
The primary objective of Parallel System is to increase the throughput by
getting done more jobs in less time.
A real time system is used in the control of physical systems. The
response time of such system should match the needs of the physical
system.
Since an operating system is large, modularity is important. The design of
system as sequence of layers is considered first.
The virtual machine concept takes the layered approach to heart and
treats the kernel of the operating system and hardware as though they
were all hardware.
1.7 Answers
Self Assessment Questions
1. True
2. Simultaneous Peripheral Operation On Line
3. a
4. False
5. Dijkstra
6. b
Terminal Questions
1. Processor Management, Memory Management, Input Output
Management, File System Management are some of the functions
performed by Operating System. (Refer Section 1.2)
2. Operating systems have evolved over a period of time, starting from the
very primitive systems to the present day complex and versatile ones. It
all started with Batch OS and Multi-programmed Batch OS. Today we
have Distributed OS and Real Time OS. (Refer Section 1.3)
3. There are different approaches to OS structures. Layered Approach,
Kernel Based Approach and Virtual Machine Approach are some of them.
(Refer Section 1.4)
2.1 Introduction
In the previous unit, you studied about an overview of Operating System. In
this unit, let us explore various operating system approaches.
A system as large and complex as a modern operating system must be
engineered carefully if it is to function properly and be modified easily. A
common approach is to partition the task into small component rather than
have one monolithic system. Each of these modules should be a well-
defined portion of the system, with carefully defined inputs, outputs, and
functions. In this unit, we discuss how various components of an operating
system are interconnected and melded into a kernel.
Objectives:
After studying this unit, you should be able to:
explain what is kernel and monolithic kernel architecture
describe the layered architecture of the operating system
discuss the microkernel architecture of the operating system
list the operating system components
explain operating system services
User User
Application Program
Operating System
Hard-
ware
As shown in above figure 2.1, the operating system interacts with the
hardware hiding it from the application program, and user. Thus it acts as
interface between user programs and hardware.
You know that many commercial systems do not have well-defined
structures. Frequently, such operating systems started as small, simple, and
limited systems and then grew beyond their original scope. MS-DOS is an
example of such a system. It was originally designed and implemented by a
few people who had no idea that it would become so popular. It was written
to provide the most functionality in the least space, so it was not divided into
modules carefully. In MS-DOS, the interfaces and levels of functionality are
not well separated. For instance, application programs are able to access
the basic I/O routines to write directly to the display and disk drives. Such
greater control over the computer and over the applications that make use
of that computer. Implementers have more freedom in changing the inner
workings of the system and in creating modular operating systems. Under
the top-down approach, the overall functionality and features are determined
and the separated into components. Information hiding is also important,
because it leaves programmers free to implement the low-level routines as
they see fit, provided that the external interface of the routine stays
unchanged and that the routine itself performs the advertised task.
A system can be made modular in many ways. One method is the layered
approach, in which the operating system is broken up into a number of
layers (levels). The bottom layer (layer 0) id the hardware; the highest (layer
N) is the user interface. Figure 2.2 represents the layer architecture of the
operating system.
Users
File Systems
Inter-process Communication
I/O and Device Management
Virtual Memory
Primitive Process Management
Hardware
Fig. 2.2: Layered Architecture
while the second layer is debugged, and so on. If an error is found during
debugging of a particular layer, the error must be on that layer, because the
layers below it are already debugged. Thus, the design and implementation
of the system is simplified.
Each layer is implemented with only those operations provided by lower-
level layers. A layer does not need to know how these operations are
implemented; it needs to know only what these operations do. Hence, each
layer hides the existence of certain data structures, operations, and
hardware from higher-level layers. The major difficulty with the layered
approach involves appropriately defining the various layers. Because layer
can use only lower-level layers, careful planning is necessary. For example,
the device driver for the backing store (disk space used by virtual-memory
algorithms) must be at a lower level than the memory-management routines,
because memory management requires the ability to use the backing store.
Other requirement may not be so obvious. The backing-store driver would
normally be above the CPU scheduler, because the driver may need to wait
for I/O and the CPU can be rescheduled during this time. However, on a
larger system, the CPU scheduler may have more information about all the
active processes than can fit in memory. Therefore, this information may
need to be swapped in and out of memory, requiring the backing-store
driver routine to be below the CPU scheduler.
A final problem with layered implementations is that they tend to be less
efficient than other types. For instance, when a user program executes an
I/O operation, it executes a system call that is trapped to the I/O layer, which
calls the memory-management layer, which in turn calls the CPU-scheduling
layer, which is then passed to the hardware. At each layer, the parameters
may be modified; data may need to be passed, and so on. Each layer adds
overhead to the system call; the net result is a system call that takes longer
than does one on a non-layered system. These limitations have caused a
small backlash against layering in recent years. Fewer layers with more
functionality are being designed, providing most of the advantages of
modularized code while avoiding the difficult problems of layer definition and
interaction.
2.4 Micro-Kernels
We have already seen that as UNIX expanded, the kernel became large and
difficult to manage. In the mid-1980s, researches at Carnegie Mellon
University developed an operating system called Mach that modularized the
kernel using the microkernel approach. This method structures the operating
system by removing all nonessential components from the kernel and
implementing then as system and user-level programs. The result is a
smaller kernel. There is little consensus regarding which services should
remain in the kernel and which should be implemented in user space.
Typically, however, micro-kernels provide minimal process and memory
management, in addition to a communication facility. Figure 2.3 shows the
microkernel architecture of the operating system.
Microkernel
Hardware
smaller kernel. The resulting operating system is easier to port from one
hardware design to another. The microkernel also provided more security
and reliability, since most services are running as user – rather than kernel –
processes, if a service fails the rest of the operating system remains
untouched.
Several contemporary operating systems have used the microkernel
approach. Tru64 UNIX (formerly Digital UNIX provides a UNIX interface to
the user, but it is implemented with a March kernel. The March kernel maps
UNIX system calls into messages to the appropriate user-level services.
The following figure shows the UNIX operating system architecture. At the
center is hardware, covered by kernel. Above that are the UNIX utilities, and
command interface, such as shell (sh), etc. Figure 2.4 represents the UNIX
architecture.
2.6 Modules
Perhaps the best current methodology for operating-system design involves
using object-oriented programming techniques to create a modular kernel.
Here, the kernel has a set of core components and dynamically links in
additional services either during boot time or during run time. Such a
strategy uses dynamically loadable modules and is common in modern
implementations of UNIX, such as Solaris, Linux and MacOS. For example,
the Solaris operating system structure is organized around a core kernel
with seven types of loadable kernel modules:
1. Scheduling classes
2. File systems
3. Loadable system calls
4. Executable formats
5. STREAMS formats
6. Miscellaneous
7. Device and bus drivers
Such a design allow the kernel to provide core services yet also allows
certain features to be implemented dynamically. For example device and
bus drivers for specific hardware can be added to the kernel, and support for
different file systems can be added as loadable modules. The overall result
resembles a layered system in that each kernel section has defined,
protected interfaces; but it is more flexible than a layered system in that any
module can call any other module. Furthermore, the approach is like the
microkernel approach in that the primary module has only core functions
and knowledge of how to load and communicate with other modules; but it is
more efficient, because modules do not need to invoke message passing in
order to communicate.
can create the illusion that a process has its own processor with its own
(virtual) memory. Normally a process has additional features, such as
system calls and a file system, which are not provided by the hardware. The
Virtual machine approach does not provide any such additional functionality
but rather an interface that is identical to the underlying bare hardware.
Each process is provided with a (virtual) copy of the underlying computer.
Hardware Virtual Machine
The original meaning of virtual machine, sometimes called a hardware
virtual machine, is that of a number of discrete identical execution
environments on a single computer, each of which runs an operating system
(OS). This can allow applications written for one OS to be executed on a
machine which runs a different OS, or provide execution "sandboxes" which
provide a greater level of isolation between processes than is achieved
when running multiple processes on the same instance of an OS. One use
is to provide multiple users the illusion of having an entire computer, one
that is their "private" machine, isolated from other users, all on a single
physical machine. Another advantage is that booting and restarting a virtual
machine can be much faster than with a physical machine, since it may be
possible to skip tasks such as hardware initialization.
Such software is now often referred to with the terms virtualization and
virtual servers. The host software which provides this capability is often
referred to as a virtual machine monitor or hypervisor.
Software virtualization can be done in three major ways:
Emulation, full system simulation, or "full virtualization with dynamic
recompilation"– the virtual machine simulates the complete hardware,
allowing an unmodified OS for a completely different CPU to be run.
Para-virtualization – the virtual machine does not simulate hardware but
instead offers a special API that requires OS modifications. An example
of this is XenSource's XenEnterprise (www.xensource.com)
Native virtualization and "full virtualization"– the virtual machine only
partially simulates enough hardware to allow an unmodified OS to be
run in isolation, but the guest OS must be designed for the same type of
CPU. The term native virtualization is also sometimes used to designate
that hardware assistance through Virtualization Technology is used.
PVM (Parallel Virtual Machine) and MPI (Message Passing Interface) are
two common software packages that permit a heterogeneous collection of
networked UNIX and/or Windows computers to be used as a single, large,
parallel computer. Thus large computational problems can be solved more
cost effectively by using the aggregate power and memory of many
computers than with a traditional supercomputer. The Plan9 Operating
System from Bell Labs uses this approach.
Boston Circuits had released the gCore (grid-on-chip) Central Processing
Unit (CPU) with 16 ARC 750D cores and a Time-machine hardware module
to provide a virtual machine that uses this approach.
2.10 Summary
Let’s summarize the important points:
The virtual machine concept has several advantages. In this
environment, there is complete protection of the various system
resources. Each virtual machine is completely isolated from all other
virtual machines, so there are no protection problems. At the same time,
however, there is no direct sharing of resources. Two approaches to
provide sharing have been implemented. A virtual machine is a perfect
vehicle for operating systems research and development.
Operating system as extended machine acts as interface between
hardware and user application programs. The kernel is the essential
center of a computer operating system, i.e. the core that provides basic
services for all other parts of the operating system. It includes interrupts
handler, scheduler, operating system address space manager, etc.
In the layered type architecture of operating systems, the components of
kernel are built as layers on one another, and each layer can interact
with its neighbor through interface. Whereas in micro-kernel architecture,
most of these components are not part of kernel but acts as another
layer to the kernel, and the kernel comprises of essential and basic
components.
2.12 Answers
Self Assessment Questions
1. True
2. MS-DOS
3. a
4. False
5. Hardware, User Interface
6. b
7. True
8. Process Control
9. c
10. True
11. Parallel Virtual Machine (PVM), Message Passing Interface (MPI)
12. d
Terminal Questions
1. The operating system interacts with the hardware hiding it from the
application program, and user. Thus it acts as interface between user
programs and hardware. (Refer Section 2.2)
2. In the UNIX OS, everything below the system call interface and above
the physical hardware is the kernel. The kernel provides the file system,
CPU scheduling, memory management, and other operating-system
functions through system calls. (Refer Section 2.3)
3. The micro-kernel approach structures the operating system by removing
all nonessential components from the kernel and implementing them as
system and user-level programs. The result is a smaller kernel.
Typically, however, micro-kernels provide minimal process and memory
management, in addition to a communication facility. (Refer Section 2.4)
4. The UNIX kernel mode has four major components: system calls, file
subsystem, process control subsystem, and hardware control. (Refer
Section 2.5)
5. A virtual environment (otherwise referred to as virtual private server) is
another kind of virtual machine. It is a virtualized environment for running
user-level programs. Virtual environments are created using the software
implementing operating system-level virtualization approach. (Refer
Section 2.8)
3.1 Introduction
Dear student, in the last unit you have studied the various architecture of the
operating systems. In this unit you are going to study about process
management. Current day computer system allows multiple programs to be
loaded into memory and to be executed concurrently. This evolution
requires more coordination and firmer control of the various programs.
These needs resulted in the notion of a process. A Process can be simply
defined as a program in execution. A process is created and terminated,
and it allows some or all of the states of process transition; such as New,
Ready, Running, Waiting and Exit.
Thread is single sequence stream which allows a program to split itself into
two or more simultaneously running tasks. Threads and processes differ
from one operating system to another but in general, a thread is contained
inside a process and different threads in the same process share some
resources while different processes do not. An operating system that has
thread facility, the basic unit of CPU utilization, is a thread. A thread has or
consists of a program counter (PC), a register set, and a stack space.
Threads are not independent of one other like processes as a result threads
share with other threads their code section, data section, OS resources
also known as task, such as open files and signals.
Objectives:
After studying this unit, you should be able to:
explain the process state
describe the process control block
discuss process scheduling
explain operations on processes and cooperating processes
describe threads in operating systems
Terminated
New
Waiting
other processes need to wait till they get the CPU for execution on being
scheduled.
As a process enters the system, it joins a job queue that is a list of all
processes in the system. Some of these processes are in the ready state
and are waiting for the CPU for execution. These processes are present in a
ready queue. The ready queue is nothing but a list of PCB’s implemented as
a linked list with each PCB pointing to the next.
There are also some processes that are waiting for some I/O operation like
reading from a file on the disk or writing onto a printer. Such processes are
present in device queues. Each device has its own queue.
A new process first joins the ready queue. When it gets scheduled, the CPU
executes the process until-
1) An I/O occurs and the process gives up the CPU to join a device queue
only to rejoin the ready queue after being serviced for the I/O.
2) It gives up the CPU on expiry of its time slice and rejoins the ready
queue.
Every process is in this cycle until it terminates (Figure 3.3). Once a process
terminates, entries for this process in all the queues are deleted. The PCB
and resources allocated to it are released.
Schedulers
At any given instant of time, a process is in any one of the new, ready,
running, waiting or terminated state. Also a process moves from one state to
another as long as it is active. The operating system scheduler schedules
processes from the ready queue for execution by the CPU. The scheduler
selects one of the many processes from the ready queue based on certain
criteria.
Schedulers could be any one of the following:
Long-term scheduler
Short-term scheduler
Medium-term scheduler
Many jobs could be ready for execution at the same time. Out of these more
than one could be spooled onto the disk. The long-term scheduler or job
scheduler as it is called picks and loads processes into memory from among
the set of ready jobs. The short-term scheduler or CPU scheduler selects a
process from among the ready processes to execute on the CPU.
The long-term scheduler and short-term scheduler differ in the frequency of
their execution. A short-term scheduler has to select a new process for CPU
execution quite often as processes execute for short intervals before waiting
for I/O requests. Hence, short-term scheduler must be very fast or else, the
CPU will be doing only scheduling work.
A long-term scheduler executes less frequently since new processes are
not created at the same pace at which processes need to be executed. The
number of processes present in the ready queue determines the degree of
multi-programming. So the long-term scheduler determines this degree of
multi-programming. If a good selection is made by the long-term scheduler
in choosing new jobs to join the ready queue, then the average rate of
process creation must almost equal the average rate of processes leaving
the system. The long-term scheduler is thus involved only when processes
leave the system to bring in a new process so as to maintain the degree of
multi-programming.
Choosing one job from a set of ready jobs to join the ready queue needs
careful selection. Most of the processes can be classified as either I/O
bound or CPU bound depending on the time spent for I/O and time spent for
CPU execution. I/O bound processes are those which spend more time
executing I/O whereas CPU bound processes are those which require more
CPU time for execution. A good selection of jobs by the long-term scheduler
will give a good mix of both CPU bound and I/O bound processes. In this
case, the CPU as well as the I/O devices will be busy. If this is not to be so,
then either the CPU is busy or I/O devices are idle or vice-versa. Time
sharing systems usually do not require the services of a long-term scheduler
since every ready process gets one time slice of CPU time at a time in
rotation.
Sometimes processes keep switching between ready, running and waiting
states with termination taking a long time. One of the reasons for this could
be an increased degree of multi-programming meaning more number of
ready processes than the system can handle. The medium-term scheduler
(Figure 3.4) handles such a situation. When system throughput falls below a
threshold, some of the ready processes are swapped out of memory to
reduce the degree of multi-programming. Sometime later these swapped
processes are reintroduced into memory to join the ready queue.
Context Switch
CPU switching from one process to another requires saving the state of the
current process and loading the latest state of the next process. This is
known as a Context Switch (Figure 3.5). Time that is required for a context
switch is a clear overhead since the system at that instant of time is not
doing any useful work. Context switch time varies from machine to machine
depending on speed, the amount of saving and loading to be done,
hardware support and so on.
Executing
Interrupt
Executing
3.7 Threads
Thread is a single sequence stream which allows a program to split itself
into two or more simultaneously running tasks. It is a basic unit of CPU
utilization, and consists of a program counter, a register set and a stack
space. Because threads have some of the properties of processes, they are
sometimes called lightweight processes. In a process, threads allow multiple
executions of streams. Threads are not independent of one other like
processes. As a result threads shares with other threads their code section,
data section, OS resources also known as task, such as open files and
signals.
Some of the similarities between processes and Threads are as follows.
Like processes threads share CPU and only one thread is running at a
time.
Like processes, threads within processes execute sequentially.
Like processes, thread can create children.
And like process if one thread is blocked, another thread can run.
Some of the differences between processes and Threads are as follows.
Unlike processes, threads are not independent of one another.
Unlike processes, all threads can access every address in the task.
Unlike processes, threads are designed to assist one other. (processes
might or might not assist one another because processes may originate
from different users.)
Following are some reasons why we use threads in designing operating
systems.
1) A process with multiple threads makes a great server. For example
printer server.
2) Because threads can share common data, they do not need to use
interprocess communication.
3) Because of the very nature, threads can take advantage of
multiprocessors.
Threads are cheap in the sense that:
1) They only need a stack and storage for registers. Therefore, threads are
cheap to create.
Advantages:
Here are some of the advantages of KLTs:
Because kernel has full knowledge of all threads, Scheduler may decide
to give more time to a process having large number of threads than
process having small number of threads.
Kernel-level threads are especially good for applications that frequently
block.
kernel routines can be multi-threaded
Disadvantages:
The disadvantages of KLTs are as follows:
The kernel-level threads are slow and inefficient. For instance, threads
operations are hundreds of times slower than that of user-level threads.
Since kernel must manage and schedule threads as well as processes.
It requires a full thread control block (TCB) for each thread to maintain
information about threads. As a result, there is significant overhead and
increase in kernel complexity.
Combined ULT/KLT Approaches:
Here the idea is to combine the best of both approaches
Solaris is an example of an OS that combines both ULT and KLT
Here are the features of combined ULT/KLT approaches:
Thread creation done in the user space
Bulk of scheduling and synchronization of threads done in the user
space
The programmer may adjust the number of KLTs
Process includes the user's address space, stack, and process control
block
User-level threads (threads library) invisible to the OS are the interface
for application parallelism
Kernel threads the unit that can be dispatched on a processor
Lightweight processes (LWP) each LWP supports one or more ULTs
and maps to exactly one KLT
Self Assessment Questions
10. Thread is a single sequence stream which allows a program to split
itself into two or more simultaneously running tasks. (True / False)
3.8 Summary
Dear student, let’s summarize the important concepts:
A process is a program in execution. As process executes, it changes it
state. Each process may be in one of the following states: New, Ready,
Running, Waiting, or Halted.
The process in the system can execute concurrently. There are several
reasons for allowing concurrent execution; information sharing,
computation speedup, modularity, and convenience. The processes
executing in the operating system may be either independent processes
or co-operating processes. Co-operating processes must have the
means to communicate with each other.
Co-operating processes that directly share a logical address space can
be implemented as lightweight processes or threads. A thread is a basic
unit of CPU utilization, and it shares with peer threads its code section,
data section, and operating system resources, collectively known as task.
3.10 Answers
Self Assessment Questions
1. False
2. Process Control Block (PCB)
3. a) Ready
4. True
5. Scheduler
6. b) Context Switch
7. False
8. Exit System Call
9. c) Co-operating Process
10. True
11. Lightweight
12. d) Kernel-level
Terminal Questions
1. A process can be any one of the following states:
a) New: Process being created.
b) Running: Instructions being executed.
c) Waiting (Blocked): Process waiting for an event to occur.
d) Ready: Process waiting for CPU.
e) Terminated: Process has finished execution. (Refer Section 3.2)
2. Every process has a number and a process control block (PCB)
represents a process in an operating system. The PCB serves as a
repository of information about a process and varies from process to
process. The PCB contains information that makes the process an active
entity. (Refer Section 3.3)
3. The operating system scheduler schedules processes from the ready
queue for execution by the CPU. The scheduler selects one of the many
processes from the ready queue based on certain criteria. Schedulers
could be any one of the following:
Long-term scheduler
Short-term scheduler
Medium-term scheduler (Refer Section 3.4)
Structure:
4.1 Introduction
Objectives
4.2 Basic Concepts of Scheduling
4.3 Scheduling Algorithms
4.4 Evaluation of CPU Scheduling Algorithms
4.5 Summary
4.6 Terminal Questions
4.7 Answers
4.1 Introduction
Dear student, in the last unit you have studied about process management.
In this unit, let’s explore various CPU scheduling algorithms. The CPU
scheduler selects a process from among the ready processes to execute on
the CPU. CPU scheduling is the basis for multi-programmed operating
systems. CPU utilization increases by switching the CPU among ready
processes instead of waiting for each process to terminate before executing
the next. In this unit we will discuss various CPU scheduling algorithms
such as First-Come-First-Served, Shortest-Job-First, and Round-Robin etc.
Objectives:
After studying this unit, you should be able to:
explain basic scheduling concepts
describe different scheduling algorithms
discuss the evaluation of scheduling algorithms
till the process completes execution (Figure 4.1). Process execution begins
with a CPU burst followed by an I/O burst and then another CPU burst and
so on. Eventually, a CPU burst will terminate the execution. An I/O bound
job will have short CPU bursts and a CPU bound job will have long CPU
bursts.
:
:
Load memory
Add to memory CPU burst
Read from file
Wait for I/O I/O burst
Load memory
Make increment CPU burst
Write into file
I/O burst
Wait for I/O
Load memory
Add to memory CPU burst
Read from file
CPU Scheduler
Whenever the CPU becomes idle, the operating system must select one of
the processes in the ready queue to be executed. The short-term scheduler
(or CPU scheduler) carries out the selection process. The scheduler selects
from among the processes in memory that are ready to execute, and
allocates the CPU to one of them.
Note that the ready queue is not necessarily a first-in, first-out (FIFO) queue.
As we shall see when we consider the various scheduling algorithms, a
ready queue may be implemented as a FIFO queue, a priority queue, a tree,
or simply an unordered linked list. Conceptually, however, all the processes
in the ready queue are lined up waiting for a chance to run on the CPU. The
records in the queue are generally PCBs of the processes.
Preemptive / Non-preemptive Scheduling
CPU scheduling decisions may take place under the following four
circumstances. When a process:
1. switches from running state to waiting (an I/O request)
2. switches from running state to ready state (expiry of a time slice)
3. switches from waiting to ready state (completion of an I/O)
4. terminates
Scheduling under condition (1) or (4) is said to be non-preemptive. In non-
preemptive scheduling, a process once allotted the CPU keeps executing
until the CPU is released either by a switch to a waiting state or by
termination. Preemptive scheduling occurs under condition (2) or (3). In
preemptive scheduling, an executing process is stopped executing and
returned to the ready queue to make the CPU available for another ready
process. Windows used non-preemptive scheduling up to Windows 3.x, and
started using pre-emptive scheduling with Win95. Note that pre-emptive
scheduling is only possible on hardware that supports a timer interrupt. It is
to be noted that pre-emptive scheduling can cause problems when two
processes share data, because one process may get interrupted in the
middle of updating shared data structures.
Preemption also has an effect on the design of the operating-system kernel.
During the processing of a system call, the kernel may be busy with an
active on behalf of a process. Such activities may involve changing
important kernel data (for instance, I/O queues). What happens if the
process is preempted in t1: middle of these changes, and the kernel (or the
device driver) needs to read (modify the same structure). Chaos ensues.
Some operating systems, including most versions of UNIX, deal with this
problem by waiting either for a system call to complete, or for an I/O block to
take place, before doing a context switch. This scheme ensures that the
kernel structure is simple, since the kernel will not preempt a process while
P1 P2 P3
0 24 27 30
0 3 6 30
Average waiting time = (0 + 3 + 6) / 3 = 9 / 3 = 3 ms.
Average turnaround time = (3 + 6 + 30) / 3 = 39 / 3 = 13 ms.
Thus, if processes with smaller CPU burst times arrive earlier, then average
waiting and average turnaround times are lesser. The algorithm also suffers
from what is known as a convoy effect. Consider the following scenario. Let
there be a mix of one CPU bound process and many I/O bound processes
in the ready queue. The CPU bound process gets the CPU and executes
(long I/O burst). In the meanwhile, I/O bound processes finish I/O and wait
for CPU, thus leaving the I/O devices idle. The CPU bound process releases
the CPU as it goes for an I/O. I/O bound processes have short CPU bursts
and they execute and go for I/O quickly. The CPU is idle till the CPU bound
process finishes the I/O and gets hold of the CPU. The above cycle repeats.
This is called the convoy effect. Here small processes wait for one big
process to release the CPU. Since the algorithm is non-preemptive in nature,
it is not suited for time sharing systems.
Shortest-Job-First Scheduling
Another approach to CPU scheduling is the shortest job first algorithm. In
this algorithm, the length of the CPU burst is considered. When the CPU is
available, it is assigned to the process that has the smallest next CPU burst.
Hence this is named shortest job first. In case there is a tie, FCFS
scheduling is used to break the tie. As an example, consider the following
set of processes P1, P2, P3, P4 and their CPU burst times:
Process Burst time (ms)
P1 6
P2 8
P3 7
P4 3
Using SJF algorithm, the processes would be scheduled as shown below.
P4 P1 P3 P2
0 3 9 16 24
the time required to complete a job as given by the user can be used to
schedule. SJF algorithm is therefore applicable in long-term scheduling. The
algorithm cannot be implemented for CPU scheduling as there is no way to
accurately know in advance the length of the next CPU burst. Only an
approximation of the length can be used to implement the algorithm.
But the SJF scheduling algorithm is provably optimal and thus serves as a
benchmark to compare other CPU scheduling algorithms. SJF algorithm
could be either preemptive or non-preemptive. If a new process joins the
ready queue with a shorter next CPU burst then what is remaining of the
current executing process, then the CPU is allocated to the new process. In
case of non-preemptive scheduling, the current executing process is not
preempted and the new process gets the next chance, it being the process
with the shortest next CPU burst.
Given below are the arrival and burst times of four processes P1, P2, P3
and P4.
Process Arrival time (ms) Burst time (ms)
P1 0 8
P2 1 4
P3 2 9
P4 3 5
If SJF preemptive scheduling is used, the following Gantt chart shows the
result.
P1 P2 P4 P1 P3
0 1 5 10 17 26
Average waiting time = ((10 – 1) + 0 + (17 – 2) + (15 – 3)) / 4 = 26 / 4 = 6.5
ms.
If non-preemptive SJF scheduling is used, the result is as follows:
P1 P2 P4 P3
0 8 12 17 26
Priority Scheduling
In priority scheduling each process can be associated with a priority. CPU is
allocated to the process having the highest priority. Hence this is named
priority scheduling. Equal priority processes are scheduled according to
FCFS algorithm.
The SJF algorithm is a particular case of the general priority algorithm. In
this case priority is the inverse of the next CPU burst time. Larger the next
CPU burst, lower is the priority and vice versa. In the following example, we
will assume lower numbers to represent higher priority.
Process Priority Burst time (ms)
P1 3 10
P2 1 1
P3 3 2
P4 4 1
P5 2 5
Using priority scheduling, the processes are scheduled as shown in the
Gantt chart:
P2 P5 P1 P3 P4
0 1 6 16 18 19
Let the duration of a time slice be 4 ms, which is to say CPU switches
between processes every 4 ms in a round-robin fashion. The Gantt chart
below shows the scheduling of processes.
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
Average waiting time = (4 + 7 + (10 – 4)) / 3 = 17/ 3 = 5.66 ms.
If there are 5 processes in the ready queue that is n = 5, and one time slice
is defined to be 20 ms that is q = 20, then each process will get 20 ms or
one time slice every 100 ms. Each process will never wait for more than
(n – 1) x q time units.
The performance of the RR algorithm is very much dependent on the length
of the time slice. If the duration of the time slice is indefinitely large then the
RR algorithm is the same as FCFS algorithm. If the time slice is too small,
then the performance of the algorithm deteriorates because of the effect of
frequent context switching. A comparison of time slices of varying duration
and the context switches they generate on only one process of 10 time units
is shown below.
Process Time= 10
Quantum Context
switch
12 0
0 10
6 1
0 6 10
1 9
0 1 2 3 4 5 6 7 8 9 10
The above example shows that the time slice should be large with respect to
the context switch time, else, if RR scheduling is used the CPU will spend
more time in context switching.
Multi-level Queue Scheduling
Processes can be classified into groups. For example, interactive processes,
system processes, batch processes, student processes and so on.
Processes belonging to a group have a specified priority. This algorithm
partitions the ready queue into as many separate queues as there are
groups. Hence this is named multilevel queue scheduling. Based on certain
properties, process is assigned to one of the ready queues. Each queue can
have its own scheduling algorithm like FCFS or RR. For example, queue for
interactive processes could be scheduled using RR algorithm where queue
for batch processes may use FCFS algorithm. An illustration of multilevel
queues is shown below (Figure 4.2).
Queues themselves have priorities. Each queue has absolute priority over
low priority queues that are a process in a queue with lower priority will not
be executed until all processes in a queue with higher priority have finished
executing. If a process in a lower priority queue is executing (higher priority
queues are empty) and a process joins a higher priority queue, then the
executing process is preempted to make way for a process in the higher
priority queue.
This priority on the queues themselves may lead to starvation. To overcome
this problem, time slices may be assigned to queues when each queue gets
some amount of CPU time. The duration of the time slices may be different
for queues depending on the priority of the queues.
Multi-level Feedback Queue Scheduling
In the previous multilevel queue scheduling algorithm, processes once
assigned to queues do not move or change queues. Multilevel feedback
queues allow a process to move between queues. The idea is to separate
out processes with different CPU burst lengths. All processes could initially
join the highest priority queue. Processes requiring longer CPU bursts are
pushed to lower priority queues. I/O bound and interactive processes remain
in higher priority queues. Aging could be considered to move processes
from lower priority queues to higher priority to avoid starvation. An
illustration of multilevel feedback queues is shown in Figure 4.3.
As shown in Figure 4.3, a process entering the ready queue joins queue 0.
RR scheduling algorithm with q = 8 is used to schedule processes in queue
0. If the CPU burst of a process exceeds 8 ms, then the process preempted,
deleted from queue 0 and joins the tail of queue 1. When queue 0 becomes
empty, then processes in queue 1 will be scheduled. Here also RR
scheduling algorithm is used to schedule processes but q = 16. This will
give processes a longer time with the CPU. If a process has a CPU burst
still longer, then it joins queue 3 on being preempted. Hence highest priority
processes (processes having small CPU bursts, that is I/O bound
processes) remain in queue 1 and lowest priority processes (those having
long CPU bursts) will eventually sink down. The lowest priority queue could
be scheduled using FCFS algorithm to allow processes to complete
execution.
Multilevel feedback scheduler will have to consider parameters such as
number of queues, scheduling algorithm for each queue, criteria for
upgrading a process to a higher priority queue, criteria for downgrading a
process to a lower priority queue and also the queue to which a process
initially enters.
Multiple-processor Scheduling
When multiple processors are available, then the scheduling gets more
complicated, because now there is more than one CPU which must be kept
busy and in effective use at all times. Multi-processor systems may be
heterogeneous, (different kinds of CPUs), or homogenous, (all the same
kind of CPU). This book will restrict its discussion to homogenous systems.
In homogenous systems any available processor can then be used to run
any processes in the queue. Even within homogenous multiprocessor, there
are sometimes limitations on scheduling. Consider a system with an I/O
device attached to a private bus of one processor. Processes wishing to use
that device must be scheduled to run on that processor; otherwise the
device would not be available.
If several identical processors are available, then load sharing can occur. It
would be possible to provide a separate queue for each processor. In this
case, however one processor could be idle, with an empty queue, while
another processor was very busy. To prevent this situation, we use a
common ready queue. All processes go into one queue and are scheduled
onto any available processor.
In such scheme, one of two scheduling approaches may be used. In one
approach, each processor is self–scheduling. Each processor examines the
common ready queue and selects a process to execute. We must ensure
that two processors do not choose the same process, and that processes
are not lost from the queue. The other approach avoids this problem by
The average waiting times for FCFS, SJF, and RR are 28ms, 13ms, and
23ms respectively. Deterministic modeling is fast and easy, but it requires
specific known input, and the results only apply for that particular set of input.
However, by examining multiple similar cases, certain trends can be
observed. (Like the fact that for processes arriving at the same time, SJF
will always yield the shortest average wait time.)
Queuing Models
Specific process data is often not available, particularly for future times.
However, a study of historical performance can often produce statistical
descriptions of certain important parameters, such as the rate at which new
processes arrive, the ratio of CPU bursts to I/O times, the distribution of
CPU burst times and I/O burst times, etc.
Armed with those probability distributions and some mathematical formulas,
it is possible to calculate certain performance characteristics of individual
waiting queues. For example, Little's Formula says that for an average
queue length of N, with an average waiting time in the queue of W, and an
average arrival of new jobs in the queue of Lambda, the these three terms
can be related by:
N = Lambda x W
Queuing models treat the computer as a network of interconnected queues,
each of which is described by its probability distribution statistics and
formulas such as Little's formula. Unfortunately real systems and modern
scheduling algorithms are so complex as to make the mathematics
intractable in many cases with real systems.
Simulations
Another approach is to run computer simulations of the different proposed
algorithms (and adjustment parameters) under different load conditions, and
to analyze the results to determine the "best" choice of operation for a
particular load pattern. Operating conditions for simulations are often
randomly generated using distribution functions similar to those described
above. A better alternative when possible is to generate trace tapes, by
monitoring and logging the performance of a real system under typical
expected work loads. These are better because they provide a more
accurate picture of system loads, and also because they allow multiple
simulations to be run with the identical process load, and not just statistically
equivalent loads. A compromise is to randomly determine system loads and
then save the results into a file, so that all simulations can be run against
identical randomly determined system loads.
Although trace tapes provide more accurate input information, they can be
difficult and expensive to collect and store, and their use increases the
Implementation
The only real way to determine how a proposed scheduling algorithm is
going to operate is to implement it on a real system. For experimental
algorithms and those under development, this can cause difficulties and
resistances among users who don't care about developing OS’s and are
only trying to get their daily work done. Even in this case, the measured
results may not be definitive, for at least two major reasons: (1) System
workloads are not static, but change over time as new programs are
installed, new users are added to the system, new hardware becomes
available, new work projects get started, and even societal changes. (For
example the explosion of the Internet has drastically changed the amount of
network traffic that a system sees and the importance of handling it with
rapid response times.) (2) As mentioned above, changing the scheduling
system may have an impact on the workload and the ways in which users
use the system.
Most modern systems provide some capability for the system administrator
to adjust scheduling parameters, either on the fly or as the result of a reboot
or a kernel rebuild.
Self Assessment Questions
7. To select an algorithm first we must define, the criteria on which we can
select the best algorithm. (True / False)
8. N = Lambda x W is _______________ formula.
4.5 Summary
Let’s summarize the key points covered in this unit:
The long-term scheduler provides a proper mix of CPU-I/O bound jobs
for execution. The short-term scheduler has to schedule these
processes for execution.
Scheduling can either be preemptive or non-preemptive. If preemptive,
then an executing process can be stopped and returned to ready state
to make the CPU available for another ready process. But if non-
preemptive scheduling is used then a process once allotted the CPU
keeps executing until either the process goes into wait state because of
an I/O or it has completed execution.
First-come, first-served (FCFS) scheduling is the simplest scheduling
algorithm, but it can cause short processes to wait for very long
processes.
Shortest-Job-First (SJF) scheduling is provably optimal, providing the
shortest average waiting time. Implementing SJF scheduling is difficult
because predicting the length of the next CPU burst is difficult.
Multilevel queue algorithms allow different algorithms to be used for
various classes of processes.
4.7 Answers
Self Assessment Questions
1. True
2. CPU Scheduler
3. a) 40%, 90%
4. False
5. Shortest-Job-First Scheduling
6. Round-Robin
7. True
8. Little’s
Terminal Questions
1. Many algorithms exist for CPU scheduling. Various criteria have been
suggested for comparing these CPU scheduling algorithms. Common
criteria include: CPU utilization, Throughput, Turnaround time, Waiting
time, Response time etc. (Refer Section 4.2)
2. First Come First Served scheduling algorithm is one of the very brute
force algorithms. A process that requests for the CPU first is allocated
the CPU first. Hence, the name first come first serve. The FCFS
algorithm is implemented by using a first-in-first-out (FIFO) queue
structure for the ready queue. (Refer Section 4.3)
3. The main disadvantage with the SJF algorithm lies in knowing the length
of the next CPU burst. In case of long-term or job scheduling in a batch
system, the time required to complete a job as given by the user can be
used to schedule. SJF algorithm is therefore applicable in long-term
scheduling. (Refer Section 4.3)
4. Computer simulations of the different proposed algorithms (and
adjustment parameters) are run under different load conditions, and the
results are analyzed to determine the "best" choice of operation for a
particular load pattern. Operating conditions for simulations are often
randomly generated using distribution functions. (Refer Section 4.4)
5.1 Introduction
In the last unit you have studied about CPU scheduling algorithms. In this
unit you are going to learn about process synchronization.
A co-operating process is one that can affect or be affected by the other
processes executing in the system. These processes may either directly
share a logical address space (that is, both code and data), or be allowed to
share data only through files. Concurrent access to shared data may result
in data inconsistency. Maintaining data consistency requires mechanism to
ensure the orderly execution of co-operating processes. In this unit we will
discuss how co-operating processes can communicate and various
mechanisms to ensure the orderly execution of co-operating processes that
share a logical address space, so that data consistency is maintained.
Objectives:
After studying this unit, you should be able to:
explain Interprocess communication
discuss the critical section problem
describe semaphores and monitors
explain the significance of hardware assistance
What is the capacity of a link? That is, does the link have some buffer
space? If it does, how much?
What is the size of messages? Can the link accommodate variable-sized
or only fixed-sized messages?
Is a link unidirectional or bi-directional? That is, if a link exists between P
and Q, can messages flow in only one direction (such as only from P to
Q) or in both directions?
The definition of unidirectional must be stated more carefully, since a link
may be associated with more than two processes. Thus, we say that a link
is unidirectional only if each process connected to the link can either send or
receive, but not both and each link has at least one receiver process
connected to it.
In addition, there are several methods for logically implementing a link and
the send/receive operations:
Direct or indirect communication
Symmetric or asymmetric communication
Automatic or explicit buffering
Send by copy or send by reference
Fixed-sized or variable-sized messages
For the remainder of this section, we elaborate on some of these types of
message systems.
Naming
Processes that want to communicate must have a way to refer to each other.
They can use either direct communication or indirect communication, as we
shall discuss under the next two subheadings.
Direct Communication:
In the direct-communication discipline, each process that wants to
communicate must explicitly name the recipient or sender of the
communication. In this scheme, the send and receive primitives are defined
as follows:
Send (P, message). Send a message to process P.
Receive (Q, message). Receive a message from process Q.
repeat
.....
produce an item in nextp
.....
send ( consumer, nextp );
until false;
This scheme exhibits symmetry in addressing; that is, both the sender and
the receiver processes have to name each other to communicate. A variant
of this scheme employs asymmetry in addressing. Only the sender names
the recipient; the recipient is not required to name the sender. In this
scheme, the send and receive primitives are defined as follows:
Allow the system to select arbitrarily which process will receive the
message (that is, either P2 or P3, but not both, will receive the message).
The system may identify the receiver to the sender.
A mailbox may be owned either by a process or by the system. If the
mailbox is owned by a process (that is, the mailbox is attached to or defined
as part of the process), then we distinguish between the owner (who can
only receive messages through this mailbox) and the user of the mailbox
(who can only send messages to the mailbox). Since each mailbox has a
unique owner, there can be no confusion about who should receive a
message sent to this mailbox. When a process that owns a mailbox
terminates, the mailbox disappears. Any process that subsequently sends a
message to this mailbox must be notified that the mailbox no longer exists
(via exception handling, described in Section 5.6 of this unit).
There are various ways to designate the owner and users of a particular
mailbox. One possibility is to allow a process to declare variables of type
mailbox. The process that declares a mailbox is that mailbox's owner. Any
other process that knows the name of this mailbox can use this mailbox.
On the other hand, a mailbox that is owned by the operating system has an
existence of its own. It is independent, and is not attached to any particular
process. The operating system provides a mechanism that allows a
process:
To create a new mailbox
To send and receive messages through the mailbox
To destroy a mailbox
The process that creates a new mailbox is that mailbox's owner by default.
Initially, the owner is the only process that can receive messages through
this mailbox. However, the ownership and receive privilege may be passed
to other processes through appropriate system calls. Of course, this
provision could result in multiple receivers for each mailbox. Processes may
also share a mailbox through the process-creation facility. For example, if
process P created mailbox A, and then created a new process Q, P and Q
may share mailbox A. Since all processes with access rights to a mailbox
may ultimately terminate, after some time a mailbox may no longer be
accessible by any process. In this case, the operating system should
reclaim whatever space was used for the mailbox. This task may require
Manipal University Jaipur B1405 Page No. 77
Operating Systems Unit 5
general structure is shown in Figure 5.1. The entry section and exit section
are enclosed in boxes to highlight these important segments of code.
Repeat
entry section
Critical-section
exit section
Remainder section
until false;
Fig. 5.1: General structure of a typical process pi
Two-process solutions
The following two algorithms are applicable to only two processes at a time.
The processes are numbered p0 and p1. For convenience, when presenting
pi, we use pj to denote the other process; that is j=1-i.
Algorithm 1:
Let the processes share a common variable turn initialized to 0 (or 1). If turn
=i, then process pi is allowed to execute in its critical-section. The structure
of process pi is shown in Figure 5.2.
This solution ensures that only one process at a time can be in its critical-
section. But it does not satisfy the progress requirement, since it requires
strict alternation of processes in the execution of the critical-section. For
example, if turn=0 and p1 is ready to enter its critical-section, p1 cannot do
so, even though p0 may be in its remainder section.
Repeat
Critical-section
turn= j;
Remainder section
until false;
Fig. 5.2: The structure of process pi in algorithm 1
Algorithm 2:
The problem with algorithm 1 is that it does not retain sufficient information
about the state of each process; it remembers only which process is allowed
to enter that process critical-section. To remedy this problem, we can
replace the variable turn with the following array:
var flag: array[0..1] of Boolean;
the elements of the array are initialized to false. If flag[i] is true, this value
indicates that pi is ready to enter the critical-section. The structure of
process pi is shown in Figure 5.3.
In this algorithm process pi first sets flag[i] to be true, signaling that it is
ready to enter its critical-section. Then pi checks to verify that process pj is
not also ready to enter its critical-section. If pj were ready, then pi would wait
until pj had indicated that it no longer needed to be in the critical-section. At
this point, pi would enter the critical-section. On exiting the critical section, pi
would set its flag to be false, allowing the other process to enter its critical-
section.
In this solution, the mutual exclusion requirement is satisfied. Unfortunately,
the progress requirement is not met.
Repeat
flag[i]=true;
while flag[j] do no-op;
Critical-section
flag[i]= false;
Remainder section
until false;
Fig. 5.3: The structure of process pi in algorithm 2
Algorithm 3:
By combining the key ideas of algorithm 1 and algorithm 2, we obtain a
correct solution to the critical-section problem, where all three requirements
are met. The processes share two variables;
var flag: array[0…1] of boolean;
turn; 0…1;
initially flag[0]=flag[1]=false, and the value of turn is immaterial (but it is
either 0 or 1). The structure of process pi is shown in figure 5.4. The
eventual value of turn decides which of the two processes is allowed to
enter its critical-section first.
Repeat
flag[i]=true;
turn=j;
while (flag[j] and turn=j) do no-op;
Critical-section
flag[i]= false;
Remainder section
until false;
initially these data structures are initialized to false and 0 respectively . For
convenience, we define the following notation. The structure of process pi,
used in the bakery algorithm, is shown in Figure 5.5.
Consider a process pi in its critical section and pk trying to enter the its
critical section. When process pk executes the second while statement for
j=I, it finds that
number[i] ≠ 0
(number[i],i ) < (number[k],k)
Thus it continues looping in the while statement until pi leaves the pi critical
section.
Repeat
choosing[i]=true;
number[i]=max(number[0],number[1],….number[n-1])+1;
choosing[i]=false;
for j=0 to n-1
do begin
while choosing[j] do no-op;
while number[j] ≠ 0
and (number[j],j) <(number[i],i) do no-op;
end;
critical section
number[i]=0;
remainder section
until false;
5.4 Semaphores
Semaphores are the classic method for restricting access to shared
resources (e.g. storage) in a multi-processing environment. They were
invented by Dijkstra and first used in T.H.E operating system.
A semaphore is a protected variable (or abstract data type) which can only
be accessed using the following operations:
P(s)
Semaphore s;
{
while (s == 0) ;/* wait until s>0 */
s = s-1;
}
V(s)
Semaphore s;
{
s = s+1;
Init(s, v)
Semaphore s;
Int v;
{
s = v;
}
5.5 Monitors
Another high-level synchronization construct is the monitor type. A monitor
is a collection of procedures, variables and data structures grouped
together. Processes can call the monitor procedures but cannot access the
internal data structures. Only one process at a time may be active in a
monitor.
Begin
-------
Call Enter-critical-section
Critical section instructions
Call Exit-critical-section
-------
Call Enter-critical-section executes the TSL instruction if IND = F else waits.
Call Exit-critical-section sets IND = F. Any process producer / consumer can
be handled using the above algorithm. Demerits of the algorithm include the
use of special hardware that restricts portability.
Self Assessment Questions
7. Semaphores are the classic method for restricting access to shared
resources (e.g. storage) in a multi-processing environment. (True /
False)
8. Semaphores were invented by _______________.
9. _______________is a high-level synchronization construct which is a
collection of procedures, variables and data structures grouped together.
(Pick right option)
a) Semaphores
b) Processes
c) Monitor
d) None of the above
5.7 Summary
Let’s summarize the key points covered in the unit:
Given a collection of co-operating processes that share data, mutual
exclusion should be provided.
Mutual exclusion is a way of making sure that if one process is using a
shared modifiable data, the other processes will be excluded from doing
the same thing. One solution for this is by ensuring that a critical section
of code is in use by only one process or thread at a time.
There are different algorithms to solve the critical-section problem. But
the main disadvantage of these algorithms is that they all need busy
waiting.
5.9 Answers
Self Assessment Questions
1. True
2. Remote Procedure Call
3. a) Bounded Capacity
4. True
5. Bakery
6. b) Mutual Exclusion
7. True
8. Dijkstra
9. c) Monitor
Terminal Questions
1. Inter Process Communication provides a mechanism to allow processes
to communicate and to synchronize their actions. Inter-process-
communication is best provided by a message system. (Refer Section
5.2)
2. A critical-section is a part of program that accesses a shared resource
(data structure or device) that must not be concurrently accessed by
more than one process of execution. (Refer Section 5.3)
Unit 6 Deadlocks
Structure:
6.1 Introduction
Objectives
6.2 System Model
6.3 Deadlock Characterization
Necessary conditions for deadlock
Resource-allocation graph
6.4 Deadlock Handling
6.5 Deadlock Prevention
6.6 Deadlock Avoidance
Safe state
Resource-allocation graph algorithm
Banker’s algorithm
6.7 Deadlock Detection
Single instance of a resource
Multiple instances of a resource
Recovery from deadlock
6.8 Summary
6.9 Terminal Questions
6.10 Answers
6.1 Introduction
In the previous unit, you have learned about process synchronization. In
this unit, let’s study about deadlocks.
Several processes compete for a finite set of resources in a multi-
programmed environment. A process requests for resources that may not
be readily available at the time of the request. In such a case the process
goes into a wait state. It may so happen that this process may never change
state because the requested resources are held by other processes which
themselves are waiting for additional resources and hence in a wait state.
This situation is called a deadlock.
Deadlock occurs when we have a set of processes [not necessarily all the
processes in the system], each holding some resources, each requesting
some resources, and none of them is able to obtain what it needs, i.e. to
A process requests for resources, uses them if granted and then releases
the resources for others to use. It goes without saying that the number of
resources requested shall not exceed the total of each type available in the
system. If a request for a resource cannot be granted immediately then the
process requesting the resource goes into a wait state and joins the wait
queue for the resource.
A set of processes is in a state of deadlock if every process in the set is in
some wait queue of a resource and is waiting for an event (release
resource) to occur that can be caused by another process in the set. For
example, there are 2 resources, 1 printer and 1 tape drive. Process P1 is
allocated tape drive and P2 is allocated printer. Now if P1 requests for
printer and P2 for tape drive, a deadlock occurs.
If there are multiple instances of resources types, then a cycle does not
necessarily imply a deadlock. Here a cycle is a necessary condition but not
a sufficient condition for the existence of a deadlock (Refer to figure 6.3).
Here also there is a cycle:
P1 R1 P3 R2 P1
1) a process requests for and gets allocated all the resources it uses before
execution begins.
2) a process can request for a resource only when it does not hold on to
any other.
Algorithms based on these approaches have poor resource utilization. This
is because resources get locked with processes much earlier than they are
actually used and hence not available for others to use as in the first
approach. The second approach seems applicable only when there is
assurance about reusability of data and code on the released resources.
The algorithms also suffer from starvation since popular resources may
never be freely available.
No preemption: This condition states that resources allocated to processes
cannot be preempted. To ensure that this condition does not hold, resources
could be preempted. When a process requests for a resource, it is allocated
the resource if it is available. If it is not available, then a check is made to
see if the process holding the wanted resource is also waiting for additional
resources. If so, the wanted resource is preempted from the waiting process
and allotted to the requesting process. If both the above are not true, that is,
the resource is neither available nor held by a waiting process then the
requesting process waits. During its waiting period, some of its resources
could also be preempted in which case the process will be restarted only
when all the new and the preempted resources are allocated to it.
Another alternative approach could be as follows: If a process requests for a
resource which is not available immediately, then all other resources it
currently holds are preempted. The process restarts only when the new and
the preempted resources are allocated to it as in the previous case.
Resources can be preempted only if their current status can be saved so
that processes could be restarted later by restoring the previous states.
Example: CPU memory and main memory. But resources such as printers
cannot be preempted, as their states cannot be saved for restoration later.
Circular wait: Resource types need to be ordered and processes
requesting for resources will do so in an increasing order of enumeration.
Each resource type is mapped to a unique integer that allows resources to
be compared and to find out the precedence order for the resources. Thus
F: R N is a 1:1 function that maps resources to numbers. For example:
Manipal University of Jaipur B1405 Page No. 99
Operating Systems Unit 6
then Pi requesting for resources can wait till Pj’s have completed. If such a
safe sequence does not exist, then the system is in an unsafe state.
A safe state is not a deadlock state. Conversely a deadlock state is an
unsafe state. But all unsafe states are not deadlock states as in Figure 6.4.
If a system is in a safe state it can stay away from an unsafe state and thus
avoid deadlock. On the other hand, if a system is in an unsafe state,
deadlocks cannot be avoided.
Illustration: A system has 12 instances of a resource type and 3 processes
using these resources. The maximum requirements for the resource by the
processes and their current allocation at an instance say t0 is as shown
below:
Process Maximum Current
P0 10 5
P1 4 2
P3 9 2
At the instant t0, the system is in a safe state and one safe sequence is < P1,
P0, P2 >. This is true because of the following facts:
Out of 12 instances of the resource, 9 are currently allocated and 3 are
free.
P1 needs only 2 more, its maximum being 4, can be allotted 2.
Now only 1 instance of the resource is free.
When P1 terminates, 5 instances of the resource will be free.
Fig. 6.5: Resource allocation graph showing safe and deadlock states
Consider the resource allocation graph shown on the left above. Resource
R2 is currently free. Allocation of R2 to P2 on request will result in a cycle as
shown on the right. Therefore the system will be in an unsafe state. In this
situation if P1 requests for R2, then a deadlock occurs
b. Needi <= Work (Needi represents the ith row of the vector Need).
If such an i does not exist , go to step 5.
4. Work = Work + Allocationi
Go to step 3.
5. If finish[i] = true for all i, then the system is in a safe state.
Resource-request algorithm
Let Requesti be the vector representing the requests from a process Pi.
Requesti[j] = k shows that process Pi wants k instances of the resource type
Rj. The following is the algorithm to find out if a request by a process can
immediately be granted:
1) If Requesti <= Needi, go to step 2.
else Error “request of Pi exceeds Maxi”.
2) If Requesti <= Availablei, go to step 3.
else Pi must wait for resources to be released.
3) An assumed allocation is made as follows:
Available = Available – Requesti
Allocationi = Allocationi + Requesti
Needi = Needi – Requesti
If the resulting state is safe, then process Pi is allocated the resources and
the above changes are made permanent. If the new state is unsafe, then Pi
must wait and the old status of the data structures is restored.
Illustration: n = 5 < P0, P1, P2, P3, P4 >
M = 3 < A, B, C >
Initially Available = < 10, 5, 7 >
At an instant t0, the data structures have the following values:
Allocation Max Available Need
A B C A B C A B C A B C
Po 0 1 0 7 5 3 3 3 2 7 4 3
P1 2 0 0 3 2 2 1 2 2
P2 3 0 2 9 0 2 6 0 0
P3 2 1 1 2 2 2 0 1 1
P4 0 0 2 4 3 3 4 3 1
To find a safe sequence and to prove that the system is in a safe state, use
the safety algorithm as follows:
Step Work Finish Safe sequence
0 3 3 2 FFFFF <>
1 5 3 2 FTFFF < P1 >
2 7 4 3 FTFTF < P1, P3 >
3 7 4 5 FTFTT < P1, P3, P4 >
4 7 5 5 TTFTT < P1, P3, P4, P0 >
5 10 5 7 TTTTT < P1, P3, P4, P0, P2 >
Now at an instant t1, Request1 = < 1, 0, 2 >. To actually allocate the
requested resources, use the request-resource algorithm as follows:
Request1 < Need1 and Request1 < Available so the request can be
considered. If the request is fulfilled, then the new the values in the data
structures are as follows:
Allocation Max Available Need
A B C A B C A B C A B C
P0 0 1 0 7 5 3 2 3 0 7 4 3
P1 3 0 2 3 2 2 0 2 0
P2 3 0 2 9 0 2 6 0 0
P3 2 1 1 2 2 2 0 1 1
P4 0 0 2 4 3 3 4 3 1
Use the safety algorithm to see if the resulting state is safe:
Step Work Finish Safe sequence
0 2 3 0 FFFFF <>
1 5 3 2 FTFFF < P1 >
2 7 4 3 FTFTF < P1, P3 >
3 7 4 5 FTFTT < P1, P3, P4 >
4 7 5 5 TTFTT < P1, P3, P4, P0 >
5 10 5 7 TTTTT < P1, P3, P4, P0, P2 >
Since the resulting state is safe, request by P1 can be granted.
Now at an instant t2 Request4 = < 3, 3, 0 >. But since Request4 > Available,
the request cannot be granted. Also Request0 = < 0, 2, 0> at t2 cannot be
granted since the resulting state is unsafe as shown below:
vertices represent processes and directed edges are present between two
processes, one of which is waiting for a resource held by the other. Two
edges Pi Rq and Rq Pj in the resource allocation graph are replaced by
one edge Pi Pj in the wait-for graph. Thus, the wait-for graph is obtained
by removing vertices representing resources and then collapsing the
corresponding edges in a resource allocation graph. An Illustration is shown
in Figure 6.6.
ALGORITHM
1) Define a vector Work of length m and a vector Finish of length n.
2) Initialize Work = Available and
For I = 1, 2, ….., n
If Allocationi != 0
Finish[i] = false
Else
Finish[i] = true
3) Find an i such that
a. Finish[i] = false and
b. Requesti <= Work
If such an i does not exist , go to step 5.
4) Work = Work + Allocationi
Finish[i] = true
Go to step 3.
5) If finish[i] = true for all i, then the system is not in deadlock.
Else the system is in deadlock with all processes corresponding to Finish[i]
= false being deadlocked.
Illustration: n = 5 < P0, P1, P2, P3, P4 >
M=3 < A, B, C >
Initially Available = < 7, 2, 6 >
At an instant t0, the data structures have the following values:
To prove that the system is not deadlocked, use the above algorithm as
follows:
Step Work Finish Safe sequence
0 0 0 0 FFFFF <>
1 0 1 0 TFFFF < P0 >
2 3 1 3 TFTFF < P0, P2 >
3 5 2 4 TFTTF < P0, P2, P3 >
4 5 2 6 TFTTT < P0, P2, P3, P4 >
5 7 2 6 TTTTT < P0, P2, P3, P4, P1 >
Now at an instant t1, Request2 = < 0, 0, 1 > and the new values in the data
structures are as follows:
Allocation Request Available
A B C A B C A B C
P0 0 1 0 0 0 0 0 0 0
P1 2 0 0 2 0 2
P2 3 0 3 0 0 1
P3 2 1 1 1 0 0
P4 0 0 2 0 0 2
To prove that the system is deadlocked, use the above algorithm as follows:
Step Work Finish Safe sequence
0 0 0 0 FFFFF <>
1 0 1 0 TFFFF < P0 >
The system is in deadlock with processes P1, P2, P3, and P4 deadlocked.
6.7.3 Recovery from deadlock
Once a deadlock has been detected, it must be broken. Breaking a
deadlock may be manual by the operator when informed of the deadlock or
automatically by the system. There exist two options for breaking deadlocks:
1) abort one or more processes to break the circular-wait condition causing
deadlock
2) preempting resources from one or more processes which are
deadlocked.
In the first option, one or more processes involved in deadlock could be
terminated to break the deadlock. Then abort either all processes or abort
one process at a time till deadlock is broken. The first case guarantees that
the deadlock will be broken. But processes that have executed for a long
time will have to restart all over again. The second case is better but has
considerable overhead as detection algorithm has to be invoked after
terminating every process. Also choosing a process that becomes a victim
for termination is based on many factors like
priority of the processes
length of time each process has executed and how much more it needs
for completion
type of resources and the instances of each that the processes use
need for additional resources to complete
nature of the processes, whether iterative or batch
Based on these and many more factors, a process that incurs minimum cost
on termination becomes a victim.
In the second option some resources are preempted from some processes
and given to other processes until the deadlock cycle is broken. Selecting
the victim whose resources can be preempted is again based on the
minimum cost criteria. Parameters such as number of resources a process
is holding and the amount of these resources used thus far by the process
are used to select a victim. When resources are preempted, the process
holding the resource cannot continue. A simple solution is to abort the
process also. Better still is to rollback the process to a safe state to restart
later. To determine this safe state, more information about running
processes is required which is again an overhead. Also starvation may
occur when a victim is selected for preemption; the reason being resources
from the same process may again and again be preempted. As a result the
process starves for want of resources. Ensuring that a process can be a
victim only a finite number of times by having this information as one of the
parameters for victim selection could prevent starvation.
Prevention, avoidance and detection are the three basic approaches to
handle deadlocks. But they do not encompass all the problems encountered.
Thus a combined approach of all the three basic approaches is used.
Self Assessment Questions
7. If the system does not ensure that a deadlock cannot be prevented or a
deadlock cannot be avoided, then a deadlock may occur. (True / False)
6.8 Summary
Let’s summarize the key concepts covered in this unit:
Since many processes compete for a finite set of resources, there is
always a possibility that requested resources are not readily available.
This makes processes wait.
When there is a set of processes where each process in the set waits on
another from the same set for release of a wanted resource, then a
deadlock has occurred.
Prevention, avoidance and detection are the three basic approaches to
handle deadlocks.
6.10 Answers
Self-Assessment Questions
1. True
2. Blocked
3. a) Mutual Exclusion
4. False
5. Avoidance
6. b) Banker’s
7. True
8. Wait-for Graph
9. Prevention, Avoidance, Detection
Terminal Questions
1. A deadlock occurs in a system if the following four conditions hold
simultaneously. They are Mutual Exclusion, Hold and Wait, No
Preemption and Circular Wait. (Refer Section 6.3.1)
2. Deadlocks can be described by a resource allocation graph. The
resource allocation graph is a directed graph consisting of vertices and
directed edges. The vertex set is partitioned into two types, a subset
representing processes and another subset representing resources.
(Refer Section 6.3.2)
3. A system is said to be in a safe state if it can allocate resources upto the
maximum available and is not in a state of deadlock. (Refer Section
6.6.1)
4. A new process entering the system must make known a priori the
maximum instances of each resource that it needs subject to the
maximum available for each type. (Refer Section 6.6.3)
7.1 Introduction
In the previous unit we have discussed about deadlocks. In this unit we shall
discuss about memory management which is very much important in
effective CPU utilization. The concept of CPU scheduling allows a set of
processes to share the CPU thereby increasing the utilization of the CPU.
This set of processes needs to reside in memory. The memory is thus
shared and the resource requires to be managed. Various memory
management algorithms exist, each having its own advantages and
disadvantages. The hardware design of the system plays an important role
in the selection of an algorithm for a particular system. That means to say,
hardware support is essential to implement the memory management
algorithm.
Objectives:
After studying this unit, you should be able to:
differentiate logical and physical address space
explain swapping technique
discuss various memory allocation methodologies
describe paging and page table implementation
explain segmentation
7.3 Swapping
A process to be executed needs to be in memory during execution. A
process can be swapped out of memory in certain situations to a backing
store and then brought into memory later for execution to continue. One
such situation could be the expiry of a time slice if the round-robin CPU
scheduling algorithm is used. On expiry of a time slice, the current process
is swapped out of memory and another process is swapped into the memory
space just freed because of swapping out of a process (See figure 7.2).
Every time a time slice expires, a process is swapped out and another is
swapped in. The memory manager that does the swapping is fast enough to
always provide a process in memory for the CPU to execute. The duration
of a time slice is carefully chosen so that it is sufficiently large when
compared to the time for swapping.
Processes are swapped between the main memory and the backing store
when priority based CPU scheduling is used. The arrival of a high priority
process will be a lower priority process that is executing to be swapped out
to make way for a swap in. The swapping in this case is sometimes referred
to as roll out / roll in.
A process that is swapped out of memory can be swapped in either into the
same memory location or into a different memory location. If binding is done
at load time then swap in has to be at the same location as before. But if
binding is done at execution time then swap in can be into a different
memory space since the mappings to physical addresses are completed
during execution time.
A backing store is required for swapping. It is usually a fast disk. The
processes in the ready queue have their images either in the backing store
or in the main memory. When the CPU scheduler picks a process for
execution, the dispatcher checks to see if the picked process is in memory.
If yes, then it is executed. If not the process has to be loaded into main
memory. If there is enough space in memory, the process is loaded and
execution starts. If not, the dispatcher swaps out a process from memory
and swaps in the desired process.
A process to be swapped out must be idle. Problems arise because of
pending I/O. Consider the following scenario: Process P1 is waiting for an
I/O. I/O is delayed because the device is busy. If P1 is swapped out and in
its place if P2 is swapped in, then the result of the I/O uses the memory that
now belongs to P2. There can be two solutions to the above problem:
1) Never swap out a process that is waiting for an I/O.
2) I/O operations to take place only into operating system buffers and not
into user area buffers. These buffers can then be transferred into user
area when the corresponding process is swapped in.
Self Assessment Questions
1. The logical address is also sometimes referred to as a virtual address.
(True / False)
2. An address generated by the CPU is referred to as a _______________.
3. MAR stands for _______________. (Pick the right option)
a) Memory Address Register
b) Memory Allocation Register
c) Main Address Register
d) Main Allocation Register
The problem now is to satisfy a memory request of size n from a list of free
holes of various sizes. Many solutions exist to determine that hole which is
the best to allocate. Most common strategies are:
1) First-fit: Allocate the first hole that is big enough to hold the process.
Search can either start at the beginning of the set of holes or at the point
where the last search terminated.
2) Best-fit: Allocate the smallest hole that is big enough to hold the
process. Here the entire list has to be searched or an ordered list of
holes by size is to be maintained.
3) Worst-fit: Allocate the largest hole available. Here also, the entire list
has to be searched for the biggest hole or an ordered list of holes by
size is to be maintained.
The size of a process is very rarely an exact size of a hole allocated. The
best-fit allocation always produces an optimal allocation where the hole left
over after allocation is the smallest. The first-fit is the fastest method of
allocation when compared to others. The worst-fit allocation is the worst
among the three and is seldom used.
7.4.3 Fragmentation
To begin with, there is one large hole for allocation to processes. As
processes are loaded into memory and terminate on completion, this large
hole is divided into a set of smaller holes that are scattered in between the
processes. There may be a situation where the total size of these scattered
holes is large enough to hold another process for execution but the process
cannot be loaded, as the hole is not contiguous. This is known as external
fragmentation. For example, in figure 7.6c, a fragmented hole equal to 560K
(300 + 260) is available. P5 cannot be loaded because 560K is not
contiguous.
There are situations where only a few bytes say 1 or 2 would be free if a
process were allocated a hole. Then, the cost of keeping track of this hole
will be high. In such cases, this extra bit of hole is also allocated to the
requesting process. If so then a small portion of memory allocated to a
process is not useful. This is internal fragmentation.
One solution to external fragmentation is compaction. Compaction is to
relocate processes in memory so those fragmented holes create one
contiguous hole in memory (See figure 7.7).
0 0
OS OS
400K 400K
P5
P5
900K 900K P4
1000K P4
4p
1600K P3
1700K
P3 1900K 660k
2000K
2300K
2560K 2560k
Fig. 7.7: Compaction
7.5 Paging
Contiguous allocation scheme requires that a process can be loaded into
memory for execution if and only if contiguous memory large enough to hold
the process is available. Because of this constraint, external fragmentation
is a common problem. Compaction was one solution to tide over external
A logical address generated by the CPU consists of two parts: Page number
(p) and a page offset (d). The page number is used as an index into a page
table. The page table contains the base address of each frame in physical
memory. The base address is combined with the page offset to generate the
physical address required to access the memory unit.
The size of a page is usually a power of 2. This makes translation of a
logical address into page number and offset easy as illustrated below:
Logical address space: 2m
Page size: 2n
Logical address:
p d
(m-n) d
Where p = index into the page table
d = displacement within a page
Illustration:
0
a i
b j
0 1 k
c
d l
e m
1 f 0 2 n
g 5 o
h p
1
i
6
2 jj 2 3
k 1
l 3
m
2
3 4
n
o Page table
p
o a
5 b
c
Logical Memory d
6 e
f
g
h
7
Physical Memory
Page size: 4 bytes
Physical memory: 32 bytes = 8 pages
Logical address 0 0 + 0 (5 x 4) + 0 physical address 20
3 0 + 3 (5 x 4) + 3 physical address 23
4 1 + 0 (6 x 4) + 0 physical address 24
13 3 + 1 (2 x 4) + 1 physical address 9
Thus, the page table maps every logical address to some physical address.
Paging does not suffer from external fragmentation since any page can be
loaded into any frame. But internal fragmentation may be prevalent. This is
because the total memory required by a process is not always a multiple of
the page size. So the last page of a process may not be full. This leads to
internal fragmentation and a portion of the frame allocated to this page will
be unused. On an average one half of a page per process is wasted due to
internal fragmentation. Smaller the size of a page, lesser will be the loss due
to internal fragmentation. But the overhead involved is more in terms of
number of entries in the page table. Also known is a fact that disk I/O is
more efficient if page sizes are big. A trade-off between the above factors is
used (See figure 7.9).
14 15
13 13 Free frame list
18 1
14
20
0
15 15
15
Free frame list
0 0 14
18 2
1 1 13
2 2 18
20
3
3 3 20
Self-Assessment Questions
4. The operating system is usually present in the upper portion of the main
memory. (True / False)
5. The method of relocating processes in memory so that the fragmented
holes create one contiguous hole in memory is called
_______________.
6. PTBR stands for _______________. (Pick the right option)
a) Page Table Box Register
b) Page Table Base Register
c) Physical Table Base Register
d) Physical Table Box Register
7.6 Segmentation
Memory management using paging provides two entirely different views of
memory – User / logical / virtual view and the actual / physical view. Both
are not the same. In fact, the user’s view is mapped on to the physical view.
How do users visualize memory? Users prefer to view memory as a
collection of variable sized segments (See figure 7.11).
7.7 Summary
Let’s summarize the key points discussed in this unit:
Main memory holds the processes during execution.
Memory could be contiguously allocated by using any one of the best-fit
or first-fit strategies. But one major disadvantage with this method was
that of fragmentation.
To overcome fragmentation problem the memory is divided into pages /
frames and the processes are considered to be a set of pages in logical
memory.
These pages are mapped to frames in physical memory through a page
table.
User’s view of memory is in the form of segments. Just like a page table,
a segment table maps segments to physical memory.
7.9 Answers
Self-Assessment Questions
1. True
2. Logical Address
3. a) Memory Address Register
4. False
5. Compaction
6. b) Page Table Base Register
7. True
8. Segmentation
9. c) Bob Scheduler
Terminal Questions
1. MMU stands for Memory Management Unit. At run time / execution time,
the virtual addresses are mapped to physical addresses by the MMU.
(Refer Section 7.2 for detail)
2. The relocation register contains a value to be added to every address
generated by the CPU for a user process at the time it is sent to the
memory for a fetch or a store. Thus, every address is relocated relative
to the value in the relocation register. The hardware of the MMU maps
logical addresses to physical addresses. (Refer Section 7.2).
3. The operating system resides in the lower memory. User processes
execute in the higher memory. There is always a possibility that user
processes may try to access the lower memory either accidentally or
intentionally thereby causing loss of operating system code and data.
(Refer Sub-section 7.4.1)
4. The algorithms are as follows:
A) First-fit: Allocate the first hole that is big enough to hold the process.
Search can either start at the beginning of the set of holes or at the
point where the last search terminated.
B) Best-fit: Allocate the smallest hole that is big enough to hold the
process. Here the entire list has to be searched or an ordered list of
holes by size is to be maintained.
C) Worst-fit: Allocate the largest hole available. Here also, the entire list
has to be searched for the biggest hole or an ordered list of holes by
size is to be maintained. (Refer Sub-section 7.4.2)
5. Segments of user programs are allocated memory by the bob scheduler.
This is similar to paging where segments could be treated as variable
sized pages. So a first-fit or best-fit allocation scheme could be used
since this is a dynamic storage allocation problem. (Refer Sub-section
7.6.3)
8.1 Introduction
In the last unit you studied about memory management strategies like
paging and segmentation which helps to implement the concept of multi-
programming. But they have a few disadvantages. One problem with the
above strategies is that they require the entire process to be in main
memory before execution can begin. Another disadvantage is the limitation
on the size of the process. Processes whose memory requirement is larger
than the maximum size of the memory available, will never be able to be run,
that is, users are desirous of executing processes whose logical address
space is larger than the available physical address space.
To address the above said problem in this unit we are going to discuss a
new technique called virtual memory that allows execution of processes that
may not be entirely in memory. In addition, virtual memory allows mapping
of a large virtual address space onto a smaller physical memory. It also
raises the degree of multi-programming and increases CPU utilization.
Because of the above features, users are freed from worrying about
memory requirements and availability.
Objectives:
After studying this unit, you should be able to:
explain virtual memory technique and its need
discuss demand paging
describe different page replacement algorithms
explain thrashing and its causes
If the valid-invalid bit is set, then the corresponding page is valid and also in
physical memory. If the bit is not set, then any of the following can occur:
Process is accessing a page not belonging to it, that is, an illegal
memory access.
Manipal University of Jaipur B1405 Page No. 137
Operating Systems Unit 8
In the initial case, a process starts executing with no pages in memory. The
very first instruction generates a page fault and a page is brought into
memory. After a while all pages required by the process are in memory with
a reference to each page generating a page fault and getting a page into
memory. This is known as pure demand paging. The concept, never bring in
a page into memory until it is required’.
Hardware required to implement demand paging is the same as that for
paging and swapping.
Page table with valid-invalid bit.
Secondary memory to hold pages not currently in memory, usually a
high speed disk known as a swap space or backing store.
A page fault at any point in the fetch-execute cycle of an instruction
causes the cycle to be repeated.
Self Assessment Questions
1. Every process needs to be loaded into physical memory for execution.
(True / False)
2. _______________ is implemented using demand paging.
3. When a process is to be executed then only that page of the process,
which needs to be currently executed, is swapped into memory. This
method is called _______________. (Pick the right option)
a) Demand Paging
b) Request Paging
c) Swap Paging
d) Change Paging
and the operating system finds the required page in the backing store but
cannot bring in the page into memory for want of free frames. More than one
option exists at this stage:
Terminate the process. This is not a good option because the very
purpose of demand paging to increase CPU utilization and throughput
by increasing the degree of multi-programming is lost.
Swap out a process to free all its frames. This reduces the degree of
multi-programming that again may not be a good option but better than
the first.
Page replacement seems to be the best option in many cases.
The page fault service routine can be modified to include page replacement
as follows:
1) Find for the required page in the backing store.
2) Find for a free frame
a) if there exists one use it
b) if not, find for a victim using a page replacement algorithm
c) write the victim into the backing store
d) modify the page table to reflect a free frame
3) Bring in the required page into the free frame.
4) Update the page table to reflect the change.
5) Restart the process.
When a page fault occurs and no free frame is present, then a swap out and
a swap in occur. A swap out is not always necessary. Only a victim that has
been modified needs to be swapped out. If not, the frame can be over
written by the incoming page. This will save time required to service a page
fault and is implemented by the use of a dirty bit. Each frame in memory is
associated with a dirty bit that is reset when the page is brought into
memory. The bit is set whenever the frame is modified. Therefore, the first
choice for a victim is naturally that frame with its dirty bit which is not set.
Page replacement is basic to demand paging. The size of the logical
address space is no longer dependent on the physical memory. Demand
paging uses two important algorithms:
Page replacement algorithm: When page replacement is necessitated
due to non-availability of frames, the algorithm looks for a victim.
Page faults: 7 7 7 2 2 2 4 4 4 0 0 0 7 7 7
0 0 0 3 3 3 2 2 2 1 1 1 0 0
1 1 1 0 0 0 3 3 3 2 2 2 1
Number of page faults = 15.
The performance of the FIFO algorithm is not always good. The replaced
page may have an initialization module that needs to be executed only once
and therefore no longer needed. On the other hand, the page may have a
heavily used variable in constant use. Such a page swapped out will cause
a page fault almost immediately to be brought in. Thus, the number of page
faults increases and results in slower process execution. Consider the
following reference string:
Reference string: 1 2 3 4 1 2 5 1 2 3 4 5
Memory frames: 1, 2, 3, 4, 5
The chart below (Figure 8.5) gives the number of page faults generated for
each of the 1, 2, 3, 4 and 5 memory frames available.
The LRU page replacement algorithm with 12 page faults is better than the
FIFO algorithm with 15 faults. The problem is to implement the LRU
algorithm. An order for the frames by time of last use is required. Two
options are feasible:
By use of counters
By use of stack
In the first option using counters, each page table entry is associated with a
variable to store the time when the page was used. When a reference to the
page is made, the contents of the clock are copied to the variable in the
page table for that page. Every page now has the time of last reference to it.
According to the LRU page replacement algorithm the least recently used
page is the page with the smallest value in the variable associated with the
clock. Overheads here include a search for the LRU page and an update of
the variable to hold clock contents each time a memory reference is made.
In the second option a stack is used to keep track of the page numbers. A
page referenced is always put on top of the stack. Therefore the top of the
stack is the most recently used page and the bottom of the stack is the LRU
page. Since stack contents in between need to be changed, the stack is
best implemented using a doubly linked list. Update is a bit expensive
because of the number of pointers to be changed, but there is no necessity
to search for a LRU page.
LRU page replacement algorithm does not suffer from Belady’s anomaly.
But both of the above implementations require hardware support since
either the clock variable or the stack must be updated for every memory
reference.
Self Assessment Questions
4. Whenever a page fault occurs instead of using any page replacement
algorithms simply terminate the process. (True / False)
5. ___________ algorithm is more a benchmark algorithm for comparison.
6. Generally when the number of frames available increases, the number
of page faults should decrease. Instead if the page faults also increase,
this unexpected result is called _______________. (Pick the right
option)
a) Charlie’s anamoly
b) Belady’s anamoly
c) John’s anamoly
d) Pascal’s anamoly
8.6 Thrashing
When a process does not have enough frames or when a process is
executing with a minimum set of frames allocated to it which are in active
use, there is always a possibility that the process will page fault quickly. The
page in active use becomes a victim and hence page faults will occur again
and again. In this case a process spends more time in paging than
executing. This high paging activity is called thrashing.
8.6.1 Causes for thrashing
The operating system closely monitors CPU utilization. When CPU
utilization drops below a certain threshold, the operating system increases
the degree of multiprogramming by bringing in a new process to increase
CPU utilization. Let a global page replacement policy be followed. A process
requiring more frames for execution page faults and steals frames from
other processes which are using those frames. This causes the other
processes also to page fault. Paging activity increases with longer queues at
the paging device but CPU utilization drops. Since CPU utilization drops, the
job scheduler increases the degree of multiprogramming by bringing in a
new process. This only increases paging activity to further decrease CPU
utilization. This cycle continues. Thrashing has set in and throughput drops
drastically. This is illustrated in the figure 8.6.
8.7 Summary
Let’s summarize the key points:
In this chapter we have studied a technique called virtual memory that
creates an illusion for the user that he/she has a large memory at
his/her disposal. But in reality, only a limited amount of main memory is
available and that too is shared amongst several users.
We have also studied demand paging which is the main concept needed
to implement virtual memory.
Demand paging brought in the need for page replacements if required
pages are not in memory for execution.
8.9 Answers
Self Assessment Questions
1. True
2. Virtual Memory
3. a) Demand Paging
4. False
Manipal University of Jaipur B1405 Page No. 148
Operating Systems Unit 8
9.1 Introduction
In the last unit, we have discussed about virtual memory and various page
replacement algorithms. The operating system is a resource manager.
Secondary resources like the disk are also to be managed. Information is
stored in secondary storage because it costs less, is non-volatile and
provides large storage space. Processes access data / information present
on secondary storage while in execution. Thus, the operating system has to
properly organize data / information in secondary storage for efficient
access.
The file system is the most visible part of an operating system. It is a way for
on-line storage and access of both data and code of the operating system
and the users. It resides on the secondary storage because of the two main
characteristics of secondary storage, namely, large storage capacity and
non-volatile nature. This unit will give you an overview of file system
interface and its implementation.
Objectives:
After studying this unit, you should be able to:
explain various file concepts
discuss different file access methods
describe various directory structures
list out and explain various disk space allocation methods
manage free space on the disk effectively
implement directory
1) Creating a file: The two steps in file creation include space allocation for
the file and an entry to be made in the directory to record the name and
location of the file.
2) Writing a file: The parameters required to write into a file are the name of
the file and the contents to be written into it. Given the name of the file
the operating system makes a search in the directory to find the location
of the file. An updated write pointer enables to write the contents at a
proper location in the file.
3) Reading a file: To read information stored in a file the name of the file
specified as a parameter is searched by the operating system in the
directory to locate the file. An updated read pointer helps read
information from a particular location in the file.
4) Repositioning within a file: A file is searched in the directory and a given
new value replaces the current file position. No I/O takes place. It is also
known as files seek.
5) Deleting a file: The directory is searched for the particular file. If it is
found, file space and other resources associated with that file are
released and the corresponding directory entry is erased.
6) Truncating a file: In this the file attributes remain the same, but the file
has a reduced size because the user deletes information in the file. The
end of file pointer is reset.
Other common operations are combinations of these basic operations. They
include append, rename and copy. A file on the system is very similar to a
manual file. An operation on a file is possible only if the file is open. After
performing the operation, the file is closed. All the above basic operations
together with the open and close are provided by the operating system as
system calls.
9.2.3 Types of files
The operating system recognizes and supports different file types. The most
common way of implementing file types is to include the type of the file as
part of the file name. The attribute ‘name’ of the file consists of two parts: a
name and an extension separated by a period. The extension is the part of a
file name that identifies the type of the file. For example, in MS-DOS a file
name can be up to eight characters long followed by a period and then a
three-character extension. Executable files have a .com / .exe / .bat
File access is always in terms of blocks. The logical size, physical size and
packing technique determine the number of logical records that can be
packed into one physical block. The mapping is usually done by the
operating system. But since the total file size is not always an exact multiple
of the block size, the last physical block containing logical records is not full.
Some part of this last block is always wasted. On an average half a block is
wasted. This is termed internal fragmentation. Larger the physical block
size, greater is the internal fragmentation. All file systems do suffer from
internal fragmentation. This is the penalty paid for easy file access by the
operating system in terms of blocks instead of bits or bytes.
Self-Assessment Questions
1. The operating system provides a uniform logical view of information
stored in different storage media. (True / False)
2. A _______________ is a collection of related information recorded on
the secondary storage.
3. Usually a block size will be _______________ bytes. (Pick the right
option)
a) 512
b) 256
c) 128
d) 64
best suited where most of the records in a file are to be processed. For
example, transaction files.
9.3.2 Direct access
Sometimes it is not necessary to process every record in a file. It may not be
necessary to process records in the order in which they are present.
Information present in a record of a file is to be accessed only if some key
value in that record is known. In all such cases, direct access is used. Direct
access is based on the disk that is a direct access device and allows
random access of any file block. Since a file is a collection of physical blocks,
any block and hence the records in that block are accessed. For example,
master files. Databases are often of this type since they allow query
processing that involves immediate access to large amounts of information.
All reservation systems fall into this category. Not all operating systems
support direct access files. Usually files are to be defined as sequential or
direct at the time of creation and accessed accordingly later. Sequential
access of a direct access file is possible but direct access of a sequential file
is not.
9.3.3 Indexed sequential access
This access method is a slight modification of the direct access method. It is
in fact a combination of both the sequential access as well as direct access.
The main concept is to access a file direct first and then sequentially from
that point onwards. This access method involves maintaining an index. The
index is a pointer to a block. To access a record in a file, a direct access of
the index is made. The information obtained from this access is used to
access the file. For example, the direct access to a file will give the block
address and within the block the record is accessed sequentially.
Sometimes indexes may be big. So a hierarchy of indexes is built in which
one direct access of an index leads to info to access another index directly
and so on till the actual file is accessed sequentially for the particular record.
The main advantage in this type of access is that both direct and sequential
access of files is possible.
The file system is divided into partitions. By default there is at least one
partition. Partitions are nothing but virtual disks with each partition
considered as a separate storage device.
Each partition has information about the files in it. This information is
nothing but a table of contents. It is known as a directory.
The directory maintains information about the name, location, size and type
of all files in the partition. A directory has a logical structure. This is
dependent on many factors including operations that are to be performed on
the directory like search for file/s, create a file, delete a file, list a directory,
rename a file and traverse a file system. For example, the dir, del, ren
commands in MS-DOS.
9.4.1 Single-level directory
This is a simple directory structure that is very easy to support. All files
reside in one and the same directory (See figure 9.1).
has one master directory for a partition. This directory has entries for each
of the user directories (Refer figure 9.2).
Files with same names exist across user directories but not in the same
user directory. File maintenance is easy. Users are isolated from one
another. But when users work in a group and each wants to access files in
another user’s directory, it may not be possible.
Access to a file is through user name and file name. This is known as a path.
Thus a path uniquely defines a file. For example, in MS-DOS if ‘C’ is the
partitions then C:\USER1\TEST, C:\USER2\TEST, C:\USER3\C are all files
in user directories. Files could be created, deleted, searched and renamed
in the user directories only.
9.4.3 Tree-structured directories
A tree structured directory is a tree of height two with the master file
directory at the root having user directories as descendants that in turn have
the files themselves as descendants (Refer figure 9.3). This generalization
allows users to organize files within user directories into sub directories.
Every file has a unique path. Here the path is from the root through all the
sub directories to the specific file.
Usually the user has a current directory. User created sub directories could
be traversed. Files are usually accessed by giving their path names. Path
names could be either absolute or relative. Absolute path names begin with
the root and give the complete path down to the file. Relative path names
begin with the current directory. Allowing users to define sub directories
allows for organizing user files based on topics. A directory is treated as yet
another file in the directory, higher up in the hierarchy. To delete a directory
it must be empty. Two options exist: delete all files and then delete the
directory or delete all entries in the directory when the directory is deleted.
Deletion may be a recursive process since directory to be deleted may
contain sub directories.
Self Assessment Questions
4. The CPU can directly process the information stored in secondary
memory without transferring it to main memory. (True / False)
5. In _______________ method, information in a file is accessed
sequentially one record after another.
6. A _______________ is a tree of height two with the master file directory
at the root having user directories as descendants that in turn have the
files themselves as descendants. (Pick the right option)
a) Single level directory
b) Tree structured directory
c) Two level directory
d) Directory
Directory:
File Start Length
a. 0 2
per 14 3
hop 19 6
b 28 4
f 6 2
Initially a block is allocated to a file, with the directory having this block as
the start and end. As the file grows, additional blocks are allocated with the
current block containing a pointer to the next and the end block being
updated in the directory.
This allocation method does not suffer from external fragmentation because
any free block can satisfy a request. Hence there is no need for compaction.
Moreover a file can grow and shrink without problems of allocation.
Linked allocation has some disadvantages. Random access of files is not
possible. To access the ith block access begins at the beginning of the file
and follows the pointers in all the blocks till the ith block is accessed.
Therefore access is always sequential. Also some space in all the allocated
blocks is used for storing pointers. This is clearly an overhead as a fixed
percentage from every block is wasted. This problem is overcome by
allocating blocks in clusters that are nothing but groups of blocks. But this
tends to increase internal fragmentation. Another problem in this allocation
scheme is that of scattered pointers. If for any reason a pointer is lost, then
the file after that block is inaccessible. A doubly linked block structure may
solve the problem at the cost of additional pointers to be maintained.
MS-DOS uses a variation of the linked allocation called a File Allocation
Table (FAT). The FAT resides on the disk and contains entry for each disk
block and is indexed by block number. The directory contains the starting
block address of the file. This block in the FAT has a pointer to the next
block and so on till the last block (Refer figure 9.6). Random access of files
is possible because the FAT can be scanned for a direct block address.
Indexed allocation does suffer from wasted block space. Pointer overhead is
more in indexed allocation than in linked allocation. Every file needs an
index block. Then what should be the size of the index block? If it is too big,
space is wasted. If it is too small, large files cannot be stored. More than
one index blocks are linked so that large files can be stored. Multilevel index
blocks are also used. A combined scheme having direct index blocks as well
as linked index blocks has been implemented in the UNIX operating system.
9.5.4 Performance comparison
All the three allocation methods differ in storage efficiency and block access
time. Contiguous allocation requires only one disk access to get a block,
whether it is the next block (sequential) or the ith block (direct). In the case of
linked allocation, the address of the next block is available in the current
block being accessed and so is very much suited for sequential access.
Hence direct access files could use contiguous allocation and sequential
access files could use linked allocation. But if this is fixed then the type of
access on a file needs to be declared at the time of file creation. Thus a
sequential access file will be linked and cannot support direct access. On
the other hand a direct access file will have contiguous allocation and can
also support sequential access; the constraint in this case is making known
the file length at the time of file creation. The operating system will then
have to support algorithms and data structures for both allocation methods.
Conversion of one file type to another needs a copy operation to the desired
file type.
Some systems support both contiguous and linked allocation. Initially all files
have contiguous allocation. As they grow a switch to indexed allocation
takes place. If on an average files are small, than contiguous file allocation
is advantageous and provides good performance.
next free block and so on. But this scheme works well for linked allocation. If
contiguous allocation is used then to search for ‘b’ contiguous free blocks
calls for traversal of the free-space list which is not efficient. The FAT in MS-
DOS builds in free block accounting into the allocation data structure itself
where free blocks have an entry say –1 in the FAT.
9.6.3 Grouping
Another approach is to store ‘n’ free block addresses in the first free block.
Here (n-1) blocks are actually free. The last nth address is the address of a
block that contains the next set of free block addresses. This method has
the advantage that a large number of free block addresses are available at a
single place unlike in the previous linked approach where free block
addresses are scattered.
9.6.4 Counting
If contiguous allocation is used and a file has freed its disk space then a
contiguous set of ‘n’ blocks is free. Instead of storing the addresses of all
these ‘n’ blocks in the free-space list, only the starting free block address
and a count of the number of blocks free from that address can be stored.
This is exactly what is done in this scheme where each entry in the free-
space list is a disk address followed by a count.
search that is time efficient compared to the linear search. But maintaining a
sorted list is an overhead especially because of file creations and deletions.
9.7.2 Hash table
Another data structure for directory implementation is the hash table. A
linear list is used to store directory entries. A hash table takes a value
computed from the file name and returns a pointer to the file name in the
linear list. Thus search time is greatly reduced. Insertions that are prone to
collisions are resolved. The main problem is the hash function that is
dependent on the hash table size. A solution to the problem is to allow for
chained overflow with each hash entry being a linked list. Directory lookups
in a hash table are faster than in a linear list.
Self Assessment Questions
7. In contiguous allocation the disk access time is reduced, as disk head
movement is usually restricted to only one track. (True / False)
8. FAT stands for _______________.
9. If the file size is small, then _______________ is advantageous and
provides good performance. (Pick the right option)
a) Linked allocation
b) Indexed allocation
c) Contiguous file allocation
d) Linked with indexed allocation
9.8 Summary
Let’s recapitulate important points:
The operating system is a secondary resource manager.
Data / information stored in secondary storage have to be managed and
efficiently accessed by executing processes. To do this the operating
system uses the concept of a file.
A file is the smallest allotment of secondary storage. Any information to
be stored needs to be written on to a file.
There are three methods of file access viz. Sequential, Direct and
Indexed sequential.
Contiguous allocation, linked allocation and indexed allocation are
various space allocation methods.
9.10 Answers
Self-Assessment Questions
1. True
2. File
3. a) 512
4. False
5. Sequential Access
6. b) Tree Structured Directory
7. True
8. File Allocation Table
9. c) Contiguous File Allocation
Terminal Questions
1. Information in files could be accessed in many ways. It is usually
dependent on an application. Access methods could be:-
a. Sequential access
b. Direct access
c. Indexed sequential access (Refer Section 9.3)
2. The directory maintains information about the name, location, size and
type of all files in the partition. A directory has a logical structure. This is
dependent on many factors including operations that are to be
performed on the directory like search for file/s, create a file, delete a file,
list a directory, rename a file and traverse a file system. (Refer Section
9.4)
3. Allocation of disk space to files is a problem that looks at how effectively
disk space is utilized and quickly files can be accessed. The three major
methods of disk space allocation are:
a. Contiguous allocation
b. Linked allocation
c. Indexed allocation (Refer Section 9.5)
10.1 Introduction
In the previous unit, we have discussed file system interface and its
implementation. In our earlier discussion about memory hierarchy (Unit 7), it
was implicitly assumed that memory in the computer system would be “fast
enough'' to match the speed of the processor (at least for the highest
elements in the memory hierarchy) and that no special consideration need
be given about how long it would take for a word to be transferred from
memory to the processor – an address would be generated by the
processor, and after some fixed time interval, the memory system would
provide the required information. (In the case of a cache miss, the time
interval would be longer, but generally still fixed. For a page fault, the
processor would be interrupted; and the page fault handling software
invoked.)
Although input-output devices are “mapped’’ to appear like memory devices
in many computer systems, Input-Output (I/O) devices have characteristics
quite different from memory devices, and often pose special problems for
computer systems. This is principally for two reasons:
I/O devices span a wide range of speeds. (E.g. terminals accepting input
at a few characters per second; disks reading data at over 10 million
characters / second).
Unlike memory operations, I/O operations and the CPU are not
generally synchronized with each other.
This unit will give you an overview of various Input / Output features.
Objectives:
After studying this unit, you should be able to:
explain the significance of I/O operations
describe the I/O structure for a medium-scale processor system
discuss I/O control strategies
explain the I/O address space
Note that the I/O devices shown here are not connected directly to the
system bus; they interface with another device called an I/O controller. In
simpler systems, the CPU may also serve as the I/O controller, but in
systems where throughput and performance are important, I/O operations
are generally handled outside the processor.
Figure 10.2 shows a timing diagram for the signals DAV and DAC which
identifies the timing of the four events described previously.
Either the CPU or the I/O device can act as the talker or the listener. In fact,
the CPU may act as a talker at one time and a listener at another. For
example, when communicating with a terminal screen (an output device) the
CPU acts as a talker, but when communicating with a terminal keyboard (an
input device) the CPU acts as a listener.
Self Assessment Questions
1. All I/O devices operate at same speed. (True / False)
2. The signal DAV stands for _______________.
3. The interaction between the CPU and an I/O device is usually referred to
as “_______________. (Pick the right option)
a) Handshaking
b) Communication
c) Talking
d) Listening
each device. This allows for more flexible scheduling of I/O events, as well
as more efficient use of the processor. (Interrupt handling is an important
component of the operating system.)
A third general I/O strategy is to allow the I/O device, or the controller for the
device, access to the main memory. The device would write a block of
information in main memory, without intervention from the CPU, and then
inform the CPU in some way that a block of memory had been overwritten
or read. This might be done by leaving a message in memory, or by
interrupting the processor. (This is generally the I/O strategy used by the
highest speed devices – hard disks and the video controller.)
10.3.1 Program-controlled I/O
One common I/O strategy is program-controlled I/O, (often called polled I/O).
Here all I/O is performed under control of an “I/O handling procedure,'' and
input or output is initiated by this procedure.
The I/O handling procedure will require some status information
(handshaking information) from the I/O device (e.g., whether the device is
ready to receive data). This information is usually obtained through a
second input from the device; a single bit is usually sufficient, so one input
“port'' can be used to collect status, or handshake, information from several
I/O devices. (A port is the name given to a connection to an I/O device; e.g.,
to the memory location into which an I/O device is mapped). An I/O port is
usually implemented as a register (possibly a set of D flip flops) which also
acts as a buffer between the CPU and the actual I/O device. The word port
is often used to refer to the buffer itself.
Typically, there will be several I/O devices connected to the processor; the
processor checks the “status'' input port periodically, under program control
by the I/O handling procedure. If an I/O device requires service, it will signal
this need by altering its input to the “status'' port. When the I/O control
program detects that this has occurred (by reading the status port) then the
appropriate operation will be performed on the I/O device which requested
the service. A typical configuration might look somewhat as shown in
figure 10.3. The outputs labeled “handshake out'' would be connected to bits
in the “status'' port. The input labeled “`handshake in'' would typically be
generated by the appropriate decode logic when the I/O port corresponding
to the device was addressed.
Program controlled I/O is often used for simple operations which must
be performed sequentially. For example, the following may be used to
control the temperature in a room:
DO forever
INPUT temperature
IF (temperature < setpoint) THEN
turn heat ON
ELSE
turn heat OFF
END IF
Note here that the order of events is fixed in time, and that the program
loops forever. (It is really waiting for a change in the temperature, but it
is a “busy wait.'')
10.3.2 Interrupt-controlled I/O
Interrupt-controlled I/O reduces the severity of the two problems mentioned
for program-controlled I/O by allowing the I/O device itself to initiate the
device service routine in the processor. This is accomplished by having the
I/O device generate an interrupt signal which is tested directly by the
hardware of the CPU. When the interrupt input to the CPU is found to be
active, the CPU itself initiates a subprogram call to somewhere in the
memory of the processor; the particular address to which the processor
branches on an interrupt depends on the interrupt facilities available in the
processor.
The simplest type of interrupt facility is where the processor executes a
subprogram branch to some specific address whenever an interrupt input is
detected by the CPU. The return address (the location of the next instruction
in the program that was interrupted) is saved by the processor as part of the
interrupt process.
If there are several devices which are capable of interrupting the processor,
then with this simple interrupt scheme the interrupt handling routine must
examine each device to determine which one caused the interrupt. Also,
since only one interrupt can be handled at a time, there is usually a
hardware “priority encoder'' which allows the device with the highest priority
to interrupt the processor, if several devices attempt to interrupt the
much more efficient if such devices, which can transfer data at a very high
rate, place the data directly into the memory, or take the data directly from
the processor without direct intervention from the processor. I/O performed
in this way is usually called direct memory access, or DMA. The controller
for a device employing DMA must have the capability of generating address
signals for the memory, as well as all of the memory control signals. The
processor informs the DMA controller that data is available (or is to be
placed into) a block of memory locations starting at a certain address in
memory. The controller is also informed of the length of the data block.
Figure 10.4 shows the block diagram of DMA controller.
There are two possibilities for the timing of the data transfer from the DMA
controller to memory:
The controller can cause the processor to halt if it attempts to access data
in the same bank of memory into which the controller is writing. This is the
fastest option for the I/O device, but may cause the processor to run more
slowly because the processor may have to wait until a full block of data is
transferred.
The controller can access memory in memory cycles which are not used
by the particular bank of memory into which the DMA controller is writing
These arbitration schemes may also be used in conjunction with each other.
For example, a set of similar devices may be daisy chained together, and
this set may be an input to a priority encoded scheme. Using interrupts
driven device drivers to transfer data to or from hardware devices works well
when the amount of data is reasonably low. For example a 9600 baud
modem can transfer approximately one character for every millisecond.
If the interrupt latency, the amount of time that it takes between the
hardware device raising the interrupt and the device driver's interrupt
handling routine being called, is low (say 2 milliseconds) then the overall
system impact of the data transfer is very low. The 9600 baud modem data
transfer would only take 0.002% of the CPU's processing time. For high
speed devices, such as hard disk controllers or Ethernet devices the data
transfer rate is a lot higher. A SCSI device can transfer up to 40 Mbytes of
information per second.
Direct Memory Access, or DMA, was invented to solve this problem. A DMA
controller allows devices to transfer data to or from the system's memory
without the intervention of the processor. A PC's ISA DMA controller has 8
DMA channels of which 7 are available for use by the device drivers. Each
DMA channel has associated with it a 16 bit address register and a 16 bit
count register. To initiate a data transfer the device driver sets up the DMA
channel's address and count registers together with the direction of the data
transfer, read or write. It then tells the device that it may start the DMA when
it wishes. When the transfer is complete the device interrupts the PC. Whilst
the transfer is taking place the CPU is free to do other things.
Device drivers have to be careful when using DMA. First of all the DMA
controller knows nothing of virtual memory, it only has access to the
physical memory in the system. Therefore the memory that is being directly
memory accessed to or from must be a contiguous block of physical
memory. This means that you cannot directly access memory into the virtual
address space of a process. You can however lock the processes physical
pages into memory, preventing them from being swapped out to the swap
device during a DMA operation. Secondly, the DMA controller cannot
access the whole of physical memory. The DMA channel's address register
represents the first 16 bits of the DMA address; the next 8 bits come from
the page register. This means that DMA requests are limited to the bottom
16 Mbytes of memory.
DMA channels are scares resources, there are only 7 of them, and they
cannot be shared between device drivers. Just like interrupts the device
driver must be able to work out which DMA channel it should use. Like
interrupts, some devices have a fixed DMA channel. The floppy device, for
example, always uses DMA channel 2. Sometimes the DMA channel for a
device can be set by jumpers, a number of Ethernet devices use this
technique. The more flexible devices can be told (via their CSRs) which
DMA channels to use and, in this case, the device driver can simple pick a
free DMA channel to use.
If the memory locations are cached, then the value in cache may not be
consistent with the new value loaded in memory. Generally, either there is
some method for invalidating cache that may be mapped to I/O addresses,
or the I/O addresses are not cached at all.
Self Assessment Questions
4. The simplest I/O strategy is to use the processor itself as the I/O
controller. (True / False)
5. DMA stands for _______________.
6. A 9600 baud modem can transfer approximately _______________
character for every millisecond. (Pick the right option)
a) Three
b) One
c) Two
d) Four
10.5 Summary
Let’s recapitulate the important points discussed in this unit:
The interaction between the CPU and an I/O device is usually referred to
as “handshaking''.
In program-controlled I/O, all I/O operations are performed under control
of an “I/O handling procedure,'' and input or output is initiated by this
procedure.
Interrupt-controlled I/O allows the I/O device itself to initiate the device
service routine in the processor.
Direct Memory Access (DMA) is a sensible approach for devices which
have the capability of transferring blocks of data at a very high data rate,
in short bursts.
10.7 Answers
Self Assessment Questions
1. False
2. Data valid
3. a) Handshaking
4. True
5. Direct Memory Access
6. b) One
Terminal Questions
1. In the I/O structure of medium sized processors, the I/O controllers and
main memory are connected to the main system bus. The cache
memory (usually found on-chip with the CPU) has a direct connection to
the processor, as well as to the system bus. (Refer Section 10.2 for
detail)
2. Several I/O strategies are used between the computer system and I/O
devices, depending on the relative speeds of the computer system and
the I/O devices. The simplest strategy is to use the processor itself as
the I/O controller, and to require that the device follow a strict order of
events under direct program control, with the processor waiting for the
I/O device at each step. (Refer Section 10.3)
3. In program-controlled I/O, all I/O operations are performed under control
of an “I/O handling procedure,'' and input or output is initiated by this
procedure. Interrupt-controlled I/O allows the I/O device itself to initiate
the device service routine in the processor. This is accomplished by
having the I/O device generate an interrupt signal which is tested directly
by the hardware of the CPU. (Refer Sub-sections 10.3.1 and 10.3.2)
4. In most mini and mainframe computer systems, a great deal of input and
output occurs between the disk system and the processor. These data
can be transferred at a very high rate by placing the data directly into the
memory, or by taking the data directly from the processor without direct
intervention from the processor. I/O performed in this way is usually
called direct memory access, or DMA. (Refer Sub-section 10.3.3)
11.1 Introduction
In the last unit, you have studied input / output architecture of the operating
systems. Earlier were the days of centralized computing. With the advent of
micro and mini computers, distributed processing is becoming more and
more popular. Merely having a large central computer with a number of
remote terminals connected to it or with a number of computers at different
locations with no connection among them do not constitute a distributed
processing because neither processing nor data is distributed in any sense.
In this unit, we shall discuss operating systems in distributed processing.
Objectives:
After studying this unit, you should be able to:
explain the characteristics of centralized and distributed processing
discuss Network Operating System (NOS) architecture
describe the functions of NOS
explain Global Operating System (GOS)
discuss Remote Procedure Call (RPC)
list out the features of distributed file management
Any processor can execute any job. All processors are similar.
All processors run a common operating system.
Distributed processing implies a number of computers connected together to
form a network. This connection enables distributed applications, data,
control or a combination of all of them as against centralized applications,
data and control in centralized systems.
Distributed Applications
Distributed applications mean different programs on different computers.
This scheme allows the possibility of data capture at the place of its origin.
Connections between these computers then allow this data to be shared.
Programs / applications could be distributed in two ways. They are:
Horizontal distribution
Vertical / hierarchical distribution
In horizontal distribution all computers are at the same level implying that all
the computers are capable of handling any functionality. Examples include
office automation and reservation systems where many computers in a
network are able to reserve, cancel or enquire. Application with all its
programs is duplicated at almost all the computers.
In vertical or hierarchical distribution, functionality is distributed among
various levels. These levels usually reflect some hierarchical levels in the
organization. Computers at each of these levels perform specialized
functions. For example, computers at branch level carry out branch level
functions and those at zonal level are used for zonal level functions in a
banking organization. Computers at each level can be networked together to
avail shared data. There are possibilities of connections between levels to
enable exchange of data and information. Here applications running on
different computers may be the same but for an application program
different capabilities may be present at different levels. For example, sales
analysis at branch level and sales analysis at zonal level may generate
summaries in different formats.
Distribution of Data
In a distributed environment, data can also be distributed similar to
distribution of programs. Data for applications could be maintained as:
Centralized data
Replicated data
Partitioned data
In centralized data, data resides only at one central computer that can be
accessed or shared by all other computers in the network. For example,
master database. This central computer must run an operating system that
implements functions of information management. It must keep track of
users and their files and handle data sharing, protection, disk space
allocation and other related issues. It must also run a front-end software for
receiving requests / queries from other computers for data. These requests
are then serviced one by one. It is because of this software that this central
computer is called a server. Computers connected to the server can have
their own local data but shared data has to necessarily reside in the server.
In a distributed environment, part of the master database could be
centralized and the rest distributed among the connecting computers.
Sometimes a particular database is required very often at each computer in
the network. If it is stored only in a central computer, as above, transmitting
it from the server to local computers when required is time consuming and
an unwanted exercise because the current state of the database may not
have changed from a previous state. In such cases, the specific database
can be replicated or duplicated in the computer where it is needed often. But
to maintain data coherence when part of the database has been updated,
the modifications have to be reflected in all the places where it has been
duplicated. For example, information about train timings and fares would
need replication because this information is needed at all terminals which
cater to train bookings / reservations / enquires, the reason being frequency
of changes to this particular database is very low.
Data could be distributed in a partitioned way. The entire database is sliced
into many parts. Each part of the database then resides on a computer.
Processing depends upon the kind of data distribution. Any other computer
wanting to access information / data present not locally but at a remote site
must send a query and receive the contents needed. If such is the case then
each computer will run front-end software to receive queries and act a
server for the data stored in it.
Distribution of Control
Control in a distributed environment refers to deciding which program should
be scheduled to run next, at which node / computer, what is its data
requirement, is there a necessity for data at remote site to be transferred to
the node and so on. Network management routines continuously monitor
lines and nodes. They help in fault detection and suggest and implement
necessary actions to be taken.
Self Assessment Questions
1. Distributed processing and parallel processing are two technologies
used to harness the power of a multiprocessor system. (True / False)
2. NOS stands for ____________________.
3. In _______________ distribution all computers are at the same level
implying that all the computers are capable of handling any functionality.
(Pick the right option)
a) Horizontal
b) Vertical
c) Parallel
d) Hierarchical
module of the NOS generates calls to the operating system, in this case,
UNIX running on the server for required data.
The network services software on the server sends the required data to
the communication management software on the server to be sent to the
client.
The communication management software on the server also
implements network functions such as packetizing, routing, sequence
control, error and flow control to ensure error free data transfer to the
client.
The communication management software on the client now sends the
received data to the application program so that it proceeds.
NOSs are available on LANs. LAN is an interconnection of a number of
workstations to form a network. The network also has a large and more
powerful computer attached to it. This computer called the server has a
large disk and a printer attached to it. The server stores data that can be
accessed by clients connected to the network. The clients in the form of
workstations have small local memories that can be used for storing
frequently accessed data once accessed from the server. Workstations can
also be diskless in which case they have no local memory. The LOS is also
downloaded into main memory during power up. All data in this case is
requested and got from the server.
Self-Assessment Questions
4. In NOS, the shared data resides on the server and clients access the
shared data. (True / False)
5. RPC stands for ____________________.
6. The _______________ software on the client generates a RPC and
sends it across the network. (Pick the right option)
a) Network Management
b) Communication Management
c) Redirection
d) File / Printer Service
Communication management
File / printer services
Network management
Redirection
Redirection software normally resides on the client. It may reside on the
server also; because, if it is not a dedicated one then user of the server
machine may want access to other computers. When does the redirection
software actually work? An interrupt is executed by a system call generated,
say for an I/O. It is at the time of execution of the interrupt that redirection
software intercepts to check if the I/O is local / remote. If it is local,
processing continues. If it is remote the redirection software has to generate
a request to the server. But generating a request to the server has problems.
The operating system running on the server may be different from that on
the local machine generating the request. Also system architecture of the
server may be different from the client. Therefore some conversion is
necessary.
Communication Management
The communication management software runs on both the client and the
server. It is responsible for communication management. It is concerned
with error-free transmission of messages (requests and data) to the
destination. The ordinary operating system depends on separate software
for this purpose. But in a NOS environment communication management
software is built into the NOS as a part of it. Thus it resides on all clients and
the server. It consists of a number of modules corresponding to the Open
System Interconnect (OSI) layers.
File / Printer Services
File / printer resources are controlled by these services. This software runs
only on the server. Requests for shared resources are queued up,
scheduled and then run as separate tasks, thus making the NOS a
multitasking operating system.
Network Management Software
Network management software is responsible for monitoring the network
and its components such as computers, modems, repeaters, lines, adapters,
multiplexers and many more. Special software enables online testing of
these equipments from time to time, checks their status and hence monitors
the entire network. The network management software is responsible for all
this. It maintains a list of hardware equipment along with its location and
status. The list is updated when additional equipment is added or when
equipment is down for repair. It generates reports based on which action
can be taken in terms of repair / replacements. It helps routing algorithms to
route data on appropriate paths. The network management software resides
on top of the existing operating system in ordinary operating systems. But in
a NOS environment it is part of the NOS.
Self-Assessment Questions
7. File / Printer resources software runs both on client and server. (True /
False)
8. OSI stands for ____________________.
9. _______________ software is responsible for monitoring the network
and its components such as computers, modems, repeaters, lines,
adapters, multiplexers and many more. (Pick the right option)
a) Network Management
b) Communication Management
c) Redirection
d) File / Printer
A typical GOS environment is depicted in the figure 11.2. Part of the kernel
of a GOS is duplicated at all sites. This kernel contains software to control
hardware. Resources like information, memory, etc are managed by
software that need not be replicated.
Sometimes a process may be scheduled on a node that does not have the
necessary requirements for the process because of which the process does
not complete execution but is waiting in a blocked state for a long time.
Since it was the only processor at the time of allocation it runs the process.
Now that another processor with higher capacity is free, the GOS should be
able to migrate the process to the new processor. There exists a tradeoff
between the gain in performance of the migrated process and the
overheads involved.
GOS may resort to process migration to enforce:
Load balancing: to have a uniform utilization of available resources
Special facilities: to use hardware / software facilities available at a
particular node
Reducing network load: process execution at a proper node reduces
data migration and hence the load on the network.
Resource Allocation/ De-allocation
The GOS maintains a global list of all resources and allocates them to
processes. This also includes migrated processes. The resource allocation
may lead to deadlocks. Deadlock handling in distributed systems is complex
due to difficulties in maintaining an updated list of global resources. There is
also a possibility of a false deadlock alarm. This may be caused because of
incorrect information about resources that in turn may be due to delay in
resource status reaching the global list. Deadlock detection can be
centralized or a distributed functions. Deadlocks can also occur in the
communication system due to buffers getting full.
Self Assessment Questions
10. The NOS is not responsible for activities such as memory and process
management on the server. (True / False)
11. GOS stands for ____________________.
12. Migrations are necessary for optimal use of available resources.
Migrations include: (Pick the right option)
a) Data migration
b) Computation migration
c) Process migration
d) All of the above
Types of Services
Message passing can be of two types. They are:
Reliable service
Unreliable service
interface process completes the call and returns the results after which the
client process becomes ready again.
Parameter Representation
If an RPC is issued between processes running on identical machines with
same operating systems then parameters passed will be identical for a
given language. But this is not the case if the machine architecture or the
operating system or the programming language differs. One approach to
this problem could be to have a common standard format. Then each
interface module will have routines to convert from / to its own formats to /
from the standard format. These routines will have to be present in all nodes
as well as the server.
Ports
If a server provides multiple services then normally a port number is
associated with each service. For example, port number 1154 for listing
current users, port number 2193 for opening a file and so on. RPC makes
Manipal University of Jaipur B1405 Page No. 198
Operating Systems Unit 11
386 can support multiple machines and multiple networks / distributed file
systems at the same time.
Self Assessment Questions
13. A procedure is present on the server to locate and retrieve data present
on a shared device attached to it. (True / False)
14. In RPC _______________ is very difficult because it is difficult to let
processors on different machines to share a common address space.
15. _______________ can support multiple machines and multiple
networks/ distributed file systems at the same time. (Pick the right
option)
a) DOS
b) NetWare-386
c) Windows
d) Linux
11.8 Summary
Let’s recapitulate important points discussed in this unit:
Operating systems have moved from single process systems to single
processor, multi-user, and multitasking systems.
Distributed processing and parallel processing have a common goal i.e.
high throughput using more processors.
In distributed processing, computers have to be connected to one
another by links enabling electronic data transfer and data sharing
among the various connected computers.
The main functions of NOS include: Redirection, Communication
management, File / printer services and Network management.
The GOS has a pool of resources that it allocates to various processes /
tasks at a global level.
11.10 Answers
Self Assessment Questions
1. True
2. Network Operating System
3. a) Horizontal
4. True
5. Remote Procedure Call
6. b) Communication Management
7. False
8. Open System Interconnect
9. a) Network Management
10. False
11. Global Operating System
12. d) All of the above
13. True
14. Call by reference
15. b) Netware-386
Terminal Questions
1. In distributed processing, computers have to be connected to one
another by links enabling electronic data transfer and data sharing
among the various connected computers. (Refer section 11.2)
2. The basic features in any NOS are explained by tracing the steps
involved in a remote read. It is assumed that shared data resides on the
server and clients are those computers in the network (other than the
server) that want to access the shared data. (Refer section 11.3)
3. Part of the kernel of a GOS is duplicated at all sites. This kernel contains
software to control hardware. Resources like information, memory, etc.
are managed by software that need not be replicated. (Refer section
11.5)
4. A procedure is present on the server to locate and retrieve data present
on a shared device attached to it. This procedure is part of the operating
system running on the server. When a client requests for some data on
the server this procedure on the server operating system is called
remotely from the client. Hence it is called a remote procedure call
(RPC). (Refer section 11.6)
12.1 Introduction
In the previous unit, we have discussed the role of operating systems in
distributed environment. Unlike computers in distributed environment,
personal computers are designed and intended for individual use. Hence
security and protection features were minimal. No two users could
simultaneously use the same machine. Locking the room physically which
housed the computer and its accessories could easily protect data and
stored information. But today hardware costs have reduced and people
have access to a wide variety of computing equipment. With a trend towards
networking, users have access to data and code present locally as well as
at remote locations. The main advantages of networking like data sharing
and remote data access have increased the requirements of security and
protection. Security and protection are the two main features that motivated
development of a network operating system (example Novell NetWare). In
this unit, let’s discuss the methods of data security and protection.
Objectives:
After studying this unit, you should be able to:
explain various attacks on computer security
discuss different types of computer viruses and worms
12.6 Authentication
Authentication is a process of verifying whether a person is a legal user or
not. This can be by either verification of users logging into a centralized
system or authentication of computers that are to work in a network or a
distributed environment.
Password is the most commonly used scheme. It is easy to implement. User
name is associated with a password. This is stored in encrypted form by the
system. When the user logs onto the system, the user has to enter his user
name and password against a prompt. The entered password is then
encrypted and matched with the one that is stored in the file system. A tally
will allow the user to login. No external hardware is needed. But limited
protection is provided.
The password is generally not echoed on the screen while being keyed in.
Also it is stored in encrypted form. It cannot be deciphered easily because
knowing the algorithm for deciphering will not suffice as the key is ought to
be known for deciphering it.
Choosing a password can be done by the system or by the system
administrator or by the users themselves. A system-selected password is
not a good choice as it is difficult to remember. If the system administrator
gives a user a password then more than one person knows about it. User
chosen passwords is practical and popular. Users should choose passwords
that are not easy to guess. Choosing user names, family names, names of
cities, etc are easy to guess.
Length of a password plays an important role in the effectiveness of the
password. If it is short it is easy to remember and use but easy to decipher
too. Longer the password it is difficult to break and also to remember and
key in. Trade off results in a password of length 6-8 characters.
Salting is a technique to make it difficult to break a password. Salting
technique appends a random number ‘n’ to the password before encryption
is done. Just knowing the password is not enough. The system itself
calculates, stores and compares these random numbers each time a
password is used.
Multiple passwords at different levels could provide additional security.
Change of password at regular intervals is a good practice. Many operating
systems allow a user to try only a few guesses for a login after which the
user is logged off the system.
12.8 Encryption
Encryption is an important tool in protection, security and authentication.
The process involves two steps (Refer figure 12.1):
Encryption: the original message is changed to some other form
Decryption: the encrypted message is restored back to the original
Data before encryption is called plain text and after encryption is called
cipher text. Usually the above operations are performed by hardware.
Encryption could be by one of the following two basic methods:
Transposition ciphers
Substitution ciphers
In transposition ciphers the contents of the data are not changed but the
order is changed. For example, a message could be sent in reverse order
like:
I am fine enif ma I
Rail fence cipher is a method that belongs to this class. The method is slow
because the entire message is to be stored and then encrypted. It also
requires more storage space when messages are long.
Caesar cipher is a popular method of this type. This method is fast and
requires less memory because characters can be changed as they are read
and no storage is required. Variations of this scheme are used for bit
streams. Encryption in this case involves adding a key to every bit stream
and decryption is removing the key from the cipher text. Thus every
algorithm has a key. It must ensure restoration. Normally a single piece of
hardware is responsible for both encryption and decryption.
In the conventional encryption scheme two parties A and B agree upon a
key. Someone say A or B or a third party has to decide upon this common
key; get concurrence from concerned parties and initiate communication.
This is called key distribution. Each pair of nodes needs a unique key. If
there are ‘n’ nodes then there will be n*(n-1)/2 keys. If ‘n’ is large then the
number of keys will also be large. Deciding, conveying and storing these
keys is a mammoth job. Tapping can take place. This is the key distribution
problem.
An alternate is the public key encryption. Keys used for encryption and
decryption are not the same. Key K1 is used for encryption and another key
K2 is used for decryption. A message encrypted using K1 can be decrypted
only using K2 and not K1. One of the keys is publicly known. Hence this
type of encryption is called public key encryption. Decryption is done using a
private key and hence information cannot leak out. Interchange of keys K1
and K2 is possible, that is, K2 to encrypt and K1 to decrypt.
Each user has two keys, one public and one private (See figure 12.2). The
private key is a secret but the user publishes the public key to a central key
database. The database maintains public keys of different users.
Link encryption needs more encryption / decryption devices, usually two for
each link. This allows total encryption of a packet and prevents tapping. The
method is expensive and slow. A combination of both is possible.
Message authentication allows users to verify that data received is authentic.
Usually the following attributes of a user need to be authenticated:
Actual message
Time at which sent
Sequence in which sent
Source from which it has arrived
Common methods for message authentication are:
Authentication code
Encryption
Digital signatures
In authentication code, a secret key is used to generate a check sum, which
is sent along with the data. The receiver performs the same operation using
the same secret key on the received data and regenerates the check sum. If
both of them are same then the receiver knows the sender since the secret
key is known to only both of them. Conventional encryption provides
authentication but suffers from key distribution problems and public key
encryption provides good protection but no authentication.
Digital signature is like a human signature on paper. If a signed letter is sent
by A to B, A cannot deny having sent it to B (B has the signed copy) and B
cannot refuse having got it (A has an acknowledgement for B having
received it). This is what happens in a manual system and should happen in
electronic messages as well.
As discussed earlier, public key encryption provides protection but not
authentication. If we want to authentication without protection, reversal of
the keys applied is a solution as shown in figure 12.3.
This is based on the concept that public key encryption algorithm works by
using either of the keys to encrypt and the other for decryption. A encrypts
the message to be sent to B using its private key. At the other end B
decrypts the received message using A’s public key which is known to
everybody. Thus B knows that A has sent the message. Protection is not
provided as anyone can decrypt the message sent by A.
If both authentication and protection are needed then a specific sequence of
public and private keys is used as shown in below figure 12.4. The two keys
are used as shown. At points 2 and 4 the cipher text is the same. Similarly
at points 1 and 5 the text is the same. Authentication is possible because
between 4 and 5 decryption is done by A’s public key and is possible only
because A has encrypted it with its private key. Protection is also
guaranteed because from point 3 onwards only B can decrypt with its
private key. This is how digital signatures work.
Fig. 12.4: Public key Encryption for both authentication and protection
12.10 Summary
Let’s recapitulate important points discussed in this unit:
Security is concerned with the ability of the operating system to enforce
control over storage and movement of data in and between the objects
that the operating system supports.
Unauthorized use of service (tapping) and unauthorized disclosure of
information (disclosure) are passive threats whereas unauthorized
alteration or deletion of information (amendment), unauthorized
generation of information (fabrication) and denial of service to authorized
users (denial) are active threats.
A computer worm is a full program by itself. It spreads to other
computers over a network and while doing so consumes network
resources to a very large extent. It can potentially bring the entire
network to a halt.
A computer virus is written with an intention of infecting other programs.
It is a part of a program that piggybacks on to a valid program.
Encryption is an important tool in protection, security and authentication
12.12 Answers
Self Assessment Questions
1. True
2. Integrity
3. a) Authentication
4. False
5. Virus
6. Anti-virus
7. True
8. Saltzer, Schroeder
9. Capability list
Manipal University of Jaipur B1405 Page No. 217
Operating Systems Unit 12
10. True
11. Plain, Cipher
12. Private key, Public key
Terminal Questions
1. Security is concerned with the ability of the operating system to enforce
control over storage and movement of data in and between the objects
that the operating system supports. (Refer section 12.2 for detail)
2. A computer worm is a full program by itself. It spreads to other
computers over a network and while doing so consumes network
resources to a very large extent. It can potentially bring the entire
network to a halt. A computer virus is written with an intention of
infecting other programs. It is a part of a program that piggybacks on to
a valid program. (Refer sections 12.3 and 12.4)
3. Authentication is a process of verifying whether a person is a legal user
or not. This can be by either verification of users logging into a
centralized system or authentication of computers that are to work in a
network or a distributed environment. (Refer section 12.6)
4. Encryption is an important tool in protection, security and authentication.
Data before encryption is called plain text and after encryption is called
cipher text. Usually the above operations are performed by hardware.
(Refer section 12.8)
13.1 Introduction
In the previous unit, we have discussed a most important issue viz. security
and protection of data in computers. Once we secure our data, the next
concern will be to increase the speed and performance of computers and
that is what we shall discuss in this unit. There are basically two ways of
increasing the speed of computer hardware. They are by using:
High speed components
New architectural structures
In the first category, high-speed components rely on exotic technology and
fabrication processes and such technologies and processes tend to be
expensive and non-standardized. Multiprocessor systems fall into the
second category and provide an alternative for improving performance of
computer systems by coupling a number of low cost standard processors.
Objectives:
After studying this unit, you should be able to:
explain the advantages of multiprocessors
discuss the classification of multiprocessors
describe the interconnections in multiprocessors
list out the types of multiprocessor operating systems
13.2 Multiprocessors
Multiprocessing can be applied to provide:
Increased throughput: by executing a number of different user
processes on different processors in parallel.
Application speedup: by executing some portion of the application in
parallel.
Throughput can be improved by executing a number of unrelated user
processes on different processors in parallel. System throughput is
improved as a large number of tasks are completed in unit time.
Application speedup may be obtained by exploiting the hidden parallelism in
the application by creating multiple threads / processes / tasks for execution
on different processors.
Inter-processor communication and synchronization are an overhead in
multiprocessor systems. Design goals aim to minimize inter-processor
interaction and provide an efficient mechanism for carrying them out when
necessary.
Advantages of multiprocessors are manifold, which are given below:
Performance and computing power: Use of multiprocessor systems
speeds up an application. Problems with high inter-processor interaction
can be solved quickly.
Fault tolerance: The inherent redundancy in multiprocessor systems can
be used to increase availability and eliminate single point failures.
Flexibility: A multiprocessor system can be made to dynamically
reconfigure itself so as to optimize different objectives for different
applications such as throughput, application speedup or fault tolerance.
Modular growth: Use of a modular system design overcomes certain
problems and can be accomplished say by adding exactly tailor made
components such as processors, memories, I/O devices and the like.
Functional specialization: Specialized processors can be added to
improve performance in particular applications.
in the interconnection paths of the past have reduced drastically with the
use of optical fiber links and high speed LANs.
Hybrid systems: Hybrid systems have both local and global memories.
Some loosely coupled systems also allow access of global memory in
addition to local memory.
Based on memory and access delays, multiprocessor systems are classified
as:
Uniform Memory Access (UMA): Multiple processors can access all the
available memory with the same speed.
Non Uniform Memory Access (NUMA): Different areas of memory have
different access times. This is based on the nearness of the memory to a
given processor and also on the complexity of the switching logic
between the processor and the memory.
NO Remote Memory Access (NORMA): Systems have no shared
memory.
Self-Assessment Questions
1. Use of multiprocessor systems speeds up an application. (True / False)
2. SIMD stands for ____________________.
3. Distributed systems fit into the class of _______________ systems.
(Pick the right option)
a) Loosely coupled
b) Tightly coupled
c) Hybrid
d) Non-hybrid
Bus-oriented systems
A shared bus connects processors and memory in the multiprocessor
system as shown in figure 13.1.
P P P P
Cache Cache Cache Cache
Shared memory
Processors communicate with each other and the shared memory through
the shared bus. Variations of this basic scheme are possible where
processors may or may not have local memory, I/O devices may be
attached to individual processors or the shared bus and the shared memory
itself can have multiple banks of memory.
The bus and the memory being shared resources there is always a
possibility of contention. Cache memory is often used to release contention.
Cache associated with individual processors provides a better performance.
A 90% cache hit ratio improves the speed of the multiprocessor systems
nearly 10 times as compared to systems without cache.
Existence of multiple caches in individual processors creates problems.
Cache coherence is a problem to be addressed. Multiple physical copies of
the same data must be consistent in case of an update. Maintaining cache
coherence increases bus traffic and reduces the achieved speedup by some
amount. Use of a parallel bus increases bandwidth.
The tightly coupled, shared bus organization usually supports 10 processors.
Because of its simple implementation many commercial designs of
multiprocessor systems are based on shared-bus concept.
Crossbar-connected systems
An interconnection of processors and memory in a multiprocessor system
using crossbar approach is shown in figure 13.2:
M0 M1 M2 Mn-1
P0
P1
M2
Mn-1
Fig. 13.2: Crossbar interconnection
Hyper cubes
A 3-dimensional hypercube can be visualized as shown in figure 13.3:
110 111
010 Topology
011
101
100
000 001
P0 M0
P1 M1
P2 M2
P3 M3
P4 M4
P5 M5
P6 M6
P7 M7
13.8 Summary
Let’s recapitulate important concepts discussed in this unit:
Multiprocessor systems provide an alternative for improving
performance of computer systems by coupling a number of low cost
standard processors.
Flynn classified computer systems based on how the machine relates its
instructions to the data being processed. Instructions may form either a
single instruction stream or a multiple instruction stream.
Complexity, cost, IPC and scalability are some features considered in
interconnections.
Memory management in multiprocessor systems is dependent on the
architecture and interconnection scheme.
In tightly coupled multiprocessor systems the operating system must
provide access to shared memory through primitives for allocation and
reallocation of shared memory segments.
13.10 Answers
Self Assessment Questions
1. True
2. Single Instruction stream, Multiple Data stream
3. a) Loosely coupled
4. False
5. Master / Slave
6. b) Crossbar Interconnection Systems
7. True
8. Translation Look-aside Buffers
9. c) Applications
Terminal Questions
1. Use of multiprocessor systems speeds up an application. Problems with
high inter-processor interaction can be solved quickly. The inherent
redundancy in multiprocessor systems can be used to increase
availability and eliminate single point failures. (Refer section 13.2 for
detail)
2. Flynn classified computer systems based on how the machine relates its
instructions to the data being processed. Instructions may form either a
single instruction stream or a multiple instruction stream. Similarly the
data which the instructions use could be either single or multiple. (Refer
section 13.3 for details)
3. The nature of multiprocessor interconnections has an effect on the
bandwidth for communication. Complexity, cost, IPC and scalability are
some features considered in interconnections. (Refer section 13.4 for
details)
4. Three basic types of multiprocessor operating systems are: Separate
supervisors, Master / Slave and Symmetric. (Refer section 13.5 for
details)
5. The operating system can support multiprocessors by providing a
mechanism for creating and maintaining a number of processes /
threads. Each process has allocated resources, state and accesses I/O
devices. (Refer section 13.7 for details)
14.1 Introduction
In the previous unit, we have discussed about multiprocessor systems. Now
it is the time to focus our attention on most popular series of operating
systems viz. Windows.
Windows 2000, Windows XP and Windows Server 2003 are all part of the
Windows NT (New Technology) family of Microsoft operating systems. They
are all preemptive, reentrant operating systems, which have been designed
to work with either uniprocessor- or symmetrical multi processor (SMP)-
based Intel x86 computers. To process input/output (I/O) requests it uses
packet-driven I/O which utilizes I/O request packets (IRPs) and
asynchronous I/O. Starting with Windows XP, Microsoft began building in
64-bit support into their operating systems – before this their operating
systems were based on a 32-bit model. This unit briefly discusses about
various Windows operating systems.
Objectives:
After studying this unit, you should be able to:
explain the architectural details of Windows NT
discuss functionality and operations of Windows NT
describe the services of Windows NT
explain the deployment related issues in Windows NT
system reference that object and thereby determines whether the object can
be destroyed when a close request is sent to it. Every object exists in a
hierarchical object namespace.
Further executive subsystems are the following:
(i) I/O manager: It allows devices to communicate with user-mode
subsystems. It translates user-mode read and write commands in read or
write IRPs which it passes to device drivers. It accepts file system I/O
requests and translates them into device specific calls, and can incorporate
low-level device drivers that directly manipulate hardware to either read
input or write output. It also includes a cache manager to improve disk
performance by caching read requests and write to the disk in the
background
(ii) Security reference monitor (SRM): The primary authority for enforcing
the security rules of the security integral subsystem. It determines whether
an object or resource can be accessed, via the use of access control lists
(ACLs), which are made up of access control entries (ACEs). ACEs contain
a security identifier (SID) and a list of operations that the ACE gives a select
group of trustees – a user account, group account, or logon session –
permission (allow, deny, or audit) to that resource.
(iii) IPC manager: Short for Inter Process Communication Manager, this
manages the communication between clients (the environment subsystem)
and servers (components of the Executive). It can use two facilities: the
Local Procedure Call (LPC) facility (clients and servers on the one
computer) and the Remote Procedure Call (RPC) facility (where clients and
servers are situated on different computers. Microsoft has had significant
security issues with the RPC facility.
(iv) Virtual memory manager: It manages virtual memory, allowing
Windows 2000 to use the hard disk as a primary storage device (although
strictly speaking it is secondary storage). It controls the paging of memory in
and out of physical memory to disk storage.
(v) Process manager: It handles process and thread creation and
termination
(vi) PnP manager: It handles Plug and Play and supports device detection
and installation at boot time. It also has the responsibility to stop and start
devices on demand – sometimes this happens when a bus gains a new
device and needs to have a device driver loaded to support that device.
Both FireWire and USB are hot-swappable and require the services of the
PnP Manager to load, stop and start devices. The PnP manager interfaces
with the HAL, the rest of the executive (as necessary) and with device
drivers.
(vii) Power manager: The power manager deals with power events and
generates power IRPs. It coordinates these power events when several
devices send a request to be turned off it determines the best way of doing
this.
The display system has been moved from user mode into the kernel mode
as a device driver contained in the file Win32k.sys. There are two
components in this device driver – the Window Manager and the GDI.
(viii) Window manager: It is responsible for drawing windows and menus.
It controls the way that output is painted to the screen and handles input
events (such as from the keyboard and mouse), then passes messages to
the applications that need to receive this input
(ix) GDI: The Graphics Device Interface is responsible for tasks such as
drawing lines and curves, rendering fonts and handling palettes. Windows
2000 introduced native alpha blending into the GDI.
(x) Microkernel & kernel-mode drivers: The Microkernel sits between the
HAL and the Executive and provides multiprocessor synchronization, thread
and interrupt scheduling and dispatching, and trap handling and exception
dispatching. The Microkernel often interfaces with the process manager.
The microkernel is also responsible for initializing device drivers at boot-up
that are necessary to get the operating system up and running.
(xi) Hardware abstraction layer: The Windows NT Hardware Abstraction
Layer, or HAL, is a layer between the physical hardware of the computer
and the rest of the operating system. It was designed to hide differences in
hardware and therefore provide a consistent platform on which applications
may run. The HAL includes hardware specific code that controls I/O
interfaces, interrupt controllers and multiple processors.
Self-Assessment Questions
1. User mode in the Windows NT line is made of subsystems capable of
passing I/O requests to the appropriate kernel mode software drivers by
using the I/O manager. (True / False)
Manipal University of Jaipur B1405 Page No. 239
Operating Systems Unit 14
The executive interfaces with all the user mode subsystems. It deals with
I/O, object management, security and process management. It contains
various components, including:
Object manager: A special executive subsystem that all other executive
subsystems must pass through to gain access to Windows 2000 resources.
This essentially is a resource management infrastructure service that allows
Windows 2000 to be an object oriented operating system.
I/O manager: Allows devices to communicate with user-mode subsystems
by translating user-mode read and write commands and passing them to
device drivers.
Security reference monitor (SRM): The primary authority for enforcing the
security rules of the security integral subsystem.
IPC manager: Manages the communication between clients (the
environment subsystem) and servers (components of the executive).
Virtual memory manager: Manages virtual memory, allowing Windows
2000 to use the hard disk as a primary storage device (although strictly
speaking it is secondary storage).
Process manager: Handles process and thread creation and termination.
PnP manager: Handles Plug and Play and supports device detection and
installation at boot time.
Power manager: The power manager coordinates power events and
generates power IRPs.
The display system is handled by a device driver contained in Win32k.sys.
The Window Manager component of this driver is responsible for drawing
windows and menus while the GDI (graphical device interface) component
is responsible for tasks such as drawing lines and curves, rendering fonts
and handling palettes.
The above features are same as that of Windows NT.
Self-Assessment Questions
4. Kernel mode in Windows 2000 has full access to the hardware and
system resources of the computer. (True / False)
5. GDI stands for ______________________________________.
contain many areas that only have zeroes. Reparse points allow the object
manager to reset a file namespace lookup and let file system drivers
implement changed functionality in a transparent manner. Reparse points
are used to implement Volume Mount Points, Directory Junctions,
Hierarchical Storage Management, Native Structured Storage and Single
Instance Storage. Volume mount points and directory junctions allow for a
file to be transparently referred from one file or directory location to another.
Encrypting file system
The Encrypting File System (EFS) introduced strong encryption into the
Windows file world. It allowed any folder or drive on an NTFS volume to be
encrypted transparently to the end user. EFS works in conjunction with the
EFS service, Microsoft's CryptoAPI and the EFS File System Run-Time
Library (FSRTL). As of February 2004, its encryption has not been
compromised.
EFS works by encrypting a file with a bulk symmetric key (also known as the
File Encryption Key, or FEK), which is used because it takes a relatively
smaller amount of time to encrypt and decrypt large amounts of data than if
an asymmetric key cipher is used. The symmetric key that is used to encrypt
the file is then encrypted with a public key that is associated with the user
who encrypted the file, and this encrypted data is stored in the header of the
encrypted file. To decrypt the file, the file system uses the private key of the
user to decrypt the symmetric key that is stored in the file header. It then
uses the symmetric key to decrypt the file. Because this is done at the file
system level, it is transparent to the user. Also, in case of a user losing
access to their key, support for recovery agents that can decrypt files has
been built in to the EFS system.
Basic and dynamic disk storage
Windows 2000 introduced the Logical Disk Manager for dynamic storage. All
versions of Windows 2000 support three types of dynamic disk volumes
(along with basic storage): simple volumes, spanned volumes and striped
volumes:
Simple volume: This is a volume with disk space from one disk.
Spanned volumes: Multiple disks spanning up to 32 disks. If one disk fails,
all data in the volume is lost.
Striped volumes: Also known as RAID-0, a striped volume stores all its
data across several disks in stripes. This allows better performance because
disk read and writes are balanced across multiple disks. Windows 2000 also
added support for iSCSI protocol.
Accessibility support
The Windows 2000 onscreen keyboard map allows users who have
problems with using the keyboard to use a mouse to input text.
Microsoft made an effort to increase the usability of Windows 2000 for
people with visual and auditory impairments and other disabilities. They
included several utilities designed to make the system more accessible.
FilterKeys are a group of keyboard related support for people with typing
issues, and include:
SlowKeys: Windows is told to disregard keystrokes that are not held down
for a certain time period.
BounceKeys: Multiple keystrokes to one key to be ignored within a certain
timeframe.
RepeatKeys: Allows users to slow down the rate at which keys are
repeated via the keyboard's key repeat feature.
ToggleKeys: When turned on, Windows will play a sound when either the
CAPS LOCK, NUM LOCK or SCROLL LOCK keys are pressed.
MouseKeys: Allows the cursor to be moved around the screen via the
numeric keypad instead of the mouse.
On screen keyboard: Assists those who are not familiar with a given
keyboard by allowing them to use a mouse to enter characters to the
screen.
SerialKeys: Gives Windows 2000 the ability to support speech
augmentation devices.
StickyKeys: Makes modifier keys (ALT, CTRL and SHIFT) become "sticky"
– in other words a user can press the modifier key, release that key and
then press the combination key. Normally the modifier key must remain
pressed down to activate the sequence.
On screen magnifier: Assists users with visual impairments by magnifying
the part of the screen they place their mouse over.
Narrator: Microsoft Narrator assists users with visual impairments with
system messages, as when these appear the narrator will read this out via
the sound system.
Manipal University of Jaipur B1405 Page No. 245
Operating Systems Unit 14
system information viewer, the ability to view open shared folders and
shared folder sessions, a device manager and a tool to view all the local
users and groups on the Windows 2000 computer. It also contains a disk
management snap-in, which contains a disk defragmenter as well as other
disk management utilities. Lastly, it also contains a services viewer, which
allows users to view all installed services and to stop and start them on
demand, as well as configure what those services should do when the
computer starts.
REGEDIT.EXE utility
Windows 2000 comes bundled with two utilities to edit the Windows registry.
One acts like the Windows 9x REGEDIT.EXE program and the other could
edit registry permissions in the same manner that Windows NT's
REGEDT32.EXE program could. REGEDIT.EXE has a left-side tree view
that begins at "My Computer" and lists all loaded hives. REGEDT32.EXE
has a left-side tree view, but each hive has its own window, so the tree
displays only keys. REGEDIT.EXE represents the three components of a
value (its name, type, and data) as separate columns of a table.
REGEDT32.EXE represents them as a list of strings. REGEDIT.EXE was
written for the Win32 API and supports right-clicking of entries in a tree view
to adjust properties and other settings. REGEDT32.EXE was also written for
the Win32 API and requires all actions to be performed from the top menu
bar. Because REGEDIT.EXE was directly ported from Windows 98, it does
not support permission editing (permissions do not exist in Windows 9x).
Therefore, the only way to access the full functionality of an NT registry was
with REGEDT32.EXE, which uses the older multiple document interface
(MDI), which newer versions of REGEDIT do not use. Windows XP was the
first system to integrate these two programs into one, adopting the
REGEDIT.EXE behavior with the additional NT functionality.
The System File Checker (SFC) also comes bundled with Windows 2000. It
is a command line utility that scans system files and verifies whether they
were signed by Microsoft and works in conjunction with the Windows File
Protection mechanism. It can also repopulate and repair all the files in the
Dllcache folder.
Recovery console
The Recovery Console is usually used to recover unbootable systems. The
14.5 Summary
Let’s recapitulate important points discussed in this unit:
The Windows NT operating system family's architecture consists of two
layers (user mode and kernel mode), with many different modules within
both of these layers.
The user mode is made up of subsystems which can pass I/O requests
to the appropriate kernel mode drivers via the I/O manager (which exists
in kernel mode).
The environment subsystem was designed to run applications written for
many different types of operating systems.
The integral subsystem looks after operating system specific functions
on behalf of the environment subsystem.
Windows 2000 has support for many languages other than English.
Windows 2000 introduced the Microsoft Management Console (MMC),
which is used to create, save, and open administrative tools.
14.7 Answers
Self Assessment Questions
1. True
2. Hardware Abstraction Layer
3. a) GDI
4. False
5. Graphical Device Interface
6. b) IPC
7. True
8. Microsoft Management Console
9. c) Narrator
Terminal Questions
1. The Windows NT operating system family's architecture consists of two
layers (user mode and kernel mode), with many different modules within
both of these layers. User mode in the Windows NT line is made of
subsystems capable of passing I/O requests to the appropriate kernel
mode software drivers by using the I/O manager. (Refer section 14.2 for
detail)
–––––––––––––––––––––