Programming for Problem Solving- GTU 2018 - eBook PDF pdf download
Programming for Problem Solving- GTU 2018 - eBook PDF pdf download
https://ebooksecure.com/download/programming-for-problem-solving-
ebook-pdf/
http://ebooksecure.com/product/ebook-pdf-programming-problem-
solving-and-abstraction-with-c/
https://ebooksecure.com/download/problem-solving-and-python-
programming-ebook-pdf/
https://ebooksecure.com/download/programming-and-problem-solving-
with-python-ebook-pdf/
http://ebooksecure.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-7th-edition/
(eBook PDF) Java: An Introduction to Problem Solving
and Programming 8th Edition
http://ebooksecure.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-8th-edition/
https://ebooksecure.com/download/mathematics-1-gtu-2018-ebook-
pdf/
http://ebooksecure.com/product/ebook-pdf-matlab-a-practical-
introduction-to-programming-and-problem-solving-4th-edition/
http://ebooksecure.com/product/ebook-pdf-introduction-to-
programming-with-java-a-problem-solving-approach-3rd-edition/
http://ebooksecure.com/product/ebook-pdf-community-policing-
partnerships-for-problem-solving-8th-edition/
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018
About the Author
E Balagurusamy, is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also held
the positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna University,
Chennai. He is a teacher, trainer and consultant in the fields of Information Technology and Management.
He holds an ME (Hons) in Electrical Engineering and PhD in Systems Engineering from the Indian Institute
of Technology, Roorkee. His areas of interest include Object-Oriented Software Engineering, E-Governance:
Technology Management, Business Process Re-engineering and Total Quality Management.
A prolific writer, he has authored a large number of research papers and several books.
A recipient of numerous honors and awards, he has been listed in the Directory of Who's Who of Intellectuals
and in the Directory of Distinguished Leaders in Education.
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018
E Balagurusamy
Chairman
EBG Foundation
Coimbatore
Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be
reliable. However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any
information published herein, and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors,
omissions, or damages arising out of use of this information. This work is published with the understanding that McGraw
Hill Education (India) and its authors are supplying information but are not attempting to render engineering or other
professional services. If such services are required, the assistance of an appropriate professional should be sought.
Typeset at The Composers, 260, C.A. Apartment, Paschim Vihar, New Delhi 110 063 and printed at
Cover Printer:
Cover Designer: APS Compugraphics
Cover Image Source: Shutterstock
Visit us at: www.mheducation.co.in
Write to us at: info.india@mheducation.com
CIN: U22200TN1970PTC111531
Toll Free Number: 1800 103 5875
Preface
P
rogramming for Problem Solving requires a deep understanding of C. C is a powerful, flexible, portable
and elegantly structured programming language. Since C combines the features of high-level language
with the elements of the assembler, it is suitable for both systems and applications programming. It
is undoubtedly the most widely used general-purpose language today in operating systems, and embedded
system development. Its influence is evident in almost all modern programming languages. Since its
standardization in 1989, C has undergone a series of changes and improvements in order to enhance the
usefulness of the language.
Acknowledgements
I owe special thanks to the entire team of McGraw Hill Education India.
A note of acknowledgement is due to the following reviewers for their valuable feedback.
This book is my sincere attempt to make a footprint on the immensely vast and infinite sands of knowledge.
I would request the readers to utilize this book to the maximum extent.
E Balagurusamy
Publisher’s Note
McGraw Hill Education (India) invites suggestions and comments from you, all of which can be sent to info.
india@mheducation.com (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Contents
Translator Programs 58
Problem-Solving Techniques 59
Using the Computer 70
Learning Outcomes 70
Key Concepts 71
Review Questions 73
Discussion Questions 84
2. Fundamentals of C 87
Learning Objectives 87
History of C 87
Importance of C 89
Sample Program 1: Printing a Message 89
Sample Program 2: Adding Two Numbers 92
Sample Program 3: Interest Calculation 93
Sample Program 4: Use of Subroutines 95
Sample Program 5: Use of Math Functions 96
Basic Structure of C Programs 97
Programming Style 98
Executing a ‘C’ Program 99
UNIX System 99
MS-DOS System 102
Key Concepts 102
Always Remember 103
Review Questions 103
Debugging Exercises 105
Programming Exercises 105
5. Functions 220
Learning Objectives 220
Introduction 220
Need for User-Defined Functions 221
A Multi-Function Program 221
Elements of User-Defined Functions 224
x Contents
6. Pointers 273
Learning Objectives 273
Introduction 273
Understanding Pointers 274
Accessing the Address of a Variable 276
Declaring Pointer Variables 277
Initialization of Pointer Variables 278
Accessing a Variable Through its Pointer 279
Chain of Pointers 281
Pointer Expressions 282
Pointer Increments and Scale Factor 284
Pointers and Arrays 284
Pointers and Character Strings 288
Array of Pointers 290
Pointers as Function Arguments 291
Functions Returning Pointers 294
Contents xi
7. Structure 311
Learning Objectives 311
Introduction 311
Defining a Structure 312
Declaring Structure Variables 313
Accessing Structure Members 315
Structure Initialization 316
Copying and Comparing Structure Variables 318
Operations on Individual Members 320
Arrays of Structures 320
Arrays within Structures 323
Structures within Structures 324
Structures and Functions 326
Unions 329
Size of Structures 330
Bit Fields 330
Key Concepts 333
Always Remember 333
Brief Cases 334
Review Questions 338
Debugging Exercises 341
Programming Exercises 341
Introduction to computer and programming: Introduction, Basic block diagram and functions of various
components of computer, Concepts of Hardware and software, Types of software, Compiler and interpreter,
Concepts of Machine level, Assembly level and high level programming, Flowcharts and Algorithms
Fundamentals of C: Features of C language, structure of C Program, comments, header files, data types,
constants and variables, operators, expressions, evaluation of expressions, type conversion, precedence
and associativity, I/O functions
GO TO Chapter 2 Fundamentals of C
Control structure in C: Simple statements, Decision making statements, Looping statements, Nesting of
control structures, break and continue, goto statement
Array & String: Concepts of array, one and two dimensional arrays, declaration and initialization of arrays,
string, string storage, Built-in-string functions
Recursion: Recursion, as a different way of solving problems. Example programs, such as Finding
Factorial, Fibonacci series, Ackerman function etc. Quick sort or Merge sort.
Functions: Concepts of user defined functions, prototypes, definition of function, parameters, parameter
passing, calling a function, recursive function, Macros, Pre-processing
GO TO Chapter 5 Functions
Pointers: Basics of pointers, pointer to pointer, pointer and array, pointer to array, array to pointer, function
returning pointer
GO TO Chapter 6 Pointers
Structure: Basics of structure, structure members, accessing structure members, nested structures, array
of structures, structure and functions, structures and pointers
GO TO Chapter 7 Structure
introduction
A computer is an electronic machine that takes input from the user, processes the given input and generates
output in the form of useful information. A computer accepts input in different forms such as data, programs
and user reply. Data refer to the raw details that need to be processed to generate some useful information.
Programs refer to the set of instructions that can be executed by the computer in sequential or non-
sequential manner. User reply is the input provided by the user in response to a question asked by the
computer.
A computer includes various devices that function as an integrated system to perform several tasks
described above (Fig. 1.1). These devices are:
Central Processing Unit (CPU)
It is the processor of the computer that is responsible for controlling and executing instructions in the computer.
It is considered as the most significant component of the computer.
2 Programming for Problem Solving
Monitor
It is a screen, which displays information in visual form, after receiving the video signals from the computer.
Keyboard and Mouse
These are the devices, which are used by the computer, for receiving input from the user.
Computers store and process numbers, letters and words that are often referred to as data.
l How do we communicate data to computers?
l How do the computers store and process data?
Since the computers cannot understand the Arabic numerals or the English alphabets, we should use
some ‘codes’ that can be easily understood by them.
In all modern computers, storage and processing units are made of a set of silicon chips, each contain-
ing a large number of transistors. A transistor is a two-state device that can be put ‘off’ and ‘on’ by passing
an electric current through it. Since the transistors are sensitive to currents and act like switches, we can
communicate with the computers using electric signals, which are represented as a series of ‘pulse’ and
‘no-pulse’ conditions. For the sake of convenience and ease of use, a pulse is represented by the code ‘1’
and a no-pulse by the code ‘0’. They are called bits, an abbreviation of ‘binary digits’. A series of 1s and
0s are used to represent a number or a character and thus they provide a way for humans and computers
to communicate with one another. This idea was suggested by John Von Neumann in 1946. The numbers
represented by binary digits are known as binary numbers. Computers not only store numbers but also
perform operations on them in binary form.
In this chapter, we discuss how the numbers are represented using what are known as binary codes, how
computers perform arithmetic operations using the binary representation, how digital circuits known as logic
gates are used to manipulate data, how instructions are designed using what are known as programming
languages and how algorithms and flow charts might help us in developing programs.
generations of computers
The history of computer development is often discussed in terms of different LO 1.1
generation of computers, as listed below. Identify the various
l First generation computers generations
l Second generation computers of computers
l Third generation computers
l Fourth generation computers
l Fifth generation computers
Introduction to Computer and Programming 3
The progress in LSI and VLSI technologies led to the development of microprocessor, which became the
major characteristic feature of the fourth generation
computers. The LSI and VLSI technology allowed
thousands of transistors to be fitted onto one small silicon
chip.
A microprocessor incorporates various components
of a computer—such as CPU, memory and Input/Output
(I/O) controls—onto a single chip. Some popular later
microprocessors include Intel 386, Intel 486 and Pentium.
Some of the examples of fourth generation computers
are IBM PC, IBM PC/AT, Apple and CRAY-1.
Advantages
l LSI and VLSI technologies made them small,
cheap, compact and powerful.
l high storage capacity
l highly reliable and required very less maintenance. Fig. 1.5 The Intel P4004 microprocessor chip
Introduction to Computer and Programming 5
l provided a user-friendly environment with the development of GUIs and interactive I/O devices.
l programs written on these computers were highly portable because of the use of high-level languages.
l very versatile and suitable for every type of applications.
l required very less power to operate.
Disadvantages
l the soldering of LSI and VLSI chips on the wiring board was complicated
l still dependent on the instructions given by the programmer.
Fifth generation computers are based on the Ultra Large Scale Integration (ULSI) technology that allows
almost ten million electronic components to be fabricated on one small chip.
Advantages
l faster, cheaper and most efficient computers till date.
l They are able to execute a large number of applications at the same time and that too at a very high
speed.
l The use of ULSI technology helps in decreasing the size of these computers to a large extent.
l very comfortable to use because of the several additional multimedia features.
l versatile for communications and resource sharing.
Disadvantage
They are not provided with an intelligent program that could guide them in performing different operations.
Figure 1.6 shows a tree of computer family that illustrates the area-wise developments during the last
four decades and their contributions to the various generations of computers.
classification of computers
Computers can be classified into several categories depending on their LO 1.2
computing ability and processing speed. These include Classify computers on
l Microcomputer the basis of different
l Minicomputer criteria
l Mainframe computers
l Supercomputers
Microcomputers
A microcomputer is defined as a computer that has a microprocessor as its CPU and can perform the
following basic operations:
l Inputting — entering data and instructions into the microcomputer system.
l Storing — saving data and instructions in the memory of the microcomputer system, so that they can
be use whenever required.
l Processing — performing arithmetic or logical operations on data, where data, such as addition,
subtraction, multiplication and division.
l Outputting — It provides the results to the user, which could be in the form of visual display and/or
printed reports.
l Controlling — It helps in directing the sequence and manner in which all the above operations are
performed.
Minicomputers
A minicomputer is a medium-sized computer that is more powerful than a microcomputer. It is usually
designed to serve multiple users simultaneously, hence called a multiterminal, time-sharing system.
6 Programming for Problem Solving
Minicomputers are popular among research and business organizations today. They are more expensive
than microcomputers.
Mainframe Computers
Mainframe computers help in handling the information processing of various organizations like banks,
insurance companies, hospitals and railways. Mainframe computers are placed on a central location and
are connected to several user terminals, which can act as access stations and may be located in the same
building. Mainframe computers are larger and expensive in comparison to the workstations.
Supercomputers
In supercomputers, multiprocessing and parallel processing technologies are used to promptly solve
complex problems. Here, the multiprocessor can enable the user to divide a complex problem into smaller
problems. A supercomputer also supports multiprogramming where multiple users can access the computer
simultaneously. Presently, some of the popular manufacturers of supercomputers are IBM, Silicon Graphics,
Fujitsu, and Intel.
Magnetic Magnetic
Tape Disk
Arithmetic
Unit
Control
Unit
CPU
Data and results flow
Control Instructions to units
Instructions to control unit
Fig. 1.7 Interaction among hardware components
8 Programming for Problem Solving
l Processor — Also known as CPU, it is used to perform the calculations and information processing
on the data that is entered through the input device.
l Output devices — They are used for providing the output of a program that is obtained after
performing the operations specified in a program. The examples of output devices are monitor and
printer.
l Memory — It is used for storing the input data as well as the output of a program that is obtained
after performing the operations specified in a program. Memory can be primary memory as well as
secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Software supports the functioning of a computer system internally and cannot be seen. It is stored on
secondary memory and can be an application software as well as system software. The application
software is used to perform a specific task according to requirements and the system software (operating
system and networking system) is mandatory for running application software.
input DeVices
LO 1.3
Input devices are electromechanical devices that are used to provide data
Describe the computer
to a computer for storing and further processing, if necessary. Depending
system
upon the type or method of input, the input device may belong to one of the
following categories:
Keyboard is used to type data and text and execute commands. A standard keyboard, as shown in Fig. 1.8,
consists of the following groups of keys:
Numeric Keypad looks like a calculator’s keypad with its 10 digits and mathematical operators.
Special Purpose Keys The special purpose keys help perform a certain kind of operation, like exiting a
program (Escape) or deleting some characters (Delete) in a document, etc.
Mouse is a small hand-held pointing device that basically controls the two-dimensional movement of the
cursor on the displayed screen. It is an important part of the Graphical User Interface (GUI) based Operating
Systems (OS) as it helps in selecting a portion of the screen and copying and pasting the text.
The mouse, on moving, also moves the pointer appearing on the display device (Fig. 1.9).
Wheel
Right Button
Left Button
processor
The CPU consists of Control Unit (CU) and ALU. CU stores the instruction set, which specifies the
operations to be performed by the computer. CU transfers the data and the instructions to the ALU for
10 Programming for Problem Solving
an arithmetic operation. ALU performs arithmetical or logical operations on the data received. The CPU
registers store the data to be processed by the CPU and the processed data also. Apart from CU and ALU,
CPU seeks help from the following hardware devices to process the data:
Motherboard
It refers to a device used for connecting the CPU with the input and output devices. The components on the
motherboard are connected to all parts of a computer and are kept insulated from each other. Some of
the components of a motherboard are:
l Buses: Electrical pathways that transfer data and instructions among different parts of the computer.
For example, the data bus is an electrical pathway that transfers data among the microprocessor,
memory and input/output devices connected to the computer.
l System clock: It is a clock used for synchronizing the activities performed by the computer. The
electrical signals that are passed inside a computer are timed, based on the tick of the clock.
l Microprocessor: CPU component that performs the processing and controls the activities performed
by the different parts of the computer.
l ROM: Chip that contains the permanent memory of the computer that stores information, which cannot
be modified by the end user.
RAM
It refers to primary memory of a computer that stores information and programs, until the computer is used.
RAM is available as a chip that can be connected to the RAM slots in the motherboard.
Video Card/Sound Card
The video card is an interface between the monitor and the CPU. Video cards also include their own RAM
and microprocessors that are used for speeding up the processing and display of a graphic. A sound card is
a circuit board placed on the motherboard and is used to enhance the sound capabilities of a computer.
output DeVices
The main task of an output device is to convert the machine-readable information into human-readable form
which may be in the form of text, graphics, audio or video.
A monitor produces visual displays generated by the computer. The monitor is connected to the video card
placed on the expansion slot of the motherboard.
The monitors can be classified as cathode ray tube (CRT) monitors or liquid crystal display (LCD)
monitors. The CRT monitors are large, occupy more space in the computer, whereas LCD monitors are thin,
light weighted, and occupy lesser space. Both the monitors are available as monochrome, gray scale and
color models.
A monitor can be characterized by its monitor size and resolution. The monitor size is the length of the
screen that is measured diagonally. The resolution of the screen is expressed as the number of picture
elements or pixels of the screen. The resolution of the monitor is also called the dot pitch. The monitor with a
higher resolution produces a clearer image.
The printer is an output device that transfers the text displayed on the screen, onto paper sheets that can
be used by the end user. Printers can be classified based on the technology they use to print the text and
images:
l Dot matrix printers — Dot matrix printers are impact printers that use perforated sheet to print the
text. Dot matrix printers are used to produce multiple copies of a print out.
l Inkjet printers — Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints.
l Laser printers — The laser printer may or may not be connected to a computer, to generate an
output. These printers consist of a microprocessor, ROM and RAM, which can be used to store the
textual information.
These systems record the simple messages in human speech form and then combine all these simple
messages to form a single message. The voice response system is of two types—one uses a reproduction
of human voice and other sounds, and the other uses speech synthesis.
The basic application of a voice output system is in Interactive Voice Response (IVR) systems, which are
used by the customer care or customer support departments of an organization, such as telecommunication
companies, etc.
memory management
The memory unit of a computer is used to store data, instructions for processing data, intermediate results
of processing and the final processed information. The memory units of a computer are classified as primary
and secondary memory. Computers also use a third type of storage location known as the internal process
memory. This memory is placed either inside the CPU or near the CPU (connected through special fast
bus).
The primary memory is available in the computer as a built-in unit of the computer. The primary memory is
represented as a set of locations with each location occupying 8 bits. Each bit in the memory is identified by
a unique address. The data is stored in the machine-understandable binary form in these memory locations.
The commonly used primary memories are as follows:
l ROM — ROM represents Read Only Memory that stores data and instructions, even when the
computer is turned off. It is the permanent memory of the computer where the contents cannot be
modified by an end user. ROM is a chip that is inserted into the motherboard. It is generally used to
store the Basic Input/Output system (BIOS), which performs the Power On Self Test (POST).
l RAM — RAM is the read/write memory unit in which the information is retained only as long as there
is a regular power supply. When the power supply is interrupted or switched off, the information stored
in the RAM is lost. RAM is volatile memory that temporarily stores data and applications as long as
they are in use. When the use of data or the application is over, the content in RAM is erased.
l Cache memory — Cache memory is used to store the data and the related application that was last
processed by the CPU. When the processor performs processing, it first searches the cache memory
and then the RAM, for an instruction. The cache memory can be either soldered into the motherboard
or is available as a part of RAM.
Introduction to Computer and Programming 13
Secondary memory represents the external storage devices that are connected to the computer. They
provide a non-volatile memory source used to store information that is not in use currently. A storage
device is either located in the CPU casing of the computer or is connected externally to the computer. The
secondary storage devices can be classified as:
l Magnetic storage device — The magnetic storage devices store information that can be read,
erased and rewritten a number of times. These include floppy disk, hard disk and magnetic tapes.
l Optical storage device — The optical storage devices are secondary storage devices that use laser
beams to read the stored data. These include CD-ROM, rewritable compact disk (CD-RW), digital
video disks with read only memory (DVD-ROM), etc.
l Magneto-optical storage device — The magneto-optical devices are generally used to store
information, such as large programs, files and back-up data. The end user can modify the information
stored in magneto-optical storage devices multiple times. These devices provide higher storage
capacity as they use laser beams and magnets for reading and writing data to the device.
System software consists of many different programs that manage and support different tasks. Depending
upon the task performed, the system software can be classified into two major groups (Fig. 1.15):
l System management programs used for managing both the hardware and software systems. They
include:
∑ Operating system
14 Programming for Problem Solving
∑ Utility programs
∑ Device drivers
l System development programs are used for developing and executing application software. These
are:
∑ Language translators
∑ Linkers
∑ Debuggers
∑ Editors
Application software includes a variety of programs that are designed to meet the information processing
needs of end users. They can be broadly classified into two groups:
l Standard application programs that are designed for performing common application jobs. Examples
include:
∑ Word processor
∑ Spreadsheet
∑ Database Manager
∑ Desktop Publisher
∑ Web Browser
l Unique application programs that are developed by the users themselves to support their specific
needs. Examples include:
∑ Managing the inventory of a store
∑ Preparing pay-bills of employees in an organization
∑ Reserving seats in trains or airlines
l Handles the working of application programs with the hardware and other software systems.
l Manages the storage and retrieval of information using storage devices such as disks.
Based on their capabilities and the types of applications supported, the operating systems can be divided
into the following six major categories:
l Batch operating system — This is the earliest operating system, where only one program is allowed
to run at one time. We cannot modify any data used by the program while it is being run. If an error
is encountered, it means starting the program from scratch all over again. A popular batch operating
system is MS DOS.
l Interactive operating system — This operating system comes after the batch operating system,
where also only one program can run at one time. However, here, modification and entry of data
are allowed while the program is running. An example of an interactive operating system is Multics
(Multiplexed Information and Computing Service).
l Multiuser operating system — A multiuser operating system allows more than one user to use a
computer system either at the same time or at different times. Examples of multiuser operating
systems include Linux and Windows 2000.
l Multi-tasking operating system — A multi-tasking operating system allows more than one program
to run at the same time. Examples of multi-tasking operating systems include Unix and Windows 2000.
l Multithreading operating system — A multithreading operating system allows the running of
different parts of a program at the same time. Examples of multithreading operating system include
UNIX and Linux.
l Real-time operating systems — These operating systems are specially designed and developed for
handling real-time applications or embedded applications. Example include MTOS, Lynx, RTX
l Multiprocessor operating systems — The multiprocessor operating system allows the use of
multiple CPUs in a computer system for executing multiple processes at the same time. Example
include Linux, Unix, Windows 7.
l Embedded operating systems — The embedded operating system is installed on an embedded
computer system, which is primarily used for performing computational tasks in electronic devices.
Example include Palm OS, Windows CE
MS DOS or Microsoft Disk Operating System, which is marketed by Microsoft Corporation and is one of the
most commonly used members of the DOS family of operating systems. MS DOS is a command line user
interface, which was first introduced in 1981 for IBM computers. Although MS DOS, nowadays, is not used
as a stand-alone product, but it comes as an integrated product with the various versions of Windows.
16 Programming for Problem Solving
In MS DOS, unlike Graphical User Interface (GUI)-based operating systems, there is a command line
interface, which is known as MS DOS prompt. Here, we need to type the various commands to perform
the operations in MS DOS operating system. The MS DOS commands can be broadly categorized into the
following three classes:
l Environment command — These commands usually provide information on or affects operating
system environment. Some of these commands are:
∑ CLS: It allows the user to clear the complete content of the screen leaving only the MS-DOS
prompt.
∑ TIME: It allows the user to view and edit the time of the computer.
∑ DATE: It allows the user to view the current date as well as change the date to an alternate date.
∑ VER: It allows us to view the version of the MS-DOS operating system.
l File manipulation command — These commands help in manipulating files, such as copying a file or
deleting a file. Some of these commands include:
∑ COPY: It allows the user to copy one or more files from one specified location to an alternate
location.
∑ DEL: It helps in deleting a file from the computer.
∑ TYPE: It allows the user to view the contents of a file in the command prompt.
∑ DIR: It allows the user to view the files available in the current and/or parent directories.
l Utilities — These are special commands that perform various useful functions, such as formatting a
diskette or invoking the text editor in the command prompt. Some of these commands include:
∑ FORMAT: It allows the user to erase all the content from a computer diskette or a fixed drive.
∑ EDIT: It allows the user to view a computer file in the command prompt, create and modify the
computer files.
Windows Architecture
The architecture of Windows operating system comprises a modular structure that is compatible with a
variety of hardware platforms. Figure 1.17 shows the architecture of Windows 2000; the later releases of
Windows operating systems are based on similar architecture.
At a high level, the architecture is divided into three layers, viz.
l User mode: Comprises application and I/O specific software components
l Kernel mode: Has complete access to system resources and hardware
l Hardware: Comprises underlying hardware platform
User Mode
The various subsystems in the user mode are divided into the following two categories:
l Environment subsystems: Comprise subsystems that run applications written for other operating
systems. These subsystems cannot directly request hardware access; instead such requests are
processed by virtual memory manager present in the kernel mode. The three main environment
subsystems include Win32, OS/2 and POSIX. Each of these subsystems possess dynamic link
libraries for converting user application calls to Windows calls.
l Integral subsystems: Takes care of the operating system specific functions on behalf of the
environment subsystems. The various integral subsystems include workstation service, server service
and security.
Discovering Diverse Content Through
Random Scribd Documents
pretext for refusing it on account of its being broken
money.—Vide Edmerum Hist. Novor. p. 94.
488
Suger relates, that Henry was so terrified by a
conspiracy among his chamberlains, that he frequently
changed his bed, increased his guards, and caused a
shield and a sword to be constantly placed near him at
night: and that the person here mentioned, who had
been favoured and promoted in an especial manner by
the king, was, on his detection, mercifully adjudged to
lose only his eyes and his manhood, when he justly
deserved hanging.—De Vit. Lud. Grossi. Duchesne, iv.
308.
489
“Compare Malmesbury’s character of Henry in this
particular with that given of him by Henry of
Huntingdon.”—Hardy.
490
The ceremony of giving possession of lands or offices,
was, by the feudal law, accompanied with the delivery
of certain symbols. In conformity to this practice,
princes conferred bishoprics and abbeys by the
delivery of a crozier and a ring, which was called their
investiture: and as consecration could not take place
till after investiture, this, in fact, implied their
appointment also. The popes at length finding how
much such a practice tended to render the clergy
dependent on the temporal power, inhibited their
receiving investiture from laymen by the staff and ring,
which were emblems of their spiritual office. The
compromise of Henry with Paschal enacted, that in
future the king would not confer bishoprics by the staff
and ring; but that the bishops should perform the
ceremony of homage, in token of submission for their
temporals: the election by these means, remaining,
nominally, in the chapter, or monastery.
491
The printed copy, as well as such manuscripts as have
been consulted, read, “investituras consecrationum:”
evidently wrong; the true reading, as appears from
Edmer, p. 72, where the whole instrument is inserted,
being “investituram vel consecrationem.”
492
On Anselm’s return, shortly after Henry’s accession, it
was agreed that all matters should remain in
abeyance, until both parties should have sent
messengers to the pope, for his decision on the
subject of investitures. See Edmer, p. 56.
493
He had been recalled on the king’s accession, but
afterwards quitted the kingdom again.
494
“Henry married Adala, daughter of Godfrey, conte de
Louvain, in February, 1121.”—Hardy.
495
“Bromton (col. 1013, x. Scrip.) ascribes to Malmesbury
words which are no where to be found in this author,
‘Willelmus Malmesbiriensis dicit, quod ille Willelmus
regis primogenitus palam Anglis fuerat comminatus,
quod, si aliquando super eos regnaret, faceret eos ad
aratrum trahere quasi boves: sed spe sua coruscabili
Dei vindicta cum aliis deperiit.’”—Hardy.
496
“The nuptials of prince William with Matilda, daughter
of the earl of Anjou, were celebrated in June, 1119,
before the council of Rheims.”—Hardy.
497
See page 252.
498
Virgil Æneid. v. 206.
499
He is called a butcher by Orderic Vitalis, p. 867, who
has many particulars of this event.
500
“The marriage of William, son of the duke of
Normandy, with Sibilla, in 1123, was dissolved, at the
instance of king Henry, in the following year, by the
pope’s legate.”—Hardy.
501
“Matilda was betrothed to the emperor Henry V. in
1109, but was not married to him until the 7th
January, 1114.”—Hardy.
502
The church of St. Maria, in Scuola Græca, is so called,
from a tradition that St. Augustine, before his
conversion, there taught rhetoric.—See Lumisden, 318.
503
Trastevere, that part in which St. Peter’s is situated.
504
Three beautiful columns, supposed to be remains of
the temple of Jupiter Stator.
505
The principal entrance to St. Peter’s church, so called
by way of pre-eminence.
506
The Rota, which seems to have been a part of St.
Peter’s church, is not enumerated by Fontana, de
Basilica Vaticana.
507
The chapel, in which the tombs of the apostles are
said to be placed.
508
The patrician of Rome appears to have been its chief
magistrate; derived from the office of prefect or
patrician under the emperors of Constantinople.
509
As pope Calixtus II.
510
The church of St. Saviour, or St. John Lateran, built by
Constantine the Great.
511
MS. pravilegium, a play on the words privilegium and
pravilegium.
512
Cosenza, L’Abbe, tom. x.
513
Another MS. reads Troianus instead of Turianus.
514
“Septimo decimo. More correctly octavo decimo, as the
emperor went before Easter in the year 1117.”—Hardy.
515
“Paschal died in Jan. 1118.”—Hardy.
516
“Maurice Bourdin, archbishop of Brague, was elected
pope by the influence of the emperor Henry V, on the
9th of March, 1118, and took the name of Gregory
VIII.”—Hardy.
517
“Gelasius II, died at Clugny, 29th Jan. 1119.”—Hardy.
518
A monastery near Salerno, inaccessible, except by one
passage. Here were kept such as from their conduct
had become either dangerous or scandalous: they
were supplied with every thing necessary, according to
their order, but were held in close confinement. Its
name was given from the untameable disposition of its
inmates. See Orderic. Vital. 870.
519
This was a high compliment to the ancient Briton.
520
Guibert of Nogent excuses himself from
commemorating the valour of many of the crusaders,
because, after their return, they had run headlong into
every kind of enormity. Opera, p. 431.
521
Robert de Arbrisil founded the monastery of
Fontevrault in 1099, and died in 1117.
522
“Bernard founded the abbey of Tyron in 1109, and
died in 1116.”—Hardy.
523
At Lewes in Sussex.
524
The uppermost garment of the priest, covering the
rest entirely.
525
Those who officiated were enjoined to fold up their
garments.
526
It was customary to hold a short chapter immediately
after primes.
527
Odo, second abbat of Clugny, was founder of the
Clugniac rule in the tenth century. Odilo was elected
the fifth abbat of Clugny in 994.
528
Godfrey was prior of Winchester from A.D. 1082 to
1107. His verses in commendation of the chief
personages of England are in the manner of those
already inserted on Serlo abbat of Gloucester. Many of
his epigrams have very considerable merit.
529
He probably has Henry Huntingdon in view, who wrote
a History of England shortly after him.
530
Terentii Andria, i. 1.
531
What these were is unknown, as it is believed there is
no MS. of them now to be met with.
532
“The emperor Henry V. died on the 23rd of May, A.D.
1125; and in September, A.D. 1126, king Henry
returned from Normandy, with his daughter the
empress.”—Hardy.
533
“The union of the kingdoms under Egbert did not take
place for several years after his accession in 802.”—
Hardy.
534
This must be understood with the exception of Canute
and his sons, between Edmund Ironside, and Edward
the Confessor.
535
Here seems a mistake. Margaret was given to Malcolm
by her brother Edgar Atheling, while in exile in
Scotland, A.D. 1067. See the Saxon Chronicle.
536
“Robert was created earl of Gloucester in the year
1119. On the Pipe-roll, 31 Hen. I., this entry occurs:
‘Glœcecestrescire. Et comiti Glœc. xxii. numero pro
parte sua comitatus.’”—Hardy.
537
“The nuptials of Matilda with Geoffrey Plantagenet,
afterwards earl of Anjou, were celebrated in the
presence of her father, in Sept. 1127.”—Hardy.
538
“Henry completed the twenty-eighth year of his reign
the 4th of August, 1128; but the Saxon Chronicle
places his return from Normandy during the autumn of
1129.”—Hardy.
539
It is very remarkable what excessive pains were
employed to prevail on the young men to part with
their locks. In the council held at London by
archbishop Anselm, A.D. 1102, it is enacted, that those
who had long hair should be cropped, so as to show
part of the ear, and the eyes. From the apparently
strange manner in which this fashion is coupled in
Edmer, p. 81, one might be led to suspect, it was
something more than mere spleen which caused this
enactment. See also Orderic. Vitalis.
540
An allusion to his name, which signifies a lion.
541
Pope Innocent died A.D. 1143.
542
“Philippe, eldest son of Louis VI, was consecrated by
command of his father on the 14th April, 1129; but
meeting with an accidental death on the 13th October,
1131, the king, twelve days afterwards, caused his
second son, Louis, to be crowned at Rheims by the
Roman pontiff, Innocent II.”—Hardy.
543
Both the printed copy and the MSS., which have been
consulted, read here tricesimo primo, ‘thirty-first,’
[1131]; but it should be the thirty-second, 1132.—See
Hen. Hunt.
544
“Malmesbury seems to have committed two oversights
here. Henry went to Normandy for the last time on the
third before the nones of August, (that is, third,
instead of fifth), A.D. 1133. This is evident from the
eclipse he mentions, which took place on that day, as
well as from the testimony of the continuator of
Florence of Worcester, a contemporary Writer.”—
Sharpe. “Although all the MSS. read ‘tricesimo secundo,’
yet it is evident, from the context, that it should be
‘tricesimo tertio;’ the completion of Henry’s thirty-third
regnal year being on the 4th of August, 1133. This,
and other passages show, that Malmesbury reckoned
Henry’s reign to commence on the 5th of August, the
day of his consecration, and not on the 2nd of that
month, the day of his brother’s death.”—Hardy.
545
“The eclipse of the sun took place on the 2nd of
August, 1133, at mid-day.”—Hardy.
546
From what has been said above this should be two.
547
“Liberationes,” signifies, sometimes, what we now call
liveries, that is garments; sometimes money at stated
periods, or, as we should say, wages: it is here
rendered in the latter sense, as being distinct from
“solidatæ,” pay or stipends. Perhaps it was intended to
distinguish two orders of persons by this bequest;
servants and soldiers: otherwise it may mean
garments and wages.
548
“The majority of contemporary writers state that
Stephen’s coronation took place on the 26th
December.”—Hardy.
549
“The author of the Dialogus de Scaccario states that
for some time after the Norman conquest there was
very little money in specie in the realm, and that, until
the reign of Henry the First, all rents and farms due to
the king were rendered in provisions and necessaries
for his household; but Henry I ordered the payments
to be made in money: they were consequently made
‘ad scalam,’ and ‘ad pensum;’ ‘in numero,’ or by tale;
and ‘per combustionem,’ or melting, which latter mode
was adopted to prevent payment being made in
debased money; hence perhaps it was that Henry’s
money was of the best quality.”—Hardy.
550
The progress of some of Henry’s treasure is curious.
Theobald, earl of Blois, gave many jewels, which had
been bestowed on him by Stephen, his brother, to
certain abbeys, and these again sold them for four
hundred pounds to Suger, abbat of St. Denis. Henry,
Suger observes, used to have them set in most
magnificent drinking vessels. Suger, ap. Duchesne, t.
iv. p. 345.
551
Church-yards were, by the canons, privileged, so that
persons in turbulent times conveyed their property
thither for security.
552
It had been the practice to seize, to the king’s use,
whatever property ecclesiastics left behind them.
Henry of Huntingdon relates, that on the death of
Gilbert the Universal, bishop of London, who was
remarkable for his avarice, all his effects, and among
the rest, his boots crammed with gold and silver, were
conveyed to the exchequer. Anglia Sacra, ii. 698.
Sometimes, even what had been distributed on a
death-bed, was reclaimed for the king. Vide G. Neub.
3, 5. “This practice of seizing the property of
ecclesiastics at their death seems subsequently to
have settled down into a claim on the part of the king
of the cup and palfrey of a deceased bishop, prior, and
abbat. See Rot. Claus. 39 Hen. III, m. 17, in dorso.”—
Hardy.
553
It seems to have been a vexatious fine imposed on
litigants when, in their pleadings, they varied from
their declaration. Murder is sometimes taken in its
present acceptation; sometimes it means a certain fine
levied on the inhabitants where murder had been
committed.
554
Earls, till this time, had apparently been official; each
having charge of a county, and receiving certain
emoluments therefrom: but these created by Stephen,
seem to have been often merely titulary, with
endowments out of the demesnes of the crown. Rob.
Montensis calls these persons Pseudo-Comites,
imaginary earls, and observes that Stephen had
completely impoverished the crown by his liberalities
to them. Henry the Second, however, on being firmly
seated on the throne, recalled their grants of crown
lands, and expelled them the kingdom.
555
The term “miles” is very ambiguous: sometimes it is a
knight; sometimes a trooper; sometimes a soldier
generally. In later times it signified almost always a
knight; but in Malmesbury, it seems mostly a
horseman, probably of the higher order.
556
“Roger, the chancellor of England, was the son of
Roger, bishop of Salisbury, by Maud of Ramsbury, his
concubine.”—Hardy.
557
The author of the “Gesta Stephani,” says, the king
ordered both bishops to be kept without food, and
threatened, moreover, to hang the son of bishop
Roger. Gest. Stephani, 944. The continuator of Flor.
Wigorn. adds, that one was confined in the crib of an
ox-lodge, the other in a vile hovel, A.D. 1138.
558
It has before been related that Stephen made many
earls, where there had been none before: these seem
the persons intended by Malmesbury in many places,
when speaking of some of the king’s adherents.
559
It would seem from this passage that he had seen Livy
in a more complete state than it exists at present.
560
Horat. Epist. i. 1, 100.
561
The meaning of vavassour is very various: here it
seems to imply what we call a yeoman.
562
This he effected by means of scaling ladders, made of
thongs of leather. Gest. Stephani, 951.
563
Several MSS., as well as the printed copy, read 1142,
but one has 1141, which is right.
564
“Ranulf, earl of Chester, and his uterine brother,
William de Romare, were the sons of Lucia, countess
of Lincoln.”—Hardy.
565
The joust signifies a contest between two persons on
horseback, with lances: each singled out his opponent.
566
That is, as appears after, to acknowledge her publicly
as their sovereign.
567
Marchio: this latterly signified marquis in the sense we
now use it; but in Malmesbury’s time, and long after, it
denoted a guardian of the borders: hence the lords
marchers on the confines of Scotland and Wales;
though it does not appear very clearly how this should
apply to Wallingford, unless it was his place of birth.
568
This seems an oversight: as he had before related,
more than once that Stephen preceded Robert in
taking the oath to Matilda.
569
Virgil, Æn. i. 33.
570
The garrison having sallied out against him, he
suddenly passed a ford which was not generally known
and, repelling the enemy, entered the town with them.
Gesta Regis Stephani, 958.
571
One of the MSS. omits from, “This circumstance,” to
the end, and substitutes, ... “but these matters, with
God’s permission, shall be more largely treated in the
following volume.”
Transcriber’s Notes
Simple typographical errors were silently corrected,
except as noted below.
Punctuation, hyphenation, and spelling were made
consistent when a predominant preference was found in
this book; otherwise they were not changed.
Many names were spelled in more than one way; in
most cases, all variants have been retained here.
The spelling of non-English words was not checked.
Ambiguous hyphens at the ends of lines were
retained.
The page headers of the original book contained a
timeline. It is represented in this eBook by sidenotes,
beginning with “[A.D. year]”, placed between paragraphs
nearby their originally-printed positions, and shaded in
some versions of this eBook. Redundant headers have
been omitted, some of the dates are not in sequence,
and some headers were not printed near the topics to
which they refer.
All but three of the chapter headings used the
abbreviation “CHAP.”, so the three that were spelled out
have been changed to abbreviations.
The Index entries were not checked for proper
alphabetization or correct page references, but all of the
“U” entries have been moved to precede the “V” entries
rather than to follow them.
In the Index, inconsistent usage of periods and semi-
colons at the ends of main and sub-entries has not been
changed; occasional mis-capitalization following such
punctuation has not been changed; spellings that differ
from the ones on the referenced pages have not been
changed.
Unbalanced quotation marks in footnotes citing Hardy
have been remedied.
Page 19: “unluckly” was printed that way.
Page 196: Shows “1017–1031” as the years of
Canute’s reign, and also says he “reigned twenty years”.
Page 232: “to his day” appears to be a typographical
error for “to this day”.
Page 256: Text uses “Standford Brigge” and
“Stanford-bridge”; Index uses “Standford Bridge” to refer
to this page. All retained here.
Page 462: The opening quotation mark before “A.D.
1112, the fifth of the indiction,” has no obvious matching
closing mark.
Page 496: “none before, appropriating” was changed
here from “none before, appropropriating”, which
appears to be a typesetting error.
*** END OF THE PROJECT GUTENBERG EBOOK WILLIAM OF
MALMESBURY'S CHRONICLE OF THE KINGS OF ENGLAND ***
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
1.F.
1.F.1. Project Gutenberg volunteers and employees expend
considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.