You are on page 1of 42

raj 1

1. INTRODUCTION OF OPERATING SYSTEM


Q - What is an Operating system?

Operating system is a system software that is extremely important to activate and co-
ordinate the activities of various hardware resources like the processor, input output devices etc. It
also controls the movement of information in the computer system.
It is the first program who loaded into the computer memory when we boot our computer
system. It provides a standard to its application software so that application software can talk to
operating system or each other easily.
The main functions of an operating system are...
(i) It assigns a processor to different tasks being performed by the computer system.
(ii) It allocates the main memory and other storage areas to the system programs as well as user
programs and data.
(iii) It carries out the input-output management and co-ordinates different input-output devices while
one or more program is being executed.
(iv)It manages file on various storage devices and their transfer from one to another devices. It also
allows modification through text editor or any other program.
(v) It establishes and enforces the job priority.
(vi)It automatically transfer control from one program to another as per control signal supply by
user.
(vii) It establishes and maintains data security and integrity.
(viii) It also produces error messages and other debugging codes.
(ix) It maintains log of users in multi-user operating system.
(x) It facilitates easy communications between the computer system and the computer operator.

Single-user Operating System


Operating system, which allows only one user to work on a computer at a time, is known
as single user operating system. Example included MS-DOS, Windows 9x etc.
Multiuser Operating System
A Multiuser operating system allows a number of users to work together on a single
computer. UNIX is a multiuser operation system. It is not that all users will bump on a computer
at the same time. Each user will be provided with a terminal and all such terminals will be
connected to the single computer.
Multiuser operating system running on a computer will manage the work of all users,
without letting them know that they all are actually working on a single computer.
Single - tasking Operating System
Operating system which can execute a single job at a time is known as Single- tasking
operating system. For example, MS-DOS is a single tasking operating system because you can
open and run only one application in DOS, at one time.
Multitasking Operating System
Multitasking operating system allows the user to perform more than one job at the same
time on a computer. Most of today's operating systems such as Windows 9x, OS/2, UNIX,
LINUX etc. support multitasking. For example, when you open MS-Word and Internet Explorer
at the same time, the Windows Operati9ng system is doing multitasking. The operating system is
able to keep track of where yo are in each of these applications and switch from one to another
without losing track.
Real- time Operating System
raj 2

Real - time Operating Systems work towards providing immediate processing and also
responding to user's commands in a very short time. Such an operating system is more
commonly used in chemical industry for process control and scientific processing like airplane
control and space vehicle control operations. Success of a real time system does not depend only
on the correctness of the result, but also on the timeliness of the result. A correct answer obtained
after the expiration of time limit is as bad as a wrong answer. Some examples of real time
operating systems are HP-RT and VT- works.
Network Operating System (NOS)
Network Operating System (NOS) is an operating system specifically designed to support
interconnection of several computers. NOS provide support for multiuser operations as well as
administrative, security and network management functions. Some examples of NOSs are
Novell's Netware, Microsoft's Windows NT, Artisoft's LAN tactic etc.
A network operating system has to acknowledge and respond to requests from many
workstations, managing network access, resource allocation and sharing, data protection as well
as error control. It provides for printer, file system, database and application sharing.
Distributed Operating system
A Distributed Operating System hides the existence of multiple computers
(interconnected by a network) from the user. That is, the user remains unaware of the fact that
many computers and being used to process the data. These computers may be located at many
places around the globe. Distributed Operating System provides single- system image to its
users. Each computer in a distributed computing system processes a part of the global distributed
operating system. All these computers work in close coordination with each other. Processes and
system resources are managed globally, and controlled from specific locations.
User views the complete system as a "virtual uni-processor" and not as a collection of
machines. The distributed operation system works towards generating this illusion.
Degree of autonomy of individual computers in an environment that uses network operation
system is very high whereas the degree of autonomy of individual computers in an environment
that uses distributed operation system is considerably low.

How is it Compulsory to function a computer system?


Operating system works like a coordinator and mediator between users and computer
hardware as well as software. It is the main system software that controls all the hardware and
software of the computer. It manages the memory, devices, processors etc. As soon as computer
system boots, the control automatically transferred into hand of Operating System. Without an
OS, the computer is just like a Buddhu Baksa, who cant do anything.

Operating System Processing Methods


Various types of OS processing methods are:
a) Serial Processing
b) Batch processing
c) Multiprogramming
Serial Processing
In the serial processing, programs are executed one by one, in the order in which they are
supplied to the computer. That is, the different computer jobs are executed one after the other.
Batch processing
In batch processing systems, a number of jobs are put together and executed as a group. Many
users.
raj 3

Multiprogramming
In a Batch Multiprogramming system, a series of jobs was loaded into the memory at the same
time, if sufficient memory space were available. While one job was held up waiting for an I/O
transfer, another job was started. A job was selected (from those ready to run), on the basis of an
operator assigned priority number. It was found advantageous to mix jobs which differed in the
balance of processor to I/O activity.
Some systems only handled two jobs at a time, which were referred to as the foreground and the
background jobs. The foreground job had the higher priority and was allowed to run if it was
able. The background job could only run if the foreground was awaiting an I/O transfer or was
otherwise inactive. Background running is inherently more suited to jobs requiring little
processor time, but with relatively more I/O activity. A specific example of such a job is referred
to as spooling.
Spooling
This acronym stands for Simultaneous Peripheral Operations On-Line. Essentially, this technique
absorbs surplus processor time by performing I/O transfers for other jobs. Input and output data
were routed via disk files, so that these jobs were only required to communicate with disk
systems with disk systems which are, of course, much faster.
Spooling was one of the earliest applications of multiprogramming. Jobs are read in via a card
reader and copied into a disk file. The operating system reads this file as if it were the card
reader. Printable output generated by the running programs is written to another disk file, while a
printing program constantly prints the data in this file (if any).
Another benefit of spooling is that access to the slow peripherals is restricted to the one program,
namely the spool print program. This facilitates the sharing of devices such as printers between
several running programs, avoiding the need for these programs to compete for possession of
the printer.
Memory Management, Process Management, Device Management, File Management
OPERATING SYSTEM SOFTWARE - Operating System is a set of programs that is
extremely important to activate and Co-Ordinate the activities of various hardware resources like
the processor and Input/Output devices. In other words, Operating System controls the
movement of information on in the Computer.
OS is the first program loaded into the computer's memory after the computer is switched
on. The operating system is an important component of the computer system, because it sets the
standards for application programs that run in it. All programs must be written to "talk to"
Operating System. The main functions of an OS are: -
(a) It assigns a processor to different tasks being performed by the computer system.
(b) It allocates the main memory and other storage areas to the system programs as well as
user programs and data.
(c) It carries out the input/output management and coordinates and assigns different input and
output devices while one or more programs are being executed.
(d) It manages files on various storages devices and the transfer of these files from one storage
device to another. It also allows all files to be easily changed and modified through the use
of text editors or other file manipulation software packages.
(e) It establishes and enforces the job priority. That is, it determines and maintains the order in
which jobs are to be executed in the computer system.
(f) It automatically transits from job to job as directed by special control statements.
(g) It is able to interpret commands and instructions.
(h) It co-ordinates and assigns compilers, assemblers, utility programs, and other software
packages to various users working on the computer system.
raj 4

(i) It establishes data security and integrity. That is, it keeps different programs and data in
such a manner that they do not interfere with each other. Moreover, it also protects data
from being destroyed by and other user.
(j) It also produces traces, error messages, and other debugging and error detecting codes.
(k) It maintains internal time clock and log of system usage for all users.
(l) It facilitates easy communication between the computer system and the computer operator
(human).
2.DISTRIBUTED OPERATING SYSTEM: ALGORITHM

A distributed computer system is a collection of autonomous computer systems capable of


communication and cooperation via their hardware and software interconnection. Distributed
computer systems are generally characterized by the absence of shared memory, by unpredictable
internodes communication delays, and by practically no global system state observable by
component machines.
A distributed operating system governs the operation of a distributed computer system
and provides a virtual-machine system abstraction to its users.
Computer system environments and operating systems usually support intersite
communication and supply protocols for bulk data exchanges. A network operating system may
provide remote operations and remote file access, but the user is almost invariably required to be
aware that the resource being operated on is remote. A distributed operating system provides a
virtual-machine abstraction of the system and offers a unified interface for resource access and
manipulation regardless of its location. Network and distributed operating systems have a
common hardware base; the differences between them lie almost exclusively in software.
Rational For Distributed System

Why Distributed
The evolution of computer communication technology let to the implementation of a
major computer network called ARPANET in the late sixties. It was funded by the Defense
Advance Projects Agency (DARPA) of the U.S. Department of Defense provided a large scale
operational experience and stimulated a lot of early research on computer networks. Ever since,
researchers and practitioners alike have liberated at realizing the promise of distributed
processing. It major potential benefits include:
Resource sharing and load balancing
Communication and information sharing
Incremental growth
Reliability, availability, fault tolerance
Performance
Resource sharing is one of the major potential advantages of distributed systems.
Temporary surpluses and shortages of resources such as processing power, storage capacity, and
information from databases may be balanced to improve cost-effectiveness and performance of a
distributed system.
On a greater scale, a distributed system effectively merges a number of previously
autonomous user populations, such as several different time-sharing systems and/or LANs, into a
larger union.
Similar savings have been realized in other industries, such as load sharing in power
utility systems. A large common distribution system makes it possible to pool the power and
meet the demand wherever it occurs.
raj 5

Communication and information sharing are forms of resources sharing. In our


classification they are presented as a separated category in order to emphasize their special
importance. Personnel computers, which were initially heralded as providing the ultimate
freedom and self-sufficiently, are increasingly abandoning isolation and being connected via
networks in order to enable their users to communicate and share information.
Distributed systems generally serve much larger, possibility geographically dispersed,
user communicates and thus represent an attractive opportunity for communication and
information sharing. Electronic mail has a number of appealing characteristics, such as fast
delivery and the possibility of instant reply, as well as store-and- forward capability that allows
interested parties to converse at their convenience.
Due to the economy of scale, the point of cost effectiveness for connecting to information
databases, such as large depositories of technical abstracts and indexed references, is more easily
reached in a distributed system than in a time sharing system. Bulletin boards and electronic
forums are a relatively novel form of teleconferencing and topical information exchange. User
benefits include the possibility of focusing only on the specific areas of interest and the ability to
offer or solicit peer opinions on any given topic therein.
Incremental growth may be accomplished in a distributed system by gradually
augmenting the equipment as the needs of applications and user requirements change.
Reliability, availability and fault tolerance are quite different issues, but there common
thread is that they have significant potential advantages in distributed system over the centralized
environment. Increased reliability comes from duplication of equipment and the possibility of
storing replicated data at different locations.
Performance improvements come mostly from the potential for parallel operation when
multiple nodes cooperate on solving a single problem. Response time, a measure of performance,
may be improved in a distributed system by virtue of the ability to place frequently used data
closed to there users.
Other potential advantages of distributed systems include reduced costs, greater capacity
than a single processor can deliver, and better ability to parallel real world organizational
structure due to local control of local data.
Major drawbacks of distributed processing are:
Reduced ability to pool memory and processor resources among distinct nodes
Increased dependence on network performance and reliability
Security weaknesses
More complex system administration and maintenance

What Is Distributed
Distribution basically spans three dimensions:
Hardware
Control
Data
System resources generally fall into one of the two categories (1) physical resources, such
as processors and devices, and (2) logical resources, such as files and processes. Distributed
algorithm and processing often involve multiple processes that execute on different nodes.
Control includes resource management and coordination of activities that takes place on
individual nodes.
Centralization control requires delegation of an arbiter node that manages a set of system
resources. The central arbiter has complete information about the state of resources under its
jurisdiction and of pending requests for their use. The single-point failure problem may be
raj 6

alleviated by implementing algorithm for election of the successor node, at the cost of added
complexity, logging of outstanding requests, and potentially long transition delays.
Distribution of data may be partitioning, replication, or both. In some applications
judicious partitioning of data can contribute to performance and availability by placing
frequently used items close to their points of processing.

Computer Networks
Autonomous machines that execute application programs and constitute the
computational resource of a distributed system are usually called hosts. They are connected for
purposes of communication by means of a communication network or sub network. Depending
on the physical distance spanned by their communication sub-networks, computer networks are
usually classified as
Wide-area networks (WANs)
Local area networks (LANs)
Wide Area Networks:-
As indicated the communication subnet itself consists of a number of communication
processors connected by physical communication lines. Dedicated communication processors act
as switching elements between two or more communication lines. After the original ARPANET
implementation, the communication processors are often called interface message processors, or
IMPs for short.
A host processor wishing to communicate with another host typically presents its request
to the designated IMP. Usually each host is availed the services of a specific IMP, although a
single IMP may serve several hosts. The IMP-to-IMP communication channel may be of one of
the two board types:
Point to point
Broadcast
Point-to-point links are dedicated physical lines used to connect a specific pair of IMPs.
The actual number and topology of these links are determined by taking into
consideration factors such as cost, communication delays, and reliability. Common
topologies of physical circuits that connected IMPs are:
Star
Partially connected
Fully connected
Ring
Hierarchical or tree-structured network
The star has a fixed, two-hop host-to-host communication delay but suffers from the
single point of failure. Fully connected systems are fast and reliable but expensive since the
number of links grows as the square of the number of hosts. Partially connected and mesh
networks have direct links between some but not all nodes.
Single-link ring networks are low in cost but have variable and potentially long delays,
especially when a host wants to communicate with its immediate neighbor in the direction
opposite the ring flow. Rings are generally sensitive to link failures, especially in native
implementations, where each node must act as an active repeater for all traffic.
Hierarchical connections may be suitable for certain types of organizations and systems,
such as process control, where communication naturally flows in a hierarchical manner. This
configuration is poor in systems with frequent peer-to-peer interactions, since they must be
routed up and down the hierarchy.
Local Area Networks:-
raj 7

As indicated earlier, local area networks (LANs) are characterized by high bandwidth,
low-delay communication links. They often rely on a relatively high-speed common access
communication medium to carry the massage traffic. LAN communication speeds range from the
order of several Mbps to the order of a Gbps with special cabling or optical fibers.
The LAN communication medium itself is passive in the sense that it provides none of
the processing power, routing, or storage functions found in the store and forward
communication subnets. In LANs, communication functions and processing are provided by the
nodes (host machines), either directly or by their integral dedicated communication processors.
The network topology is usually a bus or a ring. A star topology may be found in special-
purpose systems and in some early designs.
In ring-based systems, messages circulate around the ring. They are then recognized and
copied by their addresses. Depending on the acknowledgement scheme in use, either the
destination or the source node may be charged with removing the consumed massage from the
ring.
Another common topology in local-area networks is the bus. In a typical bus technology,
a commonly accessible passive conduit carries the message traffic. All nodes tap the bus, listen to
all the traffic, and extract the massage addressed to them. Taps themselves are usually passive
and do not physically break the bus. As a result, bus-oriented LANs are reliable and able to
sustain communication between healthy parties in the presence of multiple node failures.
A token-bus is a LAN that attempts to combine the benefits of bus topology with the
bounded massage delays characteristic of rings. A token bus is a bus-based LAN whose nodes
from a logical ring in order to use tokens for access control. A token bus is used in MAP
(Manufacturing Automation Protocol) LAN.
Algorithm for Distributed Processing
In a distributed system, cooperating processing may reside on different nodes. Like their
single-site counterparts, distributed cooperating processes rely on inter process synchronization
and communication mechanisms to collectively and coherently accomplish a common mission.
These complexities are largely due to he differences between distributed and centralized systems
which include:
Absence of shared, commonly accessible memory
Internodes communication delays that can exceed internodes communication delays by
orders of magnitude
Global system states is not observable by component machines due to communication
delays, component failures, and absence of shared memory
A much richer set of failure modes and the desire to continue at least degraded operation
in the presence of partial failures
In certain respects, a centralized system may be viewed as a special case of a distributed
system in which inter component propagation (communication) delays are practically
negligible. As a result, algorithms and mechanism devised for the distributed case
generally function correctly when applied to the centralized uniprocessor case, but the
converse is not necessarily true.
Lamports Algorithm:-
Assuming the presence of the pipelining property and eventual delivery of all messages,
the solution requires time-stamping of all message, and it also assumes that each process
maintains a request queue, initially empty, that contains request message ordered by the relation
. The algorithm is defined by the following five rules.
raj 8

1. (Initiator: i) When process Pi desires to acquire exclusive ownership of the resources, it


sends the time-stamped message request (Ti, i), where Ti = Ci, to every other process and
records the request in its own queue.
2. (Other processes: j,ji) When process Pj receives the request (Ti, i) message, it places the
request on its own queue and sends a time-stamped reply (Tj, j) to process Pi.
3. Process Pi is allowed to access the resource when the following two conditions are
satisfied:
a) Pis request message is at the front of the queue, and
b) Pi has received a message from every other process with a time stamp later than
(Ti, i).
2. Process Pi releases the resource by removing the request from its own queue and by
sending a time-stamped release message to every other process.
3. Upon receipt of Pis release message, process Pj removes Pis request from its request
queue.
Ricart and Agrawalas Algorithm:-
Ricart and Agrawalas (1981) algorithm is a more efficient version of Lamports
algorithm. It is based on identical communication assumptions and on the total ordering of
events as provided by the relatin.
1. (Initiator: i) When process Pi requests the resource, it sends the time-stamped message
request (Ti, i), where Ti = Ci , to every other process and records the request in its own
queue.
2. (Other processes: j,j i) When process Pj receives the request message , it acts as
follows:
a) If Pj is not currently requesting the resources, it returns a time-stamped reply.
b) If Pj is currently requesting the resources, and the stamp of its request (T j , j)
precedes (Ti , i), process pis request is retained; otherwise, a time-stamped reply
message is returned.
2. Process Pi is allowed to access the resources when the following two conditions are
satisfied:
a) Pis request message is at the front of the queue.
b) Pi has received a message from every other process with a time stamp later than
(Ti , i).
3. When process Pi releases the resource, it sends a reply message for each pending request
message.
Distributed Concurrency Control and Deadlocks:-
In a distributed system, a single transaction can span files residing at several different
sites. Resource acquisition by concurrent transactions originating at different sites can lead to
deadlocks.
Necessary conditions for a deadlock are the same in centralized and in distributed
systems. They are: (1) mutual exclusion, (2) hold-and-wait, (3) no preemption, and (4) circular
waiting.
Techniques for dealing with deadlocks include deadlock prevention, deadlock avoidance,
and deadlock detection and recovery. Deadlocks can be prevented by ordering and honoring
requests according to their time stamps.
In principle, the familiar centralized algorithms for deadlock avoidance can be applied in
distributed system with centralized control. In addition to requiring proclaiming of resources,
such approaches tend to be slowing, susceptible to a single-node failure, and prone to congestion.
Several decentralized algorithms for concurrency control that avoid deadlocks have been
devised for use in distributed systems. In this session we describe two such protocols, called
wait-die and wound-wait due to Rosencrantz et al. (1978). Both protocols are essentially
raj 9

database concurrency control algorithms that avoid deadlocks. Each transaction is time-stamped
at its creation by the originating site. Each site maintains a lock queue for each of its publicity
available resources. Lock queues are ordered according to the time stamps of participating
transactions. A transaction at the head of a queue owns the resources. In case of conflicts, a node
where lock requests collide applies locally one of two rules:
Wait-die: If the requestor is older, than the transaction that owns the desired lock-the
requestor-waits. Otherwise, the requestor dies.
Wound-wait: If the requestor is older than the owner of the lock, the requestor wounds
the owner. Otherwise, the requestor waits.
Dying means that the affected process or transaction is aborted. For transactions, aborting
implies the undoing of all partial effects and the releasing of all locks acquired by the transaction
thus far. The aborted transaction is usually restarted at a later time. Wounding means that an
older transaction instructs the younger, conflicting one to die-that is, to abort, undo its partial
effects, and release the locks.
In the wait-die scheme, an older transaction is permitted to wait. This is safe because
circular waiting chains cannot be formed, since a younger transaction never waits for an older
one.
In the wound-wait scheme, an older transaction does not wait for younger ones. After
wounding, the transaction has to wait for the wound to take effect and for the younger transaction
to die and release the lock.
In a wait-die system, a transactions that dies and is restarted may again cause a conflict
with the same transaction and be forced to die again. On the positive side, wait-die systems have
the desirable property that a transaction is guaranteed not to restart ones it has accessed all its
required database entities for the first time. This property is not enjoyed by wound-wait systems.
Coping With Failures
One of the major potential benefits of distributed processing is resilience to failures and
increased system availability. Mere distribution of hardware and data does not automatically
yield an inherently more reliable system. In fact, due to its dependence on multiple nodes and
communication links, a distributed system may be less reliable than a single-site centralized
system. The promise of distributed systems can only be realized when the proper hardware
foundation is augmented with fault mechanisms and data redundancy provided and managed by
the systems software.
Failures in Distributed Systems:-
Common failures in distributed systems include:
Communication-link failures
Node failures
Lost messages
In order to function properly, the rest of the system must (1) detect failures; (2) determine
the cause, such as identifying the type of failure and the failed component; (3)
reconfigure the system so that it can continue to operate; and (4) recover when the failed
component is repaired.
A node engaged in a handshaking protocol of some kind usually experiences a
failure as the lack of expected response from its partner within a prescribed time limit.
The use of time-outs is a common technique for detecting missing responses or
acknowledgements. Too long time-out results on sloe detection of missing messages. On
the other hand, too short a time-out may trigger false alarms by declaring as missing
messages that are just delayed.
Given the possibility of lost messages, it is common to go through a few retries
before declaring a failure to communicate. After a predetermined number of retries fails
raj 10

to be acknowledged within the time-out limit, it is reasonable to conclude that a failure


has occurred. In general, in a distributed system there is no direct way for a node to
determine the cause of the failure, such as a link or a node, on the basis of the missing
response alone. Thus some system component must engage in detection of the type of
failure so that the appropriate action may be taken.
Failure of a node can result in simple stoppage, called fail-stop, or in erratic
malfunctioning behaviors. The latter is much more difficult to deal with, as the
malfunctioning node may continue to exchange messages but may violate the protocol
and thus confuse other nodes, withhold answers intermittently, or disseminate corrupt or
forged messages.
Reconfiguration in the case of link failures consists of choosing and alternate path
and updating the corresponding routing information by all affected nodes.
Recovery from link failures consists of relatively simple updating of the routing
information. Node recovery is more complex since it requires updating of state
information and possibly replaying of missed messages by some of the active nodes, in
addition to updating of system topological maps.
MEMORY MANAGEMENT
The memory is divided into two parts:-
(1) Contiguous part: - Contiguous part for operating system program also called monitor.
Second section: - Second section is for user program.
SINGLE PROCESS MONITOR
In single process monitor operating system only keep the track of the first last location
available for allocation of user programs. In order to provide a contiguous area of free storage for
user program operating system is loaded at one extreme end, either at the bottom or at the top.
This important factor affecting only interrupts vector case. Since the interrupt vector is
often in low memory, operating system program is kept in low memory Anew program [user
program] is loaded only when the operating system passes a control to it. After receiving a
control it starts running until its completion or termination due to I/O or some error. When this
program is completed or terminated. The operating system may load another program for
execution. This type of memory management scheme was commonly use in single process
operating system such as op/m.
Two important issues such as protection and sharing of code must be addressed while
design any memory management scheme sharing of code and data in a single process
environment does not make mush sense because only one process resides in memory at a time.
Protection is also hardly supported by a single process monitor because only one process is
memory resident at a time. However, protection of operating system program from user code is
must otherwise it may crash. Operating system code usually resides in low memory area. A
register also called fence register is set to the highest address occupied by operating system code.
A memory address generated by user program to access certain memory location is first
compared with fence register content. If the address generated is below the fence, it will be
trapped and denied permission. Since modification of fence register is considered as a privileged
operation there fore, only operating system is allowed to make any changed to it.
Partitioned memory allocation static : Static partitioning implies that the division of
memory into no. of portions and its size is made. In the banging and remain fixed there after. The
basic approach here is to divide memory into several fixed size partitions where each partition
will accommodate only one program for execution. The no. of programs residing in memory will
be bound by the number of partitions. Where a program terminates, that partition is free for
another program waiting in a queue.
raj 11

In the fig. Memory is partitioned into 6 regions. The first


region is revered for o.s and P1, P2 and P3 is reserved for
program and two partitions are free and available for
allocation.
Wherever a new process is ready to be loaded into
memory and if no portion is free, swapping of processes
between main memory and secondary is alone. Swapping
helps in cup utilization by replacing suspend able process but
residing into main memory with ready to execute processes from secondary storages. When the
scheduler admits a new process for which no part ion is free, a memory manager is invoked to
make a partition free to accommodate the process.
The memory manager performs this task by swapping out low priority processes
suspended for a comparatively long time in order to load and execute the huger priority process.
When the higher priority the higher process is terminated, the lower priority process can be
swapped back and continued.
Swapping requires secondary storage. Device such as fast disk to store the suspended
processes from main memory .one problem with swapping process is that it takes lengthy time to
access process from secondary storage device. For example, to get an idea of total swap time,
assume that user program is 100k words and secondary storage device is access time 8m sec.
And a transfer rate of 250000word/sec. Then a transfer of 100k words to or from memory tasks:-
=8msec+ (100k words/250000 words sec)
=8 m sec + 100000 words/250000 words/sec
=8+2/5sec
8+2*1000/5
=8+400
=408m sec (approximately)
Since we must both swap in and swap out the total swap time is about 408+408=816 m
sec. This is a very long time for computer. Static partition methods take more time to execute
any task if any partition is not free. And main memory problem with fixed size partition is the
wastage of memory by programs that are smaller than their partitions.
Dynamic partitions:-> The size and the no. of portions are decided during the run time by the
operating system. Dynamic partitions (also called variable partition) which creates partitions
dynamically to meet the requirements of each requesting process, when a process terminates or
becomes swapped out the memory manager can return the vacated space to the pool of free
memory are areas from which partition allocation are made. In dynamic partition neither the size
nor no. of dynamically allocated partition need be limited at any other time. Assume that we have
a 100 to main memory 40k is occupied by o.s program there are 84jobs waiting for memory
allocation in a job were. And size of job 1 is

10k job is
30k job is 8k and job is 16k. Applying fifes scheduling policy.
Process a, process b, process c can be allocated in memory. Process d
cannot be accommodated because. Only {60-(30+15+10)} =15k
memory rest. Show in fig.
raj 12

Let us assume process after some time process a is terminated, releasing 10k memory
space. This is shown in below fig.

After that the control is returned


to process d process queue and
next process is swapped.. This is
shown in fig.
Let
us

assume after some time process d is terminated the control is


retuned again the process queue and next process (process e)
is swapped this is shown in below fig.
With dynamic portion the main problem is
fragmentation. Its solution is combine the all-free space after
that the control is returned to the process queue and then next
process is swapped. One advantage with variable portion is that memory is
generously better then fixed size partitions, since portion are created according to
the size of process.
Paging: - paging is a memory management technique that permits a programs
memory to be non-contiguous into physical memory thus allowing a program to be allocated
physical memory wherever it is possible.
When programmer wants to transfer data from one memory to another, he might write for
example: more R1 2000. Basically the physical memory is conceptually divided into a no. of
fixed size slots called page forms. The virtual address space of a process is also split into fixed
size blocks of the same size called pages. Different page forms allocated to a single process need
not occupy contiguous area of physical memory.
Segmentation: - segmentation is a memory management scheme which supports programmers
view of memory. Programmers never think of their programs as linear array of words. Rather,
they think of their program as a collection of logically entities such as subroutines or procedures,
function global or logical data areas, stack etc.
Segments are
formed at program
translation time by
grouping together
logically related
entities. Formation
of these segments
ray from one compiler to another. A Pascal compiler might create separate segments for (1) code
of each procedure (2) Global data (3) local data or variable (4) stack
In segmented systems, components belonging to a single segment reside in on contiguous
area but different segments belonging to the same process occupy non contiguous are of physical
memory because each segment is individually relocated. Virtual memory management policies:-
the collection of only the part of a program of certain policies into the virtual memory
management scheme.
(1) Allocation policy: - how much real memory to allocate to each active process.
(ii) Replacement (swap-out) policy: - if there is no. Space for a new page in physical
memory, which page is to be selected for swapping out to secondary memory in order to mark
room for a new page.
raj 13

3.FILE MANAGEMENT
Logically related data items on the secondary storage are usually organization into named
collection called files. User can rely on a single, uniform set of file-manipulation system
services for both file and I/O device management. Thus sometimes referred to as device-
independent I/O.

The common responsibility of the file management system includes the following:--
Mapping of access request from logical to physical file address space.
Transmission of the file element between main and secondary storage .
Management of the secondary storage, such as keeping track of the status allocation, and
deletion of space.
Support for protection and sharing of file and the recovery and possible restoration of file
after system crash.

File of a computer installation can be stored on a number of physical devices, such as disk drive,
magnetic tapes, or semiconductor memory.

Command language uses view of file system

According to the method of invocated of the service, users of file may be broadly divided into
two categories:
I. Command language user
II. System programmers
The formal category includes user who invoke file management service by means of the
operating system command language. In most system, such user can LIST content of a file
directory COPY file between volumes or devices CREATE, DELETE, and RENAME file. File
creation may be done by invoking the text editor, which in turn time CREATE_FILE service to
pass on the users request to the file management system.
File directory in computer in computer system usually belong to one of two categories: -
single level or hierarchical. A single level directory, often called a flag directory, contens all file
in the system or on a given volume .these problem can be alleviated by using hierarchical
directories. In a hierarchical directory system, user can group the related file into subdirectories.
All system file are then cataloged in a hierarchy of directories whose structure is similar to that
of a rooted tree. Access to files in a hierarchical system in principle requires user to indicate all
directories that must be searched in order to locate a given entry. Such a specification is often
called an access path or a path name.
Edit report
raj 14

Root

Jones Smith

New work kmos

As perceived by users , advantage of hierarchical directory include :-


Facilitated unique naming of files
Support for select for select for selective sharing and protection
Convenient directory manipulation.
Disk controller and driver
Disk are electromechanical device, they are capable of carrying out only rather primitive
command. Controller is usually capable of handling several drives with similar characteristics. A
few control lines are needed to select the drive designate to participate in a given operation .these
are indicate as DRIVE SELECT line in shown in the figure.
raj 15

disk

Drive select

Head select

Direction (in/out )

Step

Read

Write

Data out

Data in

Reset faultclear

Track00

Index ready

Faulty

Volume

miscellaneous

controller /drive single

The primary functions of a basic disk controller are to:-


1) Convert higher level command, such as seek or read a sector ,into sequence of properly
timed drive specific command .
2) Provide serial to parral conversion and single condition necessary to convert from byte or
word format, required for DMA communication with main memory. Into the analog bit serial
stream expected and produced by disk drives.
3) Perform error checking and control

A typical disk driver basically allows reading and writing of disk sector specified by means of
the three component physical disk addresses of the form:
<Cylinder number, head number, sector number>
Some implementation requires READ and WRITE request to be preceded by head position
SEEK command. Some disk drive and controller are capable of transferring multiple sector or
even track, in response to a single command. An advantage of this mode of operation is that head
raj 16

are positioned once, so that the overhead of average access time may be amortized over many
sectors.

OPERATING SYSTEMS VIEW OF FILE MANAGEMENT


The file system must support the users abstraction at the outer layer and convert it into the
command understood by the disk driver at the inner layer. From the range of service provided to
user and the description of disk organization ,it follows that the basic function of the file system
include:-
1. Keeping track of all file in the system.
2. control sharing and enforcing of file protection
3. Management of disk space; allocation and deallocation.
4. Mapping of logical file addresses to physical disk addresses.
The file system keeps track of file by means of directory. File protection requires separation of
distinct files. Dynamic changes in both number and size of file necessitate frequent allocation
and deallocation of disk space. The file system usually keeps track of unused disk space by
means of a pool of free blocks.
While the detail may vary the following three level of device abstraction and disk storage
addressing are commonly identification in implementations of the file management system:
1. File relative logical addressing: - at the highest level of abstraction, the storage system is
viewed as a collection of namedfilemost application and file related system calls use this
form of addressing.
2. Volume relative logical addressing:- many disk driver provide an abstraction of disk as a
linear array of sectors. Small computer system interface (scsi) device provide this form of
disk abstraction directly by means of hardware controller integrated in the drive
themselves.
3. drive relative physical addressing:- this level user the three component physical addresses
of the form <cylinder ,head ,sector>.
DISK CACHES AND UNIX BUFFER CACHE

Disk access time, and consequently the speed of many operations of the file system that depend
on it, may be caching certain disk blocks in memory. This is similar to a memory cache. In
UNIX, cached disks blocks are managed more recently by software vendors for personal
computers, where it was initially implemented as an add or utility. A disk cache operates by
maintaining a pool of recently used disk blocks is main memory. The request result in a cache hit
, and it is satisfied from memory. If the requested disk block is not in the cache, a disk-cache
miss occurs, and the request is satisfied by accessing the disk.
Disk caching may be applied to both reads and writes. Some disk caches retain only
blocks that are read, and direct all writes to the disk. This approach is known as write-through
caching. It is generally less efficient than read/write caching. But not necessarily by a wide
margin, since a large majority of disk accesses are generally believe to be reads. The buffer
caches are a pool of blocks used to store a collection of recently used disk blocks. The size of the
buffer cache is typically determined during system configuration.
When a running process request a disk block, the operating system translate the reqesr
into the device and block number and applied the hash function to those in order to search the
buffer cache. The ensuring hash search may yield one of the following finding:-
1. The target block is on the free list.
2. The target block is in the buffer cache but is not free.
3. The target block is not in the buffer cache.

Advantage of disk caching include:-


raj 17

Improved effective disk access time by satisfying requests for the cache block
from memory.
Improve response time to application for cached block on read and optionally, on
delayed writes where the i/o requestor is not forced to wait for the completion of a
disk write.
Reduce server and networking loading with client disk caching in distributed
system.

Implement of the Berkley variety of UNIX claim elimination of 85% of disk accesses. The
primary disadvantage of disk caching is the potential corruption of the file system due to loss of
power or to system crashes if delayed write are allowed. Poorly implemented or parameterized
disk caching systems were also found to under perform nonrated under certain condition.
A GENERALIZATION OF FILE SERVICES
Device independent I/O provides both an ease of use and flexibility not attainable by most other
approach. Device independent is essentially a form of delayed binding of user programs to i/o
device. User programs are coded and prepared using an abstract of device, such as files, logical
I/O port, or logical unit number. Much different type of I/O devices it is customary to regard all
devices as files in the sense of having a name and allowing bytes to be read from or written into
them. A major division between byte-serial and block-structure devices is usually made. Some
systems refer to these as unstructured and structured I/O respectively. The formal class includes
device capable only of byte-serial transfer, such as printers and terminals. Although creations and
deletions are customary for file, devices are usually regarded as permanent object created at
system startup time. Depending on the type of device exclusive or share access may be granted
to requestor. This uniformity of treatment allows user to handle both file and device by means of
a single set of system calls. Advantage of device independence is that it facility the portability of
object code between system with different hardware configuration. Device specification can be
changed without reprogramming.
Some system uses an interposes communication mechanism call pipe. Which is similar to
messages but ncan be programmed using the standard set of file and I/O services. A pipe is a
virtual communication channel that can be used to connect two processes wishing to exchange a
stem of data. The two processes communication via a pipe can be written into at one end and
read from at the other. Implicit synchronization between the processes communicating via a pipe.
The differences are that the pipe facility does not require explicit synchronization between
communicating it is handled at the system call level in exactly the same way as file and device
independent i/o. A pipe can be created or accessed if it already exists, by means of an OPEN
call. A writer process normally produces streams of data that it writes into the pipe. A reader
process consume data

UNIX OPERATING SYSTEM


Introduction: - UNIX is popular multi-user time-sharing operating system primarily intended
for program development and document preparation environments. It is written in a high level
language, C. Versions of UNIX are available for personal computers, micro-processor based
systems, mini-and super minicomputers, and large mainframes and super computers.
The first version of UNIX was written by Ken Thompson, later joined by Dennis Ritchie,
at Bell Labs in the late sixties. It was a single-user system for the PDP-7 computer written in
assembly language. After a major rewriting in C and porting to the PDP-11 family of computers,
UNIX was made available to users outside of AT&T. UNIX is now commercially available from
raj 18

AT&T, together with numerous variants of the system provided by the other vendors. Several
specified versions of UNIX, such as the Programmers Workbench, UNIX/PWB, and Writers
Workbench, UNIX/WWB, are also available.
Some of the major features of UNIX are:-
Portability
Multi-user operation
Device independence
Tools and tool-building utilities
Hierarchical file system
Silent feature of UNIX are:-
(i) Multi-user capability in this system the same computer resources like hard-disk,
memory, printer, floppy disk drive (FDD), optical disk are accessible to many user. There are lots
of terminal connected to a main computer called Host computer or Server. All the
terminals are called Clients. All terminals are connected to main computer whose resources
are available by all users. So users at any of the terminal can use not only the computer but also
any peripheral that may be attached safe for instance printer. One can easily how economical
such as setup is then having as many computers as then are users and also how much more
convenient when some data is to be shared by all. At the heart of UNIX installation is the host
machine is known as Console/Server. The numbers of terminal that can be connected to the
host machine dependent on the numbers of ports that are present in its controller card. For
example part controller cards in host machine can support for terminal. There are several types of
terminals:-
(a) Dumb terminals: Consists of keyboard and VDU(Visual display unit) with no
memory. It can never act independent machine.
(b) Terminal emulation: Having its on microprocessor memory and disk drive. By
attaching this PC to the host through capable and running software from this PC.
We can emulate it to work as if it is a dump terminal. It can not be any processing
own its. Its transmit its processing job to the host. The job software makes the PC
work like dump terminal is called terminal emulation. Ex: VTERM, XTALLIC.
(c) Dial in terminal: It is connected through telephone line with host using modem
called Dial in terminal.
(i) Multitasking capabilities: It is capable of carry of more than one job
at the same time it allows due to type in a program in its editor. While
its simultaneously execute some other command you might have
given easily, say to surd and copy a use file.
(ii) Communication: UNIX has extended provision for communicating
with fellow user. The communication may be within the network of a
single main computer or between two or more such computer
networks. The user can be easily exchange mail, data, programs which
such as networks.
(iii) Security: Using allows sharing of data but not indiscriminately.
UNIX has three inherent positions for processing data.
The first is providing accessing password and login name
to individual user in security that not anybody can come
and have accesses to your work.
At the file level there are read, write, and execute
permission to each file which decide who excess a
particular file.
raj 19

Lastly there is file inscription this utility encodes yours file


into an unreadable format even it some one succeed in
opening it your secrete is safe. If you want to see the
instants of incrusted file than you have to descript it.
(d) Portability: One of the main reasons for the universal popularity of UNIX is
that it can be parted to almost any computer system to minimum changed.
Starting with UNIX: - When we log into a UNIX computer, the files we first see are located in
our home directory. We can always return to our home directory by using the command > cd ~.
To print the name of our working directory we use > pwd command. To see the list of our files at
our hard disk we use > ls command.
File In UNIX System
UNIX treats every thing as files. Even a directory is treated as a file that contains entries for
several other files. All devices, such as I/O devices, storage devices etc are all treated as file.
There are three types of UNIX files:-
(i) Ordinary Files: - these files include the plain documents, program source code,
program data, executable binary files and computer programs. Each ordinary file has
a filename, its size in bites, access permissions and an unique number called inode
number. An inode is a data structure that contains information about a file such as file
type, number of links a file has, file size, time when the file was last modified and the
location of the file on the disk.
(ii) Special Device Files: - These files include physical devices on the system, such as
hard disks, floppy disks, terminals, printers, system memory etc.
(iii) Directory Files: - These files are the files that contain the names and inode numbers
of ordinary and/or directory files within it.
Organization of UNIX Files: - The UNIX file system is organized as hierarchy that starts with
the root directory. The root is represented by a forward slash (/). Under the root directory are
several directories and the home directories shown in figure below:

1. / bin: -
This

directory contains executable program files(binary files).


2. /dev: - This directory contains the special device files.
3. /etc: - This directory contains all the system-wide configuration information as text files.
4. /lib: - This directory contains the library files. Library files contains the reusable
functions and routines for the programmer to use.
5. /tmp: - This directory contains all the temporary files, which will eventually be deleted
from the system.
6. /mnt: - This is the directory where the storage devices other than hard disks(floppy disks
and disks) are mounted. This directory contains the sub-directories floppy and
cdrom. When these devices are mounted, this directory shows the contents of the
floppy disk and CD-ROM respectively.
7. /usr: - This directory contains the home directories of the users, source text for the online
manual pages, games and other directories. There is one home directory for each user.
UNIX command Shell
SHELL: - Shell is the integral pat of UNIX system. It is responsible for accepting commands for
the user, interpreting them and then passing on to Kernel for processing. Thus it is the command
raj 20

processor of the UNIX operating system. Shell acts as an user interface. The three major type of
Shell are:-
(a) Bourne Shell: - It is developed by Steve Bourne. It is most popular shell properly thats
why it is bounded with every UNIX system.
(b) Korn Shell: - It is developed by David G. Korn. It has many more capabilities and is
more powerful and efficient than Bourne Shell.
(c) C Shell: - This shell is a bit with those who are seriously into UNIX programming. It was
created by Bill Joy. It has two advantages over the Bourne shell. Firstly it allows aliasing
of commands that is you can decide what name you want to call a command by. This
proves very useful when lengthy commands which are used time and again are removed
by you.
UNIX users invoke commands by interacting with a command language interpreter called the
Shell. In addition to interpreting user requests and invoking the corresponding system services,
the shell is also a programming language suitable for construction of elaborate command files,
called shell scripts. The shell is written as a user process, as opposed to being built into the
kernel. When a user logs in, the system invokes a copy of the shell to handle interactions with the
related user. Although the shell is the standard system interface, it is possible to invoke any each
particular user. This allows dedicated interfaces developed for users of specialized applications,
such as clerical workers using text processing facilities, to coexist with the shell and thus provide
quite different views and working environment for different users of the same system.
Features of Shell: - Some important features and benefits of shell are:-
(a) Communication between user and UNIX system takes place through the shell.
(b) Shell allows background processing of time-consuming and non-interactive tasks.
(c) A frequently used sequence of commands can be stored in a file called Shell script. The
name of the file can then be used to execute the sequence of commands, automatically.
(d) Shell includes features which allow it to act as a programming language.
(e) A user can select a group file for processing with a single command.
(f) Input of one command can be taken from the output of another command or output of one
command can be diverted to the input of file or printer, using the input output redirection
operators (>,<, >>). Pipes (|) can be used to connect simple commands in order to
perform complex functions.
Pipes (Connecting Commands): -The pipe (|) operator is used to indicate to the shell to take
input from another command or give output to another command. For this one method is to first
list all the files using ls command and then manually count the number.
Another method is to save the output of ls into a file (using <) and then count the number of
lines in the file using wc-l command. This method, though it works, requires an intermediate file.
The third and the best method is to connect the two commands, so that one can take input
from the other. This is can be done using the pipe (|) operator as follows:
$ ls sales | wc -l
Here the output of ls has been passed directly to the input of wc. That is, ls is said to be
piped to wc.
Shell Programming: - It is also called Shell script.
When to use Shell script/program:-
(i) Customizing your work environment. For example Every time you login it you want to
see the current date, a welcome message and the list of users who have logged on.
(ii) Automating your daily task. For example You may went to back up all of your
programs at an end of the day.
(iii) Automatic repetitive task. For example The repetitive task of compiling C
program, linking it which some libraries and executing the executable coexist.
raj 21

(iv) Preforming same operation on any files. For example You may want to replace a string
my printf in all the c program present in the directory.
Rules for creating shell program: -
(i) Open a new file with unique name and related too.
(ii) Write the sequence of instruction using set of UNIX commands.
(iii) After writing the instruction save the file and exit to the prompt shell.
Run Shell program: - Write he file name and run like:
.sh <file name>
Vi simple
$ .sh simple
Commands:-
(i) read:-
purpose: - To accept value from standard input device
(keyword).
Syntax: read var1 var2.
Example: read a b
(ii) echo:-
Purpose: - To display the contents on console.
Syntax: echo string
The System Kernel

The Kernel is at the core of UNIX system. This is loaded into the main memory as soon as the
system starts up. It manages memory, files and peripherals devices. It also maintains date and
time, launches applications and allocates system resources.
The different functions performed by the kernel are:
(a) Managing memory, namely allocating and deallocating memory area including address
space to each process.
(b) Scheduling, enabling each user to work efficiently.
(c) Organizing data transfer between I/O devices and memory.
(d) Accepting instructions from the shell and carrying them out.
(e) Enforcing security measures.
Kernel provides the basic full-time software connection to the hardware. The structure of
kernel is shown in the figure. The kernel handles memory management, input and output
requests, process scheduling etc. To help it with its work, the kernel also executes daemon
programs which stay alive as long as the machine is switched on and help perform tasks such as
printing or serving web documents. The kernel, thus controls and provides access to memory,
processor, input/output devices, disk files and provides special services to user programs.
The basic UNIX kernel can be broken into four main subsystems:
(a) process Management
(b) Memory Management
(c) I/O Management
(d) File Management
VI - EDITOR
Editor: It is a program that provides facility to read/write/modify/manipulation of
data/document/text etc. is known as Editor. Ex- EDIT in DOS, VI-EDITOR(UNIX) etc.
raj 22

There are two types of editor:


(1) Document editor and (2) Non-document editor (it doesnt allow any formatting like in
DOS)
UNIX EDITOR: There are three editor available in UNIX i.e. ED, EX and VI. The ED-editor
is the original program editor that has been a part of UNIX since very beginning. It is basically
line editor which means ED assigns line no. to lines of the files. It is just like EDIT of DOS.
Every time if we done something we must tell it to the ED-editor which function ate it line by
line.
An improved version of ED is called EX-editor. It is using friendlier and also understood
all the command of the ED-editor.
Compare to ED and EX both types of editor a new editor is now introduced which is
fastest editor of world, known as VI-editor.
VI-EDITOR: It is a full screen editor allows the user to view and edit the entire document at
the same time. Thus creating and editing of file become easier and that is the reason it become an
intent heat with the programs. Under this editor all the commands are under control of finger
trips.
Disadvantage of VI-editor:
(i) The user is always kept guessing. There are no self explanatory error messages. If any
thing goes round, only speakers keep to inform that something gets wrong.
(ii) There are not any online help in VI-editor.
(iii) There are three modes in which editor works. Under each mode same keys pressed to
create different effect. Hence each mode should be memorized.
(iv) VI-editor is functionally case-sensitive editor.
Mode of operation:
(i) Command Mode: - In this mode all the keys press by the user are interpreted to be editor
command.
Example: - Of hit h the cursor is move one position to left. In
command mode the keys are hit are not display on he screen.
raj 23

(ii) Insert mode: - This mode permits insertion of new editing or existing text or replacement
existing text. Each of these operations can be performed only after changing over from
the command mode to insertion mode using appropriate command. The insertion mode is
also known as Input text mode.
(iii) Ex- Command mode: - This mode permits us to give command at the command line.
The button line of the VI-screen is called the command line. VI-User the command
line to display message and commands. All command enter in the EX-command
mode are display in command line. This mode is show cause the command given in
this mode is comfortable for the commands of EX-editor.
Purpose: To create file/edit files/modify files.
Syntax: VI <file name>
(1)
Command for

positioning the cursor:


Command Function
h Moves the cursor one character to the left.
Backspace Moves the cursor one character to the left.
[ Moves the cursor one character to the right.
Spacebar Moves the cursor one character to the right.
$ Moves the cursor to end of current line.
0 Moves the cursor to the beginning of current line.
(2) Positioning by line:
Command Function
J Moves the cursor down the line from the current position in the same
column.
K Moves the cursor up one line from its present position in the same
column.
+ Moves the cursor down to the beginning of the next line.
- Moves the cursor up to the end of the current line.
(3) Positioning the cursor by word:
Command Function
W Moves the cursor to the right, to the first character of the next line.
B Moves the cursor back to the first character of the previous word.
e Moves the cursor to the end of the current word.
(4) Positioning in the window:
Command Function
H Moves the cursor to the first line on the screen.(home)
M Moves the cursor to the middle line to the screen.
L Moves the cursor to the last line on the screen.
(5) Positioning in the file:
(i) Scrolling:
Command Function
raj 24
^+f Scrolls the screen forward a full screen/window.
^+b Scrolls the screen backward a full screen/window.
(ii) Positioning in the numbered line:
Command Function
G Moves the cursor to the beginning of the last line in the file.
nG Moves the cursor to the beginning of the nth line in the file.
(6) Command for inserting text:
Command Function
a Inter text input mode and appends text after the cursor.
i Inter text input mode and insert text at the cursor position.
A Inters text input mode and append text at the end of current line.
I Inter text input mode and insert text at the beginning of current line.
o Inter text input mode by opening a new line and below the current line.
O Inter text input mode by opening a new line immediately above the
current line.
R Inter text input mode and overwrites from current cursor position.
(7) Command mode for deleting text:
Command Function
x Deletes the character at the current cursor position.
X Deletes the character to the left of the cursor.
dw Deletes the word from the cursor to the next space.
dd Deletes the current line.
nx,ndw,ndd Delete n character, n word, n line respectively.
d0 Deletes the current line from the cursor to the beginning of the line.
$ Deletes the current line form the cursor to the end of the line.
(8) Command for writing in VI-Editor:
Command Function
zz Writes the buffer to the files and quit VI.{Save and exit}
:wd Write the buffer to the file and quit VI.
:w<filename> Write the buffer to the file (new file) and quit VI.
:q Write the buffer to the file (new file) and quit VI.
:w!<filename> Overwrites the existing file (new file) and quit VI.
:q! Quit VI whether or not changes mode to the buffer where written to
the file.
Compiling a C Program (cc)
C is the programming language that is most frequently associated with UNIX. In fact, bulk of the
operating system and applications are written in C only.
The development of a C program involves the following steps:
(a) Write the code in a text file, using an editor
(b) Compile the program
(c) Execute the program
(d) Debug the program
Many UNIX tools are involved in the above process. The following is a simple C
program that prints the message A Simple Program:
# include<stdio.h>
Main()
{
Printf(A Simple C Program);
Return 0;
raj 25

}
Let us nam the file as mess.c. This program can be compiled and executed as follows:
$ cc mess.c
$ a.out
The output is shown in the figure:-
The program is compiled with the cc command, which creates a file a.out, if the
programming code is correct. Just typing a.out will run the program.
To get your program into a file other than a.out, you can do either of the following two
things:
(a) rename a.out into any other filename you want.
(b) Use o option with the cc command. For example, the following command runs the C
compiler and places the executable code in a file called output:

$ cc o output mess.c
Now to run this program, you have to just give the filename output, as follows
$ output

$
$ vi mess.c
$ cc mess.c
$ ./a .out
$ Simple C Program
$
$ cc o output mess.c
$ ./output
$ Simple C Program
$
$ cc c main.c
$ cc c rect.c
$ cc c circle.c tri.c
$
$ cc o output main.o rect.o circle.o tri.o
$ ./output

This program calculates the area of the following shapes

1: Rectangle
2: Circle
3: Triangle

Select your choice:

Case study
Windows belongs to the category of software called a GUI (Graphical User Interface).
The user interface determines how you interact with your computer. The hardware part of the
interface consists of your screen monitor, the keyboard and the mouse. The software part of the
interface determines what things look like on the screen and how you give commands to your
raj 26

therefore was quite cumbersome. With the advent o Windows environment many of every day
computer tasks - such as running programs, opening files, choosing commands etc. are done
using a graphical approach that is very intuitive to new users o computers. Further, Windows
programs use the same command structure and graphical items on the screen, so if have mastered
one Windows program, learning others becomes very easy.
At the primary stage Windows was developed as a Operating Environment; a add on
DOS when it had version 3.1 or 3.11. But later it developed as a Operating System. Windows'95,
98 or later versions of Windows is self Operating System.
When we switch on our PC, Windows 95 or 98's logo appears on the screen and after
some time it become ready to accept our instruction. Windows 98 offers three views and you can
work in any of these three views. These are: -
1. Classic View - This is default view in which to select an icon or file, you have to click the
object once and to run a program or open a file you have to double-click the icon or filename.
2. Web Style View - This view is looks like a web page. To select an icon or a file you have to
position the mouse pointer on the object. To run a program or open a file, you have to click the
icon or file name once.
3. Custom View - This view gives you the flexibility to control the appearance as per your
convenience and the ease of working.
WINDOWS TERMINOLOGY
Choose : Executes a command.
Select : Selects an item to activate it so that it can be changed. Selecting a command or option
turns it on but does not complete it. Selected Text or menu names/items appear in reverse type or
a different colour. Selected options show a dot (.) or an (x). Also the selected graphics appear
enclosed by a dashed line or enclosed in boxes known as handles.
Point : Move the mouse so that the arrow pointer is on the desired menu name, command name
or graphic object.
Pointer : Pointer is the on-screen symbol controlled by the mouse. The pointer changes shape to
indicate the current status and the type of functions and selections available.
I-beam : When the mouse pointer is in a text area that you can edit, the pointer appears as a
vertical I-beam.
Mouse Buttons : Microsoft mouse has two buttons and other makes may have three. Clicking
the left button completes an action and clicking the right most button brings up the shortcut
menu. Sometimes third button (if available) works as double-click of left button.
Mouse and their Actions
The mouse is a very convenient hand-held pointing device which is used to control the
position of the on-screen pointer. As you move the mouse on your desk or mouse pad, the pointer
moves on the screen corresponding to the mouse movement. Using the mouse, you can select
menus, commands, text, graphic objects or windows.
The Main actions of mouse are as follows :-
Click - Press and release the left mouse button quickly as you point to an item. Clicking is used
to reposition the insertion point in text, select a menu, choose a command from a menu, or select
an option from a dialog box.
Double-click - As you point to the pointed item on the screen, press and release the left mouse
button twice quickly. By double-clicking an icon or file name, you can open an application or
window related to that icon or filename.
Right click - Position the tip of the mouse pointer in the desired location on a document or
toolbar and then click the right mouse button.
Dragging - Dragging is moving objects on the monitor's screen. To do so first position the
mouse pointer on the object. Next, you "Pick up" the object by pressing and holding down the
raj 27

left mouse button. While you are still holding down the mouse button, move the mouse pointer to
where you want to "Drop" the object, and then release the moue button.
ELEMENTS OF WINDOWS SCREEN
The opening screen of Windows 95/98 has following elements: -
1. The Desktop - The Desktop is your work area while working in Windows. It is called Desktop
because Windows uses your whole screen in a way that is similar to the way you use the top of a
desk.
2. Icons and their types - An icon is a graphic object that represents something on our computer
screen. It has three types as follows :-
System Icon - System icons are displayed along left edge of the screen. These objects are
created automatically by Windows 98 during its installation. Among them following five are
generally shows :-
My Computer This icon lets you browse through the resources
connected to your computer.
My Documents This icon represents a folder that is used by many
programs as a default location for starting the documents.
Internet Explorer This icon starts a Web Browser named Internet Explorer.
Network Neighborhood This icon shows the names of each server or computer in
your own work group.
Recycle Bin This icon provides temporary storage for files and folders
that you delete.
Shortcut Icons - A shortcut provides easy access to some objects on your system, such as
program, a document or a printer etc. The shortcut icon only contains information about the
location o the object but not the object itself. Thus deleting a shortcut does not delete the
program from the hard disk for that shortcut. These are the icons with small arrows in the lower
left corner.
Program, Folder and Document Icons - These are non-system icon without arrows and
represent the actual objects they describe. Thus if you delete such an icon you are deleting the
object itself, from the hard disk.
3. The Taskbar - It situated at the bottom of the screen and it has generally following four
parts :-
Start Buttons - It is located at the left end of the taskbar. It invokes Start menu, the
Gateway of Windows.
Toolbars - Toolbars represent a set of related icons for easy mouse access.
Task Buttons - Task buttons are displayed in the Centre portion of the Taskbar. A button
Appears for each program you have started or each document you have
Opened.
Notification Area - The right corner of the Taskbar has the notification area in which
Windows provides information about the status of your system
including Clock.

Types of Windows
There are three types of Windows :-
1. Application Window : It contains executing Windows programs, and are sized, moved,
opened and closed on the desktop.
2. Document Window: an application window generates Document windows. A document
window cannot be sized or moved outside the confines of its parent application window.
3. Folder Windows : Opening My computer, or any of the folder you move to the desktop
produces a folder window.
raj 28

Elements of a Window
Borders - The four edges that define the perimeter of a window are called borders. Borders also
provide a way to change the size of the window.
Title Bar - This bar shows the name of the open application, sometimes with open document
name. It has generally three more buttons at the right side of it, i.e.
a) Minimize Button - When we click on it, the application become minimize, i.e. a
button appears in the taskbar and the screen become blank, or another window appears in
front.
b) Maximize Button - After clicking on it the window spreads full of the screen. After
maximizing the window, the maximize button converts into Restore button. When we
click on it, the window comes back to its original size.
c) Close Button - If we click on it, the window, either application or document, will be
close.
Control Box - It is a small icon located on the left side of the Title Bar. When we click on it,
Control Menu appears with so many options.
Scroll Bars, Scroll Boxes and Scroll Buttons - If a window is not long enough to display its
contents completely, vertical scroll bar appears along the right edge. If the window is not wide
enough, a horizontal scroll bars appears along the bottom of the window.
Scroll Bars have some rectangular boxes called Scroll Box. Size of Scroll box is become
proportional of the size of the whole file and displayed content on the screen.
Scroll buttons appear along the top and bottom edges of the vertical scroll bar and along
the left and right edges of the horizontal scroll bar.
The Menu Bar - The row of words just below the Title bar constitute the Menu bar. Each word
in the Menu bar represents a menu, which opens up when you click it. Generally it comes with
an application window, not with a document window.
Toolbar - It consists generally below of the Menu bar. A toolbar has so many small buttons who
represents a command.
Work Area - This is working area of the application. Depend upon the program it may be a
drawing area, a typing area etc.

START
When we click on this button we get following options :-
Shut Down This option is used to turn off the computer smoothly. While we work in
Windows'9x or later, Windows automatically opens so many temporary
files in background. If it will mot turn off through this option, then it is
possible that some error may be appear in Harddisk. Here we get three
options generally - Shut Down to turn off the computer, Restart to
warm boot and Restart in MS-DOS mode to start the system in DOS
mode, so we can work further in DOS environment.
Run This option is used to run any program by simply typing its command
line. We can also search Program through Browse button.
Help This option provides help about Windows.
Find This option is used to find any file or folder among different disks on our
computer or on network. We can search any file or folder by its name,
text containing by it, its size etc.
Settings This options is used to configure the hardware of the computer system,
taskbar etc.
The Control Panel - Select it from Start->Settings->Control Panel. This option is used to
configure the system. Here we get lot of icons. From them someone are :-
raj 29

Accessibility Options - The Accessibility Properties dialog box lets you configure
Windows keyboard, sound, display, and mouse and other options for people with
disabilities. This icon appears only if you installed Accessibility options when you
installed Windows.

Add New Hardware - This Wizard configures Windows when you add new
hardware to your computer system.

Add/Remove Programs - This Program's dialog box helps us to install new programs or
uninstall programs, which was already installed and no longer use.

Date & Time - This option provides two tabs - First one is Date & Time and second
is Time Zone. Date & Time option is used to change the current date and time, and
Time zone is used to select the place from world map from where user work.

Display - The display Properties dialog box controls the appearance, resolution,
screen saver and other settings for your display monitor.

1. Background - Used to set the wallpaper and patterns.


2. Screensaver - Used to set the screen saver. Screen saver is a memory resident
program who automatically becomes active if we will not touch the keyboard or
mouse for some time. We can also change this time from here.
3. Appearance - This option is used to set the color of active title, inactive title,
menu, window etc.

4. Setting - This option is used to configure the hardware of the system.


5. Effects - This option is used to apply extra effects on icons, menus etc.
6. Web - This option is used to set the Desktop settings, i.e. whether the desktop
will be shown as web page or normal.

Fonts - When we click on it, a window will appear in which we can see name of all
the fonts installed in our computer. We can see detail of any font by simply double-
clicking on it. To install more fonts Choose Add New Fonts options from File Menu.
Then give the path for fonts name. Windows will automatically install it.

Game Controllers - This dialog box lets you install games.

Internet - This dialog box contains settings for your web browser and Internet
connection.

Keyboard - This dialog box contains settings that control your keyboard and the
cursor.

Mouse - This dialog box lets you define the buttons on your mouse. It lets you
choose how fast you need to double click, what your mouse pointer looks like on-
screen, and whether moving the mouse leaves a trial.

Multimedia - This dialog box contains settings for the audio, video, MIDI, and
audio CD settings of your computer.
raj 30

Network - The network dialog box contains settings, you use when configuring a
local area network. It also contains settings for connecting to the Internet.

Passwords - This dialog box lets you set a password for using Windows on your
computer, user profiles if more than one person will use the computer, and other
security settings.

Power Management - This dialog box contains controls to be set when Windows 98
automatically turns off your monitor, hard disks, and other computer components to
save electricity.

Printer - This icon is used to open the Printer window from where we can Add,
Remove or configure the printer.

Regional Settings - It lets you tell Windows 98 the time zone, currency, number
format, and date format you prefer to use.

Sounds - It lets you assign a sound to each Windows event, or events in other
programs. For example, you can set your computer to play a fanfare when your e-
mail program receives new messages.

System - It lets you use the Device manager to change advanced settings for each
hardware component of your computer. You can also optimize the performance of
your computer.

Telephony - The Dialing Properties dialog box contains settings that control how
Windows 98 dials the phone using your modem.

Users - The Enable Multi-user Settings Wizard helps you set up user names and
passwords so your computer can be used by more than one person. Each person's
user name can store that person's desktop settings.

Printer- this option is used to open the Printer window from where we can Add, Remove
or configure the printer.

Taskbar & Startmenu - This option is used to set the taskbar options, i.e. autohide, show
clock, small icons in windows and also items which will be included or excluded in Start
Menu or its Sub-menus.

Folder Options - This options is used to set the options about folders, i.e. which types of
filenames should be shown in different folder window or in explorer.

Active Desktop - This option is used to set the Desktop settings, i.e. whether the desktop
will be shown as web page or normal.

Documents This option contains last used document's list, so user can open it again
quickly from here.
raj 31

Programs This is the gateway to start any program in windows. There is lot of
group or application icons can access through this option.

Windows Accessories:
We can choose Start -> Programs -> Accessories to work on elements of accessories.

1. Entertainment: We can choose Accessories->Intertainmentto entertain ourselves. From


the Multimedia we can hear song by CD Player or see movies through Media Player. The
coming screen will show same button to do it as its physical device, i.e. CD player or a
VCD player.

2. Games: When we slide our mouse at Accessories->Games then we get four games, i.e.
Solitaire, Mine- sweeper, Heart and Free-cell.

3. System Tools: There are two types of system tools -


a) Scandisk - Used to check and repair the error of the disks.
b) Disk Defragmenter - This option is used to defrag the disk. Defrag reorganizes the files
on a disk to optimize disk performance. Due to it the speed of the programs increase.
c) Backup - This option is used to take backup of selected file to destination drive. We can
also restore files trough RESTORE tab.
d) Disk Cleanup - Through this utility we can instruct Windows to automatically clears
not required files from our Harddisk, i.e. files of Recycle Bin, Temp Directory's file,
temporary internet files etc.
e) Character Map: This program allows us to see the ASCII chart of a selected font. This
is very useful while we will work on a font, other than English or a Symbol font.
f) Compression Agent - This utility recompresses your files on disk.
g) Drive Converter (FAT 32) - Converts the (FAT) file Allocation table of our Harddisk to
32 bit, it is 16 bit and thus releases extra disk space.
h) Drive Space3 - Compresses and creates a new drive resident on existing drive.
i) Maintenance Wizard - Runs certain set of programs to keep our computer running in
optimum condition. It runs generally Scandisk, defrag and Compression program.
j) Scheduled Tasks - Allows scheduling of tasks at predetermined times, i.e. when the
Windows should run scandisk, defrag etc. automatically - weekly, monthly or any other
schedule.
k) System Information - Displays information about what is loaded and configured on
your system.

4. Calculator : When we click on it, a calculator will be open where we can do any type of
sum.
The Standard Calculator can be used to add, subtract, multiply, divide, take square root,
calculate percentage etc. The Scientific Calculator is considerably larger, more powerful and it
has many functions related to engineering, science etc. that can be used depending on our needs.
+ - Addition
- - Subtraction
* - Multiplication
/ - Division

5- Calendar: This option shows the calendar of a month or a particular day. We can also
change the month or year to see their calendar through choosing the Date option from
raj 32

Show Menu. User can also write their appointment within it when they are in Day View
(View-Day). We can also set alarm through the option Alarm-Set.

6. Cardfile: You can use Windows Cardfile to organize and manage information, such as
names, addresses, and phone numbers.
Adding More Cards
Cardfile adds new cards in the correct alphabetic order and scrolls to display the new card
at the front.
To add a new card to a file
1 From the Card menu, choose Add.
2 Type the text you want to appear on the index line.
3 Choose the OK button.
4 In the information area type text.
To Delete the card select Card-Delete and to make a little changes in a card choose Card-
Duplicate option. We can also AutoDial if our system is connected with phone with modem
through Card-AutoDial.

7. Imaging: Scanners, Digital Cameras, Clip Art CDs and the Internet give computer users
access to countless images, Which you can print, insert into your documents. The impact of
a picture can be improved by the addition of a few words, some highlighting and drawing
lines. Imaging for Windows is a tool for this.

8. Notepad: This program allows us to simply type anything in the text mode as in Edit.
File - New, Open, Save, Save as, Page Setup, and print and Exit.
Edit - Undo, Cut, Copy, Paste, Delete, Select All, Time/Date, Word Wrap.
Search - Find, Find Next (F3)
A very useful feature of Notepad is that it can automatically place a time-and-date
stamp in a document as and when it is opened. To do so move the insertion points to the
left margin of the first line in the Notepad and in capital letter type ".LOG". Save the file
and reopen the file and type the required notes. Save and close it again and once again
reopen it. We can see that how many times we reopen this file, we get automatic time and
date at the bottom of the earlier notes.

9. Wordpad: This is a Simple editor used to create, edit or print a document. It is more
powerful than Notepad and support format of Word 6.0, Write as well as Text format.
File - New, Open, Save, Save as, Page Setup, Print, Print Preview
Edit - Undo, Cut, Copy, Paste, Paste Special, Clear, Select All, Find, Find Next, Replace,
Links, Object Properties, and Object.
View - Toolbar, Format Bar, Ruler, Status Bar, Options-Shows options to Configure the
Wordpad i.e. options about measurement system and name of items appear during different
mode.
Insert - Date and Time, Object
Format - Font, Bullet Style, Paragraph, and Tab.

You can move in WordPad document using the mouse or the keyboard. Some of them are
following: -
With Cursor Key - Move one line up, down or one Character left or right.
With CTRL + Cursor Key - Move beg. Of paragraph, end of paragraph, one word left or
right.
With Pgdn/Pgup - Down one windowful/Up one windowful
raj 33

With CTRL + Pgdn/Pgup - To the End/Beginning of the last/first line the current window.
With Home/End - First/Last character in the current line.
With CTRL + Home/End - Beginning/End of the document.

With Mouse - Click and Drag in the direction want to select.


Click in left margin- Select a single line
Double click in Left margin - Select a paragraph
Triple Click in left margin or CTRL+ click in left margin - Select whole document.

10. Paint: This is a simple Drawing program, used to create, save, modify and print a graphics
image. This program is useful for creating pictures, icons etc. When we select this program
from Accessories, than an Application Window come.
The Paint screen can be divided into three parts: -
a) Toolbox: - It contains symbols representing drawing actions the cursor can perform.
b) Palette: - It contains a grid showing the various colors you can select and use.
c) Drawing Area: - This is the workspace where you create your Paint drawings.

Toolbox:
There are following types of tools at the toolbox:
a) Freeform Select b) Select c) Eraser d) Fill with color
e) Pick Colour f) Magnifier g) Pencil h) Brush
i) Air Brush j) Text k) Line l) Curve
m) Rectangle n) Polygon o) Ellipse p) Rounded Rectangle

Commands of Menus -:
File - New, Open, Save, Save As, Print Preview, Page Setup, Print, Set as Wallpaper
(Tiled), Set as Wallpaper (Centre).
Edit - Undo, Repeat, Cut, Copy, Paste, Clear Selection, Select All, Copy To, Paste From.
View - Toolbox, Color Box, Status Bar, Zoom, View Bitmap, Text Toolbar.
Image - Flip/Rotate, Stretch/Skew, Invert Colours, Attributes, Clear Image, Draw Opaque

Q. What is clipboard and how is it useful in WINDOWS based applications?


Ans. The clipboard is a built in utility program that aids the process off copying information
between different documents of the source application or between documents of different
application. Using clipboard, user can make a portion of text or graphics in one
application window and then use it in another application window. The clipboard works
with both text and graphics in Windows programs and only with text in the case of DOS
based programs.
Clipboard is a temporary main memory area on which we can Clip the data
required to be transferred. To transfer information to the clipboard you cut or copy the
information from the active window. When the information needs to be placed in an
application you can past, link on embeds the information. The information transferred to
the clipboard stays in the clipboard till it is deleted, replaced or the user exits from
Windows. The cut, copy and paste approach is used while transferring information to
another document using the clipboard.
Cutting Involves removing the information form its source location and putting it on
the clipboard. When the information is cut, it is deleted from its source windows.
Copying When the information is copied, the original is left intact and a duplicate copy
of the original is placed on the clipboard.
raj 34

Pasting Is the process o pasting whatever is on the clipboard into the destination
document.
Windows based application is generally written in coordination with other Windows
based application. This is very different from the way of DOS based applications work
where each application has its different file formats and file conversions that ware
required to transfer data form one application to another. With windows coming in
integrated documents can be prepared where say graphics are taken from paintbrush
document, charts from Excel documents and text from Word document. It is here that
clipboard comes in to play. The information from one application is first transferred to the
clipboard and thus forms the clipboard to the destination document.
Q. Differentiate between CUI and GUI? List the advantages of using GUI.
Ans. The CUI is an acronym for Character Using Interface or Character User Interface. It is a
type of display format used with most of the DOS based application packages that
enables a user to choose commands and see list of files and other option by pointing to
drop down menus using mouse or keyboard keys. The familiar example is the CUI used
with FoxPro package for DOS.
GUI (pronounced gooey) is an acronym for Graphical User Interface. It is a
type of display format that enables the user to choose commands start programs, and see
list of files and other options by pointing to pictorial representations (icons) and lists of
menu items on the screen. Choices can generally be activate either with the keyboard or
with a mouse. GUI offers an environment of what you see what you get.
For application developers, GUI offers an environment that takes care of the
direct interaction with the computer. This frees the developer to concentrate on the
application without getting bogged down in the details of screen display or mouse and
keyboard input. As the interface changes to support new input an output devices, such as
a large-screen monitor or an optical storage device, the applications can also, without
modification, use those devices.
Q. How do you change the settings of the mouse in WINDOWS? Is it possible to swap
the right and left buttons of the mouse?
Ans. To customize the mouse settings do the following:
1. Click Start
2. Select Settings
3. Open Control Panel by double clicking its icons.
4. From the Control Panel double click the mouse icon.
The mouse property box that appears offers the following customization features.
(a) Button This changes the function of the left and the right button.
(b) Pointers Creates a shadow of the mouse pointers movement on the screen.
(c) Motions The speed at which the mouse pointer moves relative physical to the
movement of the mouse.
(d) General Select the type of mouse used.
Q. What is a compound document and explain how it can be created.
Ans. A compound document is a single document made up of parts created in more than one-
application packages. For example, a report may contain a table created in Excel, and a
Logo created in a Clipart package. While finalizing the report in Word for Windows, you
can import table and the Logo from the different packages using Clipboard facility
available in Windows 98.
You can crate compound documents using the Edit menu's Paste Special option in the
application package in which you are assembling the document. In the application from
which you wish to link data, you select the data and place it on the clipboard using the
standard Cut or Copy commands. When the data to be linked is on the clipboard, use the
raj 35

paste Special option from the Edit menu to insert the information at the insertion point
and create the link. In the Paste Special dialog box click on the Paste Link option button
and then click on OK to create the link. After the link has been created, the information
will be updated into the receiving document whenever it is changed in the originating
document. As a result, you can build compound documents that assemble data from a
variety of resource applications and stay continuously updated. In a compound document
you do not have to manually move data form one applications the applications can now
handle that for you.
Ques. What does one mean by Cascading WINDOWS and Tiling Windows?
Ans. Windows offers two ways of arraigning the widows are open. These are:
(a) Cascading This causes all the open windows to be seized and staggered in such a
way that the tittle bars and edge or corner of every window is visible.
(b) Tiling Tile causes all the windows to be sized and lined up like tiles on a
bathroom wall.
Ques. What is screen saver and explain its utility?
Ans. Screen saver when set ON will blank the monitor screen or display a moving
image or pattern if the mouse or the keyboard is not used for a predetermined period of
time.
The use of screen saver is:
(a) Screen saver prevents damage to the screen by displaying a changing pattern.
(b) It also prevents the other viewers, from seeing what is on the screen when the user is
not working.
Q. Explain what do you understand by the term True Type of fonts.
Ans. True type of font gets their name from the fact that their appearance on the screen
is the same as the printer prints them. Prior to the introduction true type fonts computer
users needed separate screen fonts for display on the monitor and printer font, i.e.
printing on the printer. This is because printers and monitors have very different
resolution.
With the introduction of True Type fonts, however, a single font outline fulfills
both the roles. The True Type outline scales to any resolutions screen resolution, dot
matrix resolution, laser printer, or high quality type setting resolutions.
True Type fonts therefore offer two major advantages over the other fonts.
(a) These fonts are scalable, so only one picture of each character is needed instead of an
image for each character in each size.
(b) These fonts are independent, so only one version of the font must reside in the
Windows.
Q. Explain the term BITMAP.
Ans. A bitmap is the representation of an image by an array of bits. In a bitmap
characters or images are generated by writing the bit pattern to be displayed into the
associated storage, each bit of which is mapped to a pixel on the display surface.
In general, a bitmap image is a data structure that describes a bit image being held in
memory, such as its location in memory and its size.
Bit- mapped font
It is a set of characters in a particular size and style, in which each character is described
as a unique bit map (pattern of dots).
Bit-mapped graphics
These are the graphics that are stored and held as collections of bits in memory locations
corresponding to pixel on the screen. Bit- mapped graphics are typical of paint programs,
which treat images as collections of dots rather than as shapes. Within a computers
memory, a bit-mapped graphic is represented as an array (group) of bits that describe the
raj 36

characteristics of the individual pixels making up the image. Bitmapped graphics


displayed in colour require several to May bits per pixel, each describing some aspect of
the colour of a single spot on the screen
Q. What is difference between Notepad, WordPad and Microsoft Word?

Notepad WordPad Word


It is a simple text editor. It is Rich Text format Support so many formats.
editor.
Data written in it can open Data of this application Data of this application
anywhere. can open only in can open only in
compatible application. compatible application.
No support of Graphics. Graphics Support. Graphics Support.
Small file size. Large file size. Large file size.
No spelling and grammar No spelling and grammar Spelling & Grammar
check facility. check facility. check facility.

MULTIPROCESSING SYSTEMS
Multiprocessing system : A mode of operation that provides for parallel processing by two or
more processors of a multiprocessor. It can be used for speedup and for improving and
throughput of computer systems. Potential benefits of multiprocessing include increased
performance and computing power, fault tolerance, flexibility and modular growth. One of the
main design challenges of multiprocessor systems is to minimize interprocessor interactions and
to provide an efficient mechanism for carrying them out when necessary.
Advantages of Multiprocessors : The main advantages of multiprocessors are : - 1).
Performance and computing power; 2). Fault tolerance; 3). Flexibility; 4). Modular
growth; 5). Functional specialization & 6). Cost/performance.
1). Performance and computing power: Significant speedup of an application may be
possible by devoting multiple processors to it. Problems with higher or more frequent
interprocessor interactions can be solved more quickly than in a distributed system
because the interprocessor communication bandwidth is higher.
2). Fault tolerance: The inherent redundancy in multiprocessors can be employed to
increase availability and to eliminate single points of failure.
3). Flexibility: A multiprocessor system can be made to dynamically reconfigure and
tailor itself so as to optimize different objectives for different application.
4).Modular growth: A modular system design can be adapted to the needs of a specific
installation by adding exactly the type of component most likely to alleviate a major
bottleneck.
5). Functional specialization: It processors can be added to improve performance of particular
applications.
6). Cost/performance: Off-the-shelf microprocessors with a cost performance ratio order of
magnitude below that of supercomputers may be structure into multiprocessors that are cost-
effective for a wide range of applications.
Multiprocessor Classification : Several classification of multiprocessor system are presented
here. First of all based on relationship between instructions & data. This is given by
Flynn(1966).In this basis computer system can be characterized as SISD, SIMD, MISD, &
MIMD.
SISD: Single instruction stream, single data stream. This category encompasses
conventional serial computers.
raj 37

SIMD: Single instruction stream, multiple data streams. These are typically vector
processors & array computers.
MISD: Multiple instruction stream, single data stream. This is seldom-used organization
in which multiple instructions operate on a single data stream in parallel.
MIMD: Multiple instruction stream, multiple data streams. Simultaneous execution of
multiple instructions that operate on data streams.
nd
2 based on relationship between processors & memory, multiprocessors can be classified
as Tightly coupled & Loosely coupled.
Tightly coupled: Multiprocessors contain globally shared memory that all processors
have access to.
Loosely coupled: Individual processors have private memories, & there is no shared
globally memory.
On the basis of memory architecture & access delays :- UMA & NUMA. Sometimes a third
category in this basis is called NORMA.
Multiprocessor Interconnections: The nature of the multiprocessor interconnections path
has a dominant influence on the bandwidth & saturation point for systems communications.
The basic architecture of a representative group of common multiprocessor types are : 1).
Bus-Oriented system; 2). Crossbar-connected systems; 3). Hypercubes; 4). Multistage
switch-based systems.
1. Bus-Oriented system : One of the simplest ways to construct a multiprocessor is to use a
shared bus to connect processors & memories. A multitude of processors can
communicate with each other & with the globally shared memory over a shared bus. Two
primary points of connection in shared bus systems are the shared bus itself & the shared
memory. (1) cache is associated with the shared memory, & processors access it over the
bus; (2) cache is associated with each individual processor.
The existence of multiple caches creates problems when shared writable data are cached. In this
case, cache coherence must be maintain so that multiple physical copies of single logical datum
are consistent with each other in the presence of update activity.
2. Crossbar-connected systems : The crossbar itself has no contention. It allows simultaneous
access of N processors to N memories, provided that each processor access a different memory.
Thus, the cross bar is antithesis of the bus. The cross point switch is the only sorce of delay
between a processor and a memory. If processors have no private memories , the resulting
system is a UMA multiprocessor.for example successive elements may be placed in successive
memory modules. The cross bar requires N square crosspoint switch is to fully connect N end
points to N other end points, such as processor and memory. The quadratic growth of its
complexity with the number of components makes cross bar expensive and limits the scalability
of the resulting system.
2. Hypercubes: Various cube type multiprocessor topologies address the scalability & cost
issues by providing interconnections whose complexsity grows logarithmically with the
increasing number of nodes. The system topology is a three dimensional hypercube, with
a node placed at each vertex. Hypercube have a number of interesting mathematical
properties. Hypercubes are recursive structures in the sense that higher dimensional
hypercubes contain the lower dimensional hypercubes as their proper subsets.
Hypercubes provide a good basis for scalable, since their complexity grows
logarithmically with the number of nodes.
raj 38

3. Multistage switch-based systems: Processors & memories in a multiprocessor system can


be connected by means of a multistage switch. There are many variations of this
approach. A generalized form of this type of interconnection provides links between N
inputs & N outputs. It has m=log2N stages. Each stage consists of a set of N links
connected to N/2 interchange boxes.
The switching network can connect any input to any output by making appropriate
connections in each of the m stage. Multistage switching networks provide a form of
circuit switching. The switching networks augmented with processing capability in
switches is sometimes referred to as a combining network.
Types of multiprocessor operating systems:
1. Separate supervisors: In separate supervisors systems, each node contains a separate
operating system that manages local processor , memory, & I/O resources. In its
rudimentary form, the approach effectively manages each processor as an independent
system. A common example of separate supervisors is provided by hypercube systems.
2. Master/slave: In master/slave approach, one processor is dedicated to executing the
operating system. The remaining processors are usually identical & form a pool of
computational processors. The mater processor schedules the work & controls the activity
of slaves. With the addition of slave scheduling, a serial uniprocessor OS can be fairly
easily adapted for master/slave multiprocessor operation.
3. Symmetric:In a symmetric organization, all processors are functionally identical. The OS
is also symmetric in the sense that any processor may execute it. In the simplest form of a
symmetric organization, called floating master, the OS is more or less a single, large
critical section. The OS is not bound to any specific processor; it floats from one
processor to another.
The floating master is a natural first step in implementing the OS for a
symmetric multiprocessor. It is relatively easy to port an existing uniprocessor OS, such
as UNIX, to a shared memory UMA multiprocessor.
Multiprocessor OS function and requirements: A multiprocessor OS manages the
available resources and augments the hardware functionally to form an abstraction that
facilitates program execution & interaction with users. The three basic types of resources
that need to be manages are:
1. Processors scheduling is crucial for effective use of multiprocessors. The primary tasks
of a multiprocessor scheduler are to: a) Allocate processors among applications in a
manner consistent with system design objectives. b) Ensure efficient use of processors
allocated to an application.
2. Memory management in multiprocessors is highly dependent on the underlying
architecture & interconnection scheme. Memory in loosely coupled system is usually
handled independently, on a per-processor basis. The duality of memory management &
interprocess communication was exploited the designers of the Mach OS.
3. Device management has received little attention in multiprocessor system s to date. This
is partly due to early focus on speedup in compute intensive applications that tend to
execute for extanded periods of time & do not generate much i/o after the initial loading.
However, as multiprocessors are applied to more balance general purpose applications,
one can expect their i/o requirement increase in proportional with the realized throughput
& speedup.
Introduction to parallel programming :
Speedup: The speedup due to parallel execution of a program is limited by three major
factors:
1. The ratio of sequential to parallel sections of the code
raj 39

2. The available speedup for parallel portions


3. The setup, synchronization, and communication overhead introduced by parallel
operation

The serial portion of the program must be executed serially, so speedup is limited to the
parallel sections. This relationship was pointed out early on by Gene Amdahl s = 1/((1-f)
+f/k). where S is the speedup(s>1) relative to the standard case that resultd from
introduction of a k times faster component(k>1) i.e used a fraction of time f (F>1).
An example of Parallel programming: Matrix Multiplication
Program matrixmul; { parallel matrix multiplication}
Const N= ; { # of rows }
Var
I : integer; { private, in parents space}
A :array[1.. N,1..N] of integer;
[shared global variables]
b : array[1...N,1..N] of integer;
c : array[1..N,1..N] of integer;
done: semapher; {general}
process p_I(I : integer); { N such processes executed}
var
j,k,s : integer; {private local variables}
begin
for j := 1 to N do
begin
s:=o;
for k:=1 to Ndo s:=s+a[I,k]*b[k,j];
c[I,j]:=s
end; {for j}
signal(done)
end: {process P_I}
begin {parent-intialization}
done:=-(N); {needs N singles to become free}
for I := 1 to N do initiate p_i (i);
wait(done);

Security Threats and goals


The major security threats perceived by users and providers of computer-based systems include:-
(1). Unauthorized disclosure of information. (2). Unauthorized alteration or
destruction of information. (3). Unauthorized use of service. (4). Denial of service
to legitimate users.
Disclosure of information to unauthorized parties can result in breach of privacy and in both
tangible and intangible losses to the owner of the information. Revelation of a credit card
number, a proprietary product design, a list of customers, a bid on a contract, or strategic military
data can be used by adversaries in numerous ways. Depending on the nature of the nature of the
information in question, the consequences of abuse can range from inconvenience to catastrophic
losses. *In principle, the goal of computer security is to guard against and eliminate
potential threats. In particular, a secure system should maintain the integrity, availability, and
privacy of data. That is, the data maintained by the system should be correct, available, and
private. As far as security is concerned, data integrity usually means: (1). Protection from
unauthorized modification. (2). Resistance to penetration.(3). Protection from undetected
raj 40

modification of data. *Data correctness is a more general notion than security, because it often
implies additional provisions such as reliability of data entry and freedom from error in
manipulation. As related to security, data availability is usually interpreted in the narrow sense of
providing freedom from the denial of service due to external influence. Security is a measure of
confidence in how well the stated goals are met.
Penetration attempts:- There are numerous ways and entry points in which penetration of
a computer system may be attempted. Some of the better-known ones are:- 1. Logged-on
terminal:- The terminal is left unattended by the user. An intruder can access the system with
full access to all data available to the legitimate user whose identity is assumed. 2.
Passwords:- passwords used to authenticate users may be obtained by intruders for the purposes
of illegal access in a number of ways, including guessing, stealing, trial and error, or knowledge
of vendor-supplied passwords used for systems generation and maintenance. 3. Browsing:-
often, users may be able to uncover information that they are not authorized to access simply by
browsing through the system files. In many systems there are files with improperly or overly
permissively set access controls. 4. Trop doors:- These are the secret points of entry without
access authorization. They are sometimes left by software designers, presumably to allow them
to access and possibly modify their programs after installation and production use.5. Electronic
eavesdropping:- This may be accomplished via passive or active wire-taps or by means of
electromagnetic pickup of screen radiation. 6. Computer worms:- These programs can invade
computers, usually via a network and deny service to legitimate users by using inordinate
amounts of processing and communication resources for self-propagation. 7. Computer
viruses:- Viruses are pieces of code that infect other programs and often perform harmful acts,
such as deletion of files or corruption of the boot block.
Security policies and mechanisms:- security policies specify what is desired in terms of
protection and security. Security mechanisms specify how to effect the security policies and
enforce them in a given system. *security policies:- security policies have probably
been around since the accumulation of the first valuables that needed guarding. They usually
encompass procedures and processes that specify: 1. How information can enter and
exit the system. 2. who is authorized to access what information and
under what conditions. 3. what are the permissible flows of information
within the system. * Additional limitations, such as restricting database
queries about too large or too small sets, can be imposed to reduce the danger of deducing data
by statistical interference. * Mechanisms:- security measures include control and
monitoring of physical access to the computer premises as well as the internal, computer-system
security . External or physical security includes the standard techniques of fencing, surveillance,
authentication, and attendance monitoring.
Authentication:- This section discusses one-way authentication of users. * The primary
goal of authentication is to allow access to legitimate system users and to deny access to
unauthorized parties. The two primary measures of authentication effectiveness are (1). The false
acceptance ratio, that is, the percentage of illegitimate users erroneously admitted, and (2) the
false rejection ratio, that is, the percentage of legitimate users who are denied access due to
failure of the authentication mechanism. One-way authentication is usually based on:-
1. Possession of a secret(password) 2.Possession of an artifact. 3. Unique
physiological or behavioral characteristics of the user. * Protection and access
control:- The original motivation for protection mechanisms came with the advent of
multiprogramming. The intent was to confine each users program to its assigned area of
memory and thus prevent programs from trespassing and harming each other. With the increased
desire for sharing of objects in primary and secondary memory, more complex mechanisms for
access control were devised. Protection in computer systems:- protection in primary storage is
usually adjunct to address translation. Its objective is to allow concurrent and potentially
raj 41

mutually suspicious resident processes to share the common physical address space, primary
memory. When the program is loaded, the limit or the bound registers are set to delineate the
extent of its legitimate address space. At run time, each memory reference is prechecked to
verify that it is within the bounds. Access-matrix model of protection:- The use of
seemingly quite different protection mechanisms for primary and secondary memory can
sometimes obscure the basic underlying issues and principles. This section introduces the access-
matrix model of protection, which serves as a useful abstraction for reasoning about protection
mechanisms in computer systems. Access Hierarchies:- A simple form of access hierarchy is
provided by the duel, user/supervisor, mode of operation found in many computer systems. In
that model, a restricted range of operations is available in the user mode, which is a default for
program execution. Access lists:- Access lists are one way of recording access rights in a
computer system. They are frequently used in file systems. In principle, an access list is an
exhaustive enumeration of the specific access rights of all entities that are authorized access to a
given object. *Formal models of protection:- The need for protection arises when
subjects share information. Isolation and separation of users facilitates protection. However, the
inability to share information denies some of the major benefits of computerized information
processing. The protection problem is exacerbated in situations when the service needs to
retain some of the users data, say, for statistical or accounting purposes. This problem is known
as the selective-confinement problem. Formal models of protection provide an apparatus
for precise formulation and for reasoning about the correctness and completeness of the various
security policies and mechanisms. In this section we describe four formal models of protection.
The first two models, the access-control matrix and take-grant, formalize protection
systems based on discretionary access control. The primary concern hare is the Trojan-horse type
of attack. The two other models, Bell-Lapadula and the lattice model, deal with flow control and
mandatory access control. *Cryptography:- One way to strengthen security in computer
systems is to encrypt sensitive records and messages in transit and in storage. The basic model of
a cryptography system is illustrated in fig. The original unenciphered text is called the plaintext
or the clear text. It can be encrypted using some encryption method parameterized by a key. The
result is called ciphertext.

Basic model of a cryptographic system


The increased confidence in the integrity of systems that use encryption is based on the notion
that ciphertext should be very difficult to decipher without knowledge of the key. The art of
breaking ciphers is called cryptanalysis. It is probably as old as cryptography itself.
Worms and viruses:- The significant increase in the number of installed computers and the
global extent of computer communications have contributed to the proliferation of computer
warms and computer viruses. Computer worms:- A computer worm is a program capable of
reproducing and spreading itself to other computers, usually by means of a computer network.
The name worm was coined as an analogy to a tapeworm, a parasitic creature that lives in the
raj 42

intestines of infected humans and other vertebrates. Two major safeguards against computer
worms are:- 1. making penetration of each machine difficult. 2. Hindering worm
spreading. Computer viruses:- A computer viruses is code that attaches itself to other
programs in order to alter their behavior, often in a harmful way. A computer virus, like its
biological counterpart, cannot operate on its own and must enter a host program in order to be
activated. The existence of a computer virus typically encompasses four stages: 1. Dormancy.
2. Propagation. 3. Triggering. 4. Damage.

You might also like