You are on page 1of 51

Foundations of Computer Science 4th

Edition Behrouz Forouzan


Visit to download the full and correct content document:
https://ebookmass.com/product/foundations-of-computer-science-4th-edition-behrouz
-forouzan/
FOUNDATIONS
OF COMPUTER
SCIENCE
Behrouz Forouzan
FOURTH EDITION

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
FOUNDATIONS OF
COMPUTER SCIENCE
4TH EDITION
BEHROUZ FOROUZAN

Australia • Brazil • Mexico • Singapore • United Kingdom • United States

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product
text may not be available in the eBook version.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.


Foundations of Computer Science, © 2018, Cengage Learning EMEA


4th Edition
ALL RIGHTS RESERVED. No part of this work covered by
Behrouz Forouzan
the copyright herein may be reproduced or distributed
in any form or by any means, except as permitted by U.S.

Publisher: Annabel Ainscow copyright law, without the prior written permission of the
copyright owner.
List Manager: Jennifer Grene

Marketing Manager: Anna Reading For product information and technology assistance,
contact us at emea.info@cengage.com.
Content Project Manager: Phillipa
Davidson-Blake For permission to use material from this text or product,
and for permission queries,
Manufacturing Buyer: Eyvett Davis email emea.permissions@cengage.com.

Typesetter: SPi Global


British Library Cataloguing-in-Publication Data
Cover Designer: Cyan Design
A catalogue record for this book is available from the British Library.
Cover Image: © Evgeny Turaev/
Shutterstock ISBN: 978-1-4737-5104-0

Cengage Learning EMEA


Cheriton House, North Way,
Andover, Hampshire, SP10 5BE
United Kingdom

Cengage Learning is a leading provider of customized learning


solutions with employees residing in nearly 40 different countries
and sales in more than 125 countries around the world. Find your
local representative at: www.cengage.co.uk

Cengage Learning products are represented in Canada by


Nelson Education Ltd.

For your course and learning solutions, visit www.cengage.co.uk

Purchase any of our products at your local college store or at our


preferred online store www.cengagebrain.com

Printed in China by RR Donnelley


Print Number: 01   Print Year: 2017

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.


To Ryan, Justin, William, and Benjamin

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.


Contents
Preface xi
Trademarks xvii

1 Introduction 1
Turing Model 2
Von Neumann Model 4
Computer Components 6
History9
Computer Science as a Discipline  11
Outline of the Course 12
End-Chapter Materials 13
Practice Set 14

2 Number Systems 15
Introduction16
Positional Number Systems 16
Nonpositional Number Systems 31
End-Chapter Materials 32
Practice Set 34

3 Data Storage 39
Data Types 40
Storing Numbers 42
Storing Text 60
Storing Audio 61
Storing Images 63
Storing Video 65
End-Chapter Materials 66
Practice Set 68

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi  ontents
C

4 Operations on Data 73
Logic Operations 74
Shift Operations 79
Arithmetic Operations 82
End-Chapter Materials 86
Practice Set 87

5 Computer Organization 91
Introduction92
Central Processing Unit 92
Main Memory 94
Input/Output Subsystem 97
Subsystem Interconnection 104
Program Execution 109
Different Architectures 113
A Simple Computer 117
End-Chapter Materials 126
Practice Set 130

6 Computer Networks and ­Internet 133


Overview134
Application Layer 143
Transport Layer 156
Network Layer 159
Data-Link Layer 166
Physical Layer 174
Transmission Media  177
End-Chapter Materials 180
Practice Set 183

7 Operating Systems 187


Introduction188
Evolution189
Components  191
A Survey of Operating Systems 203
End-Chapter Materials 207
Practice Set 209

8 Algorithms 213
Concept214
Three Constructs 218
Algorithm Representation 219
A More Formal Definition 223
Basic Algorithms 224

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents
 vii

Subalgorithms233
Recursion234
End-Chapter Materials 236
Practice Set 238

9 Programming Languages 243


Evolution244
Translation246
Programming Paradigms 248
Common Concepts  257
End-Chapter Materials 267
Practice Set 269

10 Software Engineering 273


The Software Lifecycle 274
Analysis Phase 276
Design Phase 279
Implementation Phase 280
Testing Phase 283
Documentation285
End-Chapter Materials  286
Practice Set 288

11 Data Structure 291


Arrays292
Records298
Linked Lists 301
End-Chapter Materials 314
Practice Set 315

12 Abstract Data Types 317


Background318
Stacks320
Queues326
General Linear Lists 331
Trees337
Graphs343
End-Chapter Materials 344
Practice Set 346

13 File Structure 349


Introduction350
Sequential Files 350
Indexed Files 354
Hashed Files 355
Directories360

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii  ontents
C

Text versus Binary 362


End-Chapter Materials 363
Practice Set 364

14 Databases 369
Introduction370
Database Architecture 372
Database Models 373
The Relational Database Model 374
Database Design 381
Other Database Models 385
End-Chapter Materials 386
Practice Set 388

15 Data Compression 391


Introduction392
Lossless Compression Methods 392
Lossy Compression Methods 400
End-Chapter Materials 406
Practice Set 407

16 Security 411
Introduction412
Confidentiality415
Other Aspects of Security 428
Firewalls442
End-Chapter Materials 445
Practice Set 447

17 Theory of Computation 451


Simple Language 452
The Turing Machine 456
Gödel Numbers 463
The Halting Problem 464
The Complexity of Problems 467
End-Chapter Materials 469
Practice Set 470

18 Artificial Intelligence 473


Introduction474
Knowledge Representation 475
Expert Systems 485
Perception487

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents
 ix

Searching494
Neural Networks 498
End-Chapter Materials 501
Practice Set 503

19 Introduction to Social Media 507


Introduction508
Facebook508
Twitter514
End-Chapter Materials 521
Practice Set 522

20 Social and Ethical Issues 525


Ethical Principles 526
Intellectual Property 527
Privacy528
Computer Crimes 528
Hackers530
End-Chapter Materials 530
Practice Set 531

A Unicode 533
Planes534
ASCII  535

B Unified Modeling Language (UML) 539


The User View 540
The Structural View 541
The Behavioral View 543
The Implementation View 550

C Pseudocode 553
Components554

D Structure Chart 557


Structure Chart Symbols 557
Reading Structure Charts 560
Rules of Structure Charts 560

E Boolean Algebra and Logic Circuits  563


Boolean Algebra 563
Logic Circuits 574

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x  ontents
C

F Examples of Programs in C, C++, and Java 581


Programs in C Language  581
Programs in C++ Language 584
Programs in Java Language  587

G Mathematical Review 591


Exponent and Logarithm 591
Modular Arithmetic 595
Discrete Cosine Transform 599

H Error Detection and Correction 601


Introduction601
Block Coding 603
Linear Block Codes 606
Cyclic Codes 610
Checksum613

I Addition and Subtraction for


Sign-and-Magnitude Integers 617
Operations on Integers 617

J Addition and Subtraction for Reals 621


Operations on Reals 621

Acronyms 625

Glossary 629

Index 669

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.


Preface
Computers play a large part in our everyday lives and will continue to do so in the future.
Computer science is a young discipline that is evolving and progressing. Computer net-
works have connected people from far-flung points of the globe. Virtual reality is creating
three-dimensional images that amaze the eyes. Space exploration owes part of its success
to computers. Computer-generated special effects have changed the movie industry.
Computers have played important roles in genetics.

Audience
This book is written for both academic and professional audience. The book can be used
as a self-study guide for interested professionals. As a textbook, it can be used for a one-­
semester or one-quarter course. It is designed as the first course in computer science. This
book is designed for a CS0 course based on the recommendations of the Association of
Computing Machinery (ACM). It covers all areas of computer science in breadth. The
book, totally or partially, can also be used in other disciplines where the students need to
have a bird’s-eye view approach to the computer science.

Changes in the fourth edition


I have made several categories of changes in this edition.

Revised chapters and appendices


Minor changes have been made to almost all the chapters. Two new chapters have been
added (Chapters 19 and 20). Some materials have been removed from Chapter 4,
expanded and inserted as two new appendices (Appendices I and J).

Organization
The book is made of 20 chapters and 10 appendices.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii  reface
P

Chapters
Chapters are intended to provide the basic materials. However, not all chapters are needed
for every audience. The professor who teaches the course can decide which chapters to
use. We give guidance below.

Appendices
The appendices are intended to provide a quick reference or review of materials needed to
understand the concepts discussed in the book. There are ten appendices that can be used
by the students for reference and study.

Acronyms
The book contains a list of acronyms for finding the corresponding terms quickly.

Glossary
The book contains an extensive glossary giving full explanations of the terms used in the
book.

Pedagogy
Several pedagogical features of this text are designed to make it particularly easy for
students to understand the materials.

Visual approach
The book presents highly technical subject matter without complex formulas by using a
balance of text and figures. More than 400 figures accompanying the text provide a visual
and intuitive opportunity for understanding the material. Figures are particularly
important in explaining the relationship between components of a whole. For many
students, these concepts are more easily grasped visually than verbally.

Highlighted points
I have repeated important concepts in boxes for quick reference and immediate attention.

Examples and applications


Whenever appropriate, I have included examples that illustrate the concepts introduced
in the text.

Algorithms
The inclusion of algorithms in the text helps students with problem solving and
programming.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface
 xiii

Unified Modeling Language (UML)


Throughout the book I have used UML diagrams to make students familiar with this tool,
which is becoming the de facto standard in the industry.

End-of-chapter materials
Each chapter ends with a set of materials that includes the following:
Recommended reading
This section gives a brief list of references relative to the chapter. The references can be
used to quickly find the corresponding literature.
Key terms
The new terms used in each chapter are listed at the end of the chapter and their definitions
are included in the glossary.
Summary
Each chapter ends with a summary of the material covered by that chapter. The summary
consolidates the important learning points in one place for ease of access by students.

Practice set
Each chapter includes a practice set designed to reinforce salient concepts and encourage
students to apply them. It consists of three parts: quizzes, questions, and problems.
Quizzes
Quizzes, which are posted on the book website, provide quick concept checking. Students
can take these quizzes to check their understanding of the materials. The feedback to the
students’ responses is given immediately.
Questions
This section contains simple questions about the concepts discussed in the book. Answers
to the odd-numbered questions are posted on the book website to be checked by the
student.
Problems
This section contains more difficult problems that need a deeper understanding of the
materials discussed in the chapter. I strongly recommend that the student trys to solve all
of these problems. Answers to the odd-numbered problems are also posted on the book
website to be checked by the student.

Professor resources
The book contains complete resources for professors who teach the course. They can be
downloaded from the book site. They include:

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiv  reface
P

Presentations
The site includes a set of colorful and animated PowerPoint presentations for teaching the
course.
Solutions to practice set
Solutions to all questions and problems are provided on the book website for the use of
professors who teach the course.

Student resources
The book contains complete student resources on the book website. They include:
Quizzes
There are quizzes at the end of chapters that can be taken by the students. Students are
encouraged to take these quizzes to test their general understanding of the materials
presented in the corresponding chapter.
Solutions to odd-numbered practice sets
Solutions to all odd-number questions and problems are provided on the book website for
the use of students.

How to use the book


The chapters in the book are organized to provide a great deal of flexibility. I suggest the
following:
❑❑ Materials provided in Chapters 1 to 8 are essential to understand the rest of the book.
❑❑ Materials provided in Chapters 9 to 14 can be taught if the time allows. They can be
skipped in a quarter system.
❑❑ Chapters 15 to 20 can be taught at the discretion of the professor and the majors of
students.

Acknowledgments
It is obvious that the development of a book of this scope needs the support of many
people.

Peer reviewers
I would like to acknowledge the contributions from peer reviewers to the development of
the book. These reviewers are:

Sam Ssemugabi, UNISA Steve Maybank, Birbeck College


Ronald Chikati, Botswana Accountancy Mario Kolberg, University of Stirling
College Colin Price, University of Worcester
Alex Dandadzi, University of Limpopo Boris Cogan, London Metropolitan
Tom Verhoeff, Eindhoven University of University
Technology Thomas Mandl, University of Hildesheim
Stefan Gruner, University of Pretoria Daphne Becker, University of South Africa
Harin Sellahwea, University of Lubna Fekry Abdulhai and Osama
Buckingham Abulnaja, King Abdulaziz University
John Newman, University of Wales Katie Atkinson, University of Liverpool

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface
 xv

Publisher staff
Special thanks go to the staff of the publisher.
Andrew Ashwin Jennifer Grene
Annabel Ainscow Phillipa Davidson-Blake

Behrouz A. Forouzan
Los Angeles, CA.
January 2018

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.


Trademarks
Throughout the text we have used several trademarks. Rather than insert a trademark
symbol with each mention of the trademark name, we acknowledge the trademarks here
and state that they are used with no intention of infringing upon them. Other product
names, trademarks, and registered trademarks are the property of their respective
owners.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPTER 1
Introduction

The phrase computer science has a very broad meaning today. However, in this book, we
define the phrase as ‘issues related to the computer’. This introductory chapter first tries
to find out what a computer is, then investigates other issues directly related to comput-
ers. We look first at the Turing model as a mathematical and philosophical definition of
computation. We then show how today’s computers are based on the von Neumann
model. The chapter ends with a brief history of this culture-changing device . . . the
computer.

Objectives
After studying this chapter, the student should be able to:
❑❑ Define the Turing model of a computer.
❑❑ Define the von Neumann model of a computer.
❑❑ Describe the three components of a computer: hardware, data, and software.
❑❑ List topics related to computer hardware.
❑❑ List topics related to data.
❑❑ List topics related to software.
❑❑ Give a short history of computers.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
2 Introduction

1.1 TURING MODEL


The idea of a universal computational device was first described by Alan Turing in 1936.
He proposed that all computation could be performed by a special kind of a machine, now
called a Turing machine. Although Turing presented a mathematical description of such a
machine, he was more interested in the philosophical definition of computation than in
building the actual machine. He based the model on the actions that people perform
when involved in computation. He abstracted these actions into a model for a computa-
tional machine that has really changed the world.

1.1.1 Data processors


Before discussing the Turing model, let us define a computer as a data processor. Using
this definition, a computer acts as a black box that accepts input data, processes the data,
and creates output data (Figure 1.1). Although this model can define the functionality of
a computer today, it is too general. In this model, a pocket calculator is also a computer
(which it is, in a literal sense).

Figure 1.1 A single-purpose computing machine

Input data Computer Output data

Another problem with this model is that it does not specify the type of processing, or
whether more than one type of processing is possible. In other words, it is not clear how
many types or sets of operations a machine based on this model can perform. Is it a
­specific-purpose machine or a general-purpose machine?
This model could represent a specific-purpose computer (or processor) that is de-
signed to do a single job, such as controlling the temperature of a building or controlling
the fuel usage in a car. However, computers, as the term is used today, are general-purpose
machines. They can do many different types of tasks. This implies that we need to change
this model into the Turing model to be able to reflect the actual computers of today.

1.1.2 Programmable data processors


The Turing model is a better model for a general-purpose computer. This model adds an
extra element to the specific computing machine: the program. A program is a set of
instructions that tells the computer what to do with data. Figure 1.2 shows the Turing
model.
In the Turing model, the output data depends on the combination of two factors: the
input data and the program. With the same input data, we can generate different output
if we change the program. Similarly, with the same program, we can generate different

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
1.1 Turing Model 3

Figure 1.2 A computer based on the Turing model: programmable data processor

Program

Input data Computer Output data

outputs if we change the input data. Finally, if the input data and the program remain the
same, the output should be the same. Let us look at three cases.

Same program, different input data


Figure 1.3 shows the same sorting program with different input data. Although the
program is the same, the outputs are different, because different input data is processed.

Figure 1.3 The same program, different data

Program Sort

3, 12, 8, 22 Computer 3, 8, 12, 22


Input data Output data

Program Sort

14, 6, 8, 12 Computer 6, 8, 12, 14


Input data Output data

Same input data, different programs


Figure 1.4 shows the same input data with different programs. Each program makes the
computer perform different operations on the input data. The first program sorts the data,
the second adds the data, and the third finds the smallest number.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4 Introduction

Figure 1.4 The same data, different programs

Program Sort

3, 12, 8, 22 Computer 3, 8, 12, 22


Input data Output data

Program Add

3, 12, 8, 22 Computer 45
Input data Output data

Program Find
smallest

3, 12, 8, 22 Computer 3
Input data Output data

Same input data, same program


We expect the same result each time if both input data and the program are the same, of
course. In other words, when the same program is run with the same input data, we
expect the same output.

1.1.3 The universal Turing machine


A universal Turing machine, a machine that can do any computation if the appropriate
program is provided, was the first description of a modern computer. It can be proved that
a very powerful computer and a universal Turing machine can compute the same thing.
We need only provide the data and the program—the description of how to do the com-
putation—to either machine. In fact, a universal Turing machine is capable of computing
anything that is computable.

1.2 VON NEUMANN MODEL


Computers built on the Turing universal machine store data in their memory. Around
1944–1945, John von Neumann proposed that, since program and data are logically the
same, programs should also be stored in the memory of a computer.

1.2.1 Four subsystems


Computers built on the von Neumann model divide the computer hardware into four
subsystems: memory, arithmetic logic unit, control unit, and input/output (Figure 1.5).

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
1.2 Von Neumann Model 5

Figure 1.5 The Von Neumann model

Computer

Input / output

Arithmetic logic
Input unit (ALU) Output
data data
Memory

Control unit

Memory
Memory is the storage area. This is where programs and data are stored during processing.
We discuss the reasons for storing programs and data later in the chapter.

Arithmetic logic unit


The arithmetic logic unit (ALU) is where calculation and logical operations take place.
For a computer to act as a data processor, it must be able to do arithmetic operations on
data (such as adding a list of numbers). It should also be able to do logical operations on
data, as we will see in Chapter 4.

Control unit
The control unit controls the operations of the memory, ALU, and the input/output
subsystem.

Input / output
The input subsystem accepts input data and the program from outside the computer,
while the output subsystem sends the result of processing to the outside world. The defi-
nition of the input/output subsystem is very broad: it also includes secondary storage
devices such as disk or tape that stores data and programs for processing. When a disk
stores data that results from processing, it is considered an output device: when it reads
data from the disk, it is considered an input device.

1.2.2 The stored program concept


The von Neumann model states that the program must be stored in memory. This is
totally different from the architecture of early computers in which only the data was
stored in memory: the programs for their task were implemented by manipulating a set of
switches or by changing the wiring system.
The memory of modern computers hosts both a program and its corresponding data.
This implies that both the data and programs should have the same format, because they
are stored in memory. In fact, they are stored as binary patterns in memory—a sequence
of 0s and 1s.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
6 Introduction

1.2.3 Sequential execution of instructions


A program in the von Neumann model is made of a finite number of instructions. In this
model, the control unit fetches one instruction from memory, decodes it, then executes
it. In other words, the instructions are executed one after another. Of course, one
instruction may request the control unit to jump to some previous or following
instruction, but this does not mean that the instructions are not executed sequentially.
Sequential execution of a program was the initial requirement of a computer based on
the von Neumann model. Today’s computers execute programs in the order that is the
most efficient.

1.3 COMPUTER COMPONENTS


We can think of a computer as being made up of three components: computer hardware,
data, and computer software.

1.3.1 Computer hardware


Computer hardware today has four components under the von Neumann model, although
we can have different types of memory, different types of input/output subsystems, and
so on. We discuss computer hardware in more detail in Chapter 5.

1.3.2 Data
The von Neumann model clearly defines a computer as a data processing machine that
accepts the input data, processes it, and outputs the result.

Storing data
The von Neumann model does not define how data must be stored in a computer. If a
computer is an electronic device, the best way to store data is in the form of an electrical
signal, specifically its presence or absence. This implies that a computer can store data in
one of two states.
Obviously, the data we use in daily life is not just in one of two states. For example,
our numbering system uses digits that can take one of ten states (0 to 9). We cannot (as
yet) store this type of information in a computer: it needs to be changed to another system
that uses only two states (0 and 1). We also need to be able to process other types of data
(text, image, audio, video). These also cannot be stored in a computer directly, but need to
be changed to the appropriate form (0s and 1s).
In Chapter 3, we will learn how to store different types of data as a binary pattern, a
sequence of 0s and 1s. In Chapter 4, we show how data is manipulated, as a binary pat-
tern, inside a computer.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
1.3 Computer Components 7

Organizing data
Although data should be stored only in one form inside a computer, a binary pattern, data
outside a computer can take many forms. In addition, computers (and the notion of data
processing) have created a new field of study known as data organization, which asks the
question: can we organize our data into different entities and formats before storing them
inside a computer? Today, data is not treated as a flat sequence of information. Instead,
data is organized into small units, small units are organized into larger units, and so on. We
will look at data from this point of view in Chapters 11–14.

1.3.3 Computer software


The main feature of the Turing or von Neumann models is the concept of the program.
Although early computers did not store the program in the computer’s memory, they did
use the concept of programs. Programming those early computers meant changing the
wiring systems or turning a set of switches on or off. Programming was therefore a task
done by an operator or engineer before the actual data processing began.

Programs must be stored


In the von Neumann model programs are stored in the computer’s memory. Not only do
we need memory to hold data, but we also need memory to hold the program
(Figure 1.6).

Figure 1.6 Program and data in memory

Program

Data

Memory

A sequence of instructions
Another requirement of the model is that the program must consist of a sequence of
instructions. Each instruction operates on one or more data items. Thus, an instruction can
change the effect of a previous instruction. For example, Figure 1.7 shows a program that
inputs two numbers, adds them, and prints the result. This program consists of four
individual instructions.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
8 Introduction

Figure 1.7 A program made of instructions

1. Input the first number into memory.


2. Input the second number into memory.
3. Add the two together and store the result in memory.
4. Output the result.

Program

We might ask why a program must be composed of instructions. The answer is reusability.
Today, computers do millions of tasks. If the program for each task was an independent
entity without anything in common with other programs, programming would be diffi-
cult. The Turing and von Neumann models make programming easier by defining the
different instructions that can be used by computers. A programmer can then combine
these instructions to make any number of programs. Each program can be a different
combination of different instructions.

Algorithms
The requirement for a program to consist of a sequence of instructions made programming
possible, but it brought another dimension to using a computer. A programmer must not
only learn the task performed by each instruction, but also learn how to combine these
instructions to do a particular task. Looking at this issue differently, a programmer must
first solve the problem in a step-by-step manner, then try to find the appropriate instruction
(or series of instructions) to implement those steps. This step-by-step solution is called an
algorithm. Algorithms play a very important role in computer science and are discussed in
Chapter 8.

Languages
At the beginning of the computer age there was only one computer language, machine
language. Programmers wrote instructions (using binary patterns) to solve a problem.
However, as programs became larger, writing long programs using these patterns became
tedious. Computer scientists came up with the idea of using symbols to represent binary
patterns, just as people use symbols (words) for commands in daily life. Of course, the
symbols used in daily life are different from those used in computers. So the concept of
computer languages was born. A natural language such as English is rich and has many
rules to combine words correctly: a computer language, on the other hand, has a more
limited number of symbols and also a limited number of words. We will study computer
languages in Chapter 9.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
1.4 History 9

Software engineering
Something that was not defined in the von Neumann model is software engineering,
which is the design and writing of structured programs. Today it is not acceptable just to
write a program that does a task: the program must follow strict rules and principles. We
discuss these principles, collectively known as software engineering, in Chapter 10.

Operating systems
During the evolution of computers, scientists became aware that there was a series of
instructions common to all programs. For example, instructions to tell a computer where
to receive data and where to send data are needed by almost all programs. It is more
efficient to write these instructions only once for the use of all programs. Thus the concept
of the operating system emerged. An operating system originally worked as a manager to
facilitate access to the computer’s components by a program, although today operating
systems do much more. We will learn about them in Chapter 7.

1.4 HISTORY
In this section we briefly review the history of computing and computers. We divide this
history into three periods.

1.4.1 Mechanical machines (before 1930)


During this period, several computing machines were invented that bear little resemblance
to the modern concept of a computer.
❑❑ In the seventeenth century, Blaise Pascal, a French mathematician and philosopher,
invented Pascaline, a mechanical calculator for addition and subtraction operations.
In the twentieth century, when Niklaus Wirth invented a structured programming
language, he called it Pascal to honor the inventor of the first mechanical calculator.
❑❑ In the late seventeenth century, German mathematician Gottfried Leibniz invented a
more sophisticated mechanical calculator that could do multiplication and division as
well as addition and subtraction. It was called the Leibniz Wheel.
❑❑ The first machine that used the idea of storage and programming was the Jacquard
loom, invented by Joseph-Marie Jacquard at the beginning of the nineteenth century.
The loom used punched cards (like a stored program) to control the raising of the
warp threads in the manufacture of textiles.
❑❑ In 1823, Charles Babbage invented the Difference Engine, which could do more than
simple arithmetic operations—it could solve polynomial equations, too. Later, he in-
vented a machine called the Analytical Engine that, to some extent, parallels the idea
of modern computers. It had four components: a mill (corresponding to a modern
ALU), a store (memory), an operator (control unit), and output (input/output).
❑❑ In 1890, Herman Hollerith, working at the US Census Bureau, designed and built
a programmer machine that could automatically read, tally, and sort data stored on
punched cards.

Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Another random document with
no related content on Scribd:
Julia Redmond shook her head. She did not want compliments. The
eyes of the two women met and read each other.

"Couldn't you be frank with me, Madame? It is so easy to be frank."

It was, indeed, impossible for Julia Redmond to be anything else. The


comtesse, who was only a trifle older than the young girl, felt like her
mother just then. She laughed.

"But be frank—about what?"

"You see," said Julia Redmond swiftly, "I care absolutely nothing for the
Duc de Tremont, nothing."

"You don't love him?" returned Madame de la Maine, with deep


accentuation. "Is it possible?"

The girl smiled.

"Yes, quite possible. I think he is a perfect dear. He is a splendid friend


and I am devoted to him, but I don't love him at all, not at all."

"Ah!" breathed Madame de la Maine, and she looked at the American


girl guardedly.

For a moment it was like a passage of arms between a frank young


Indian chief and a Jesuit. Julia, as it were, shook her feathers and her beads.

"And I don't care in the least about being a duchess! My father made his
money in oil. I am not an aristocrat like my aunt," she said.

"Then," said the Comtesse de la Maine, forgetting that she was a Jesuit,
"you will marry Robert de Tremont simply to please your aunt?"

"But nothing on earth would induce me to marry him!" cried Julia


Redmond. "That's what I'm telling you, Madame. I don't love him!"

The Comtesse de la Maine looked at her companion and bit her lip. She
blushed more warmly than is permitted in the Faubourg St.-Germain, but
she was young and the western influence is pernicious.

"I saw at once that you loved him," said Julia Redmond frankly. "That's
why I speak as I do."

The Comtesse de la Maine drew back and exclaimed.

"Oh," said Julia Redmond, "don't deny it. I shan't like you half so well if
you do. There is no shame in being in love, is there?—especially when the
man you love, loves you."

The Comtesse de la Maine broke down, or, rather, she rose high. She
rose above all the smallness of convention and the rules of her French
formal education.

"You are wonderful," she said, laughing softly, her eyes full of tears.
"Will you tell me what makes you think that he is fond of me?"

"But you know it so well," said Julia. "Hasn't he cared for you for a long
time?"

Madame de la Maine wondered just how much Julia Redmond had


heard, and as there was no way of finding out, she said graciously:

"He has seemed to love me very dearly for many years; but I am poor; I
have a child. He is ambitious and he is the Duc de Tremont."

"Nonsense," said Julia. "He loves you. That's all that counts. You will be
awfully happy. You will marry the Duc de Tremont, won't you? There's a
dear."

"Happy," murmured the other woman, "happy, my dear friend, I never


dreamed of such a thing!"

"Dream of it now," said Julia Redmond swiftly, "for it will come true."
CHAPTER XIX

THE MAN IN RAGS

The Marquise d'Esclignac, under the stars, interviewed the native


soldier, the beggar, the man in rags, at the foot of the veranda. There was a
moon as well as stars, and the man was distinctly visible in all his squalor.

"What on earth is he talking about, Robert?"

"About Sabron, marraine," said her godson laconically.

The Marquise d'Esclignac raised her lorgnon and said:

"Speak, man! What do you know about Monsieur de Sabron? See, he is


covered with dirt—has leprosy, probably." But she did not withdraw. She
was a great lady and stood her ground. She did not know what the word
"squeamish" meant.

Listening to the man's jargon and putting many things together, Tremont
at last turned to the Marquise d'Esclignac who was sternly fixing the beggar
with her haughty condescension:

"Marraine, he says that Sabron is alive, in the hands of natives in a


certain district where there is no travel, in the heart of the seditious tribes.
He says that he has friends in a caravan of merchants who once a year pass
the spot where this native village is."

"The man's a lunatic," said the Marquise d'Esclignac calmly. "Get


Abimelec and put him out of the garden, Robert. You must not let Julia hear
of this."

"Marraine," said Tremont quietly, "Mademoiselle Redmond has already


seen this man. He has come to see her to-night."

"How perfectly horrible!" said the Marquise d'Esclignac. Then she


asked rather weakly of Tremont: "Don't you think so?"
"Well, I think," said Tremont, "that the only interesting thing is the truth
there may be in what this man says. If Sabron is a captive, and he knows
anything about it, we must use his information for all it is worth."

"Of course," said the Marquise d'Esclignac, "of course. The war
department must be informed at once. Why hasn't he gone there?"

"He has explained," said Tremont, "that the only way Sabron can be
saved is that he shall be found by outsiders. One hint to his captors would
end his life."

"Oh!" said the Marquise d'Esclignac. "I don't know what to do, Bob!
What part can we take in this?"

Tremont pulled his mustache. Mimi had circled round the beggar,
snuffing at his slippers and his robe. The man made no objection to the little
creature, to the fluffy ball surrounded by a huge bow, and Mimi sat
peacefully down in the moonlight, at the beggar's feet.

"Mimi seems to like him," said the Marquise d'Esclignac helplessly,


"she is very particular."

"She finds that he has a serious and convincing manner," said Tremont.

Now the man, who had been a silent listener to the conversation, said in
fairly comprehensible English to the Marquise d'Esclignac:

"If the beautiful grandmother could have seen the Capitaine de Sabron
on the night before the battle—"

"Grandmother, indeed!" exclaimed the marquise indignantly. "Come,


Mimi! Robert, finish with this creature and get what satisfaction you can
from him. I believe him to be an impostor; at any rate, he does not expect
me to mount a camel or to lead a caravan to the rescue."

Tremont put Mimi in her arms; she folded her lorgnon and sailed
majestically away, like a highly decorated pinnace with silk sails, and
Tremont, in the moonlight, continued to talk with the sincere and
convincing Hammet Abou.

CHAPTER XX

JULIA DECIDES

Now the young girl had his letters and her own to read. They were
sweet and sad companions and she laid them side by side. She did not
weep, because she was not of the weeping type; she had hope.

Her spirits remained singularly even. Madame de la Maine had given


her a great deal to live on.

"Julia, what have you done to Robert?"

"Nothing, ma tante"

"He has quite changed. This excursion to Africa has entirely altered
him. He is naturally so gay," said the Marquise d'Esclignac. "Have you
refused him, Julia?"

"Ma tante, he has not asked me to be the Duchess de Tremont."

Her aunt's voice was earnest.

"Julia, do you wish to spoil your life and your chances of happiness? Do
you wish to mourn for a dead soldier who has never been more than an
acquaintance? I won't even say a friend."

What she said sounded logical.

"Ma tante, I do not think of Monsieur de Sabron as dead, you know."


"Well, in the event that he may be, my dear Julia."

"Sometimes," said the girl, drawing near to her aunt and taking the older
lady's hand quietly and looking in her eyes, "sometimes, ma tante, you are
cruel."

The marquise kissed her and sighed:

"Robert's mother will be so unhappy!"

"But she has never seen me, ma tante."

"She trusts my taste, Julia."

"There should be more than 'taste' in a matter of husband and wife, ma


tante."

After a moment, in which the Marquise d'Esclignac gazed at the


bougainvillea and wondered how any one could admire its crude and vulgar
color, Miss Redmond asked:

"Did you ever think that the Duc de Tremont was in love?"

Turning shortly about to her niece, her aunt stared at her.

"In love, my dear!"

"With Madame de la Maine."

The arrival of Madame de la Maine had been a bitter blow to the


Marquise d'Esclignac. The young woman was, however, much loved in
Paris and quite in the eye of the world. There was no possible reason why
the Marquise d'Esclignac should avoid her.

"You have been hearing gossip, Julia."

"I have been watching a lovely woman," said the girl simply, "and a
man. That's all. You wouldn't want me to marry a man who loves another
woman, ma tante, when the woman loves him and when I love another
man?"

She laughed and kissed her aunt's cheek.

"Let us think of the soldier," she murmured, "let us think just of him, ma
tante, will you not?"

The Marquise d'Esclignac struck her colors.

In the hallway of the villa, in a snowy gibbeh, (and his clean-washed


appearance was much in his favor) Hammet Abou waited to talk with the
"grandmother" and the excellency.

He pressed both his hands to his forehead and his breast as the ladies
entered the vestibule. There was a stagnant odor of myrrh and sandalwood
in the air. The marble vestibule was cool and dark, the walls hung with
high-colored stuffs, the windows drawn to keep out the heat.

The Duc de Tremont and Madame de la Maine came out of the salon
together. Tremont nodded to the Arab.

"I hope you are a little less—" and he touched his forehead smiling, "to-
day, my friend."

"I am as God made me, Monsieur."

"What have you got to-day?" asked Julia Redmond anxiously, fixing her
eager eyes upon Hammet.

It seemed terrible to her that this man should stand there with a vital
secret and that they should not all be at his feet. He glanced boldly around
at them.

"There are no soldiers here?"

"No, no, you may speak freely."


The man went forward to Tremont and put a paper in his hands,
unfolding it like a chart.

"This is what monsieur asked me for—a plan of the battle-field. This is


the battle-field, and this is the desert."

Tremont took the chart. On the page was simply a round circle, drawn
in red ink, with a few Arabian characters and nothing else. Hammet Abou
traced the circle with his fingers tipped with henna.

"That was the battle, Monsieur."

"But this is no chart, Hammet Abou."

The other continued, unmoved:

"And all the rest is a desert, like this."

Tremont, over the man's snowy turban, glanced at the others and
shrugged. Every one but Julia Redmond thought he was insane. She came
up to him where he stood close to Tremont. She said very slowly in French,
compelling the man's dark eyes to meet hers:

"You don't wish to tell us, Hammet Abou, anything more. Am I not
right? You don't wish us to know the truth."

Now it was the American pitted against the Oriental. The Arab, with
deference, touched his forehead before her.

"If I made a true plan," he said coolly, "your excellency could give it to-
morrow to the government."

"Just what should be done, Julia," said the Marquise d'Esclignac, in


English. "This man should be arrested at once."

"Ma tante," pleaded Julia Redmond.

She felt as though a slender thread was between her fingers, a thread
which led her to the door of a labyrinth and which a rude touch might cause
her to lose forever.

"If you had money would you start out to find Monsieur de Sabron at
once?"

"It would cost a great deal, Excellency."

"You shall have all the money you need. Do you think you would be
able to find your way?"

"Yes, Excellency."

The Duc de Tremont watched the American girl. She was bartering with
an Arabian for the salvation of a poor officer. What an enthusiast! He had
no idea she had ever seen Sabron more than once or twice in her life. He
came forward.

"Let me talk to this man," he said with authority, and Julia Redmond did
not dispute him.

In a tone different from the light and mocking one that he had hitherto
used to the Arab, Tremont began to ask a dozen questions severely, and in
his answers to the young Frenchman, Hammet Abou began to make a
favorable impression on every one save the Marquise d'Esclignac, who did
not understand him. There was a huge bamboo chair on a dais under a
Chinese pagoda, and the Marquise d'Esclignac took the chair and sat
upright as on a throne. Mimi, who had just been fed, came in tinkling her
little bells and fawned at the sandals on Hammet Abou's bare feet. After
talking with the native, Tremont said to his friends:

"This man says that if he joins a Jewish caravan, which leaves here to-
morrow at sundown, he will be taken with these men and leave the city
without suspicion, but he must share the expenses of the whole caravan.
The expedition will not be without danger; it must be entered into with
great subtlety. He is either," said Tremont, "an impostor or a remarkable
man."
"He is an impostor, of course," murmured the Marquise d'Esclignac.
"Come here, Mimi."

Tremont went on:

"Further he will not disclose to us. He has evidently some carefully laid
plan for rescuing Sabron."

There was a pause. Hammet Abou, his hands folded peacefully across
his breast, waited. Julia Redmond waited. The Comtesse de la Maine, in her
pretty voice, asked quickly:

"But, mes amis, there is a man's life at stake! Why do we stand here
talking in the antechamber? Evidently the war office has done all it can for
the Capitaine de Sabron. But they have not found him. Whether this fellow
is crazy or not, he has a wonderful hypothesis."

A brilliant look of gratitude crossed Julia Redmond's face. She glanced


at the Comtesse de la Maine.

"Ah, she's got the heart!" she said to herself. "I knew it." She crossed
the hall to the Comtesse de la Maine and slipped her arm in hers.

"Has Monsieur de Sabron no near family?"

"No," said the Marquise d'Esclignac from her throne. "He is one of
those unfamilied beings who, when they are once taken into other hearts are
all the dearer because of their orphaned state."

Her tone was not unkind. It was affectionate.

"Now, my good man," she said to Hammet Abou, in a language totally


incomprehensible to him, "money is no object in this question, but what
will you do with Monsieur de Sabron if you find him? He may be an
invalid, and the ransom will be fabulous."

The Comtesse de la Maine felt the girl's arm in hers tremble. Hammet
Abou answered none of these questions, for he did not understand them. He
said quietly to Tremont:
"The caravan starts to-morrow at sundown and there is much to do."

Tremont stood pulling his mustache. He looked boyish and charming,


withal serious beyond his usual habit. His eyes wandered over to the corner
where the two women stood together.

"I intend to go with you, Hammet Abou," said he slowly, "if it can be
arranged. Otherwise this expedition does not interest me."

Two women said:

"Oh, heavens!" at once.

Robert de Tremont heard the note of anxiety in the younger voice alone.
He glanced at the Comtesse de la Maine.

"You are quite right, Madame," he said, "a man's life is at stake and we
stand chaffing here. I know something of what the desert is and what the
natives are. Sabron would be the first to go if it were a question of a brother
officer."

The Marquise d'Esclignac got down from her throne, trembling. Her
eyes were fixed upon her niece.

"Julia," she began, and stopped.

Madame de la Maine said nothing.

"Robert, you are my godson, and I forbid it. Your mother—"

"—is one of the bravest women I ever knew," said her godson. "My
father was a soldier."

Julia withdrew her arm from the Comtesse de la Maine as though to


leave her free.

"Then you two girls," said the Marquise d'Esclignac, thoroughly


American for a moment, "must forbid him to go." She fixed her eyes sternly
upon her niece, with a glance of entreaty and reproach. Miss Redmond said
in a firm voice:

"In Monsieur de Tremont's case I should do exactly what he proposes."

"But he is risking his life," said the Marquise d'Esclignac. "He is not
even an intimate friend of Monsieur de Sabron!"

Tremont said, smiling:

"You tell us that he has no brother, marraine. Eh bien, I will pass as his
brother."

A thrill touched Julia Redmond's heart. She almost loved him. If, as her
aunt had said, Sabron had been out of the question...

"Madame de la Maine," said the Marquise d'Esclignac, her hands


shaking, "I appeal to you to divert this headstrong young man from his
purpose."

The Comtesse de la Maine was the palest of the three women. She had
been quietly looking at Tremont and now a smile crossed her lips that had
tears back of it—one of those beautiful smiles that mean so much on a
woman's face. She was the only one of the three who had not yet spoken.
Tremont was waiting for her. Hammet Abou, with whom he had been in
earnest conversation, was answering his further questions. The Marquise
d'Esclignac shrugged, threw up her hands as though she gave up all
questions of romance, rescue and disappointed love and foolish girls, and
walked out thoroughly wretched, Mimi tinkling at her heels. The Comtesse
de la Maine said to Julia:

"Ma chère, what were the words of the English song you sang last night
—the song you told me was a sort of prayer. Tell me the words slowly, will
you?"

They walked out of the vestibule together, leaving Hammet Abou and
Tremont alone.
CHAPTER XXI

MASTER AND FRIEND

Pitchouné, who might have been considered as one of the infinitesimal


atoms in the economy of the universe, ran over the sands away from his
master. He was an infinitesimal dot on the desert's face. He was only a
small Irish terrier in the heart of the Sahara. His little wiry body and his
color seemed to blend with the dust. His eyes were dimmed by hunger and
thirst and exhaustion, but there was the blood of a fighter in him and he was
a thoroughbred. Nevertheless, he was running away. It looked very much
like it. There was no one to comment on his treachery; had there been,
Pitchouné would not have run far.

It was not an ordinary sight to see on the Sahara—a small Irish terrier
going as fast as he could.

Pitchouné ran with his nose to the ground. There were several trails for
a dog to follow on that apparently untrodden page of desert history. Which
one would he choose? Without a scent a dog does nothing. His nostrils are
his instinct. His devotion, his faithfulness, his intelligence, his heart—all
come through his nose. A man's heart, they say, is in his stomach—or in his
pocket. A dog's is in his nostrils. If Pitchouné had chosen the wrong
direction, this story would never have been written. Michette did not give
birth to the sixth puppy, in the stables of the garrison, for nothing. Nor had
Sabron saved him on the night of the memorable dinner for nothing.

With his nose flat to the sands Pitchouné smelt to east and to west, to
north and south, took a scent to the east, decided on it—for what reason will
never be told—and followed it. Fatigue and hunger were forgotten as hour
after hour Pitchouné ran across the Sahara. Mercifully, the sun had been
clouded by the precursor of a wind-storm. The air was almost cool.
Mercifully, the wind did not arise until the little terrier had pursued his
course to the end.

There are occasions when an animal's intelligence surpasses the human.


When, toward evening of the twelve hours that it had taken him to reach a
certain point, he came to a settlement of mud huts on the borders of an
oasis, he was pretty nearly at the end of his strength. The oasis was the only
sign of life in five hundred miles. There was very little left in his small
body. He lay down, panting, but his bright spirit was unwilling just then to
leave his form and hovered near him. In the religion of Tatman dogs alone
have souls.

Pitchouné panted and dragged himself to a pool of water around which


the green palms grew, and he drank and drank. Then the little desert
wayfarer hid himself in the bushes and slept till morning. All night he was
racked with convulsive twitches, but he slept and in his dreams, he killed a
young chicken and ate it. In the morning he took a bath in the pool, and the
sun rose while he swam in the water.

If Sabron or Miss Redmond could have seen him he would have seemed
the epitome of heartless egoism. He was the epitome of wisdom. Instinct
and wisdom sometimes go closely together. Solomon was only instinctive
when he asked for wisdom. The epicurean Lucullus, when dying, asked for
a certain Nile fish cooked in wine.

Pitchouné shook out his short hairy body and came out of the oasis pool
into the sunlight and trotted into the Arabian village.

* * * * * *
*

Fatou Anni parched corn in a brazier before her house. Her house was a
mud hut with yellow walls. It had no roof and was open to the sky. Fatou
Anni was ninety years old, straight as a lance—straight as one of the lances
the men of the village carried when they went to dispute with white people.
These lances with which the young men had fought, had won them the last
battle. They had been victorious on the field.
Fatou Anni was the grandmother of many men. She had been the
mother of many men. Now she parched corn tranquilly, prayerfully.

"Allah! that the corn should not burn; Allah! that it should be sweet;
Allah! that her men should be always successful."

She was the fetish of the settlement. In a single blue garment, her black
scrawny breast uncovered, the thin veil that the Fellaheen wear pushed back
from her face, her fine eyes were revealed and she might have been a
priestess as she bent over her corn!

"Allah! Allah Akbar!"

Rather than anything should happen to Fatou Anni, the settlement


would have roasted its enemies alive, torn them in shreds. Some of them
said that she was two hundred years old. There was a charmed ring drawn
around her house. People supposed that if any creature crossed it uninvited,
it would fall dead.

The sun had risen for an hour and the air was still cool. Overhead, the
sky, unstained by a single cloud, was blue as a turquoise floor, and against
it, black and portentous, flew the vultures. Here and there the sun-touched
pools gave life and reason to the oasis.

Fatou Anni parched her corn. Her barbaric chant was interrupted by a
sharp bark and a low pleading whine.

She had never heard sounds just like that. The dogs of the village were
great wolf-like creatures. Pitchouné's bark was angelic compared with
theirs. He crossed the charmed circle drawn around her house, and did not
fall dead, and stood before her, whining. Fatou Anni left her corn, stood
upright and looked at Pitchouné. To her the Irish terrier was an apparition.
The fact that he had not fallen dead proved that he was beloved of Allah. He
was, perhaps, a genie, an afrit.

Pitchouné fawned at her feet. She murmured a line of the Koran. It did
not seem to affect his demonstrative affection. The woman bent down to
him after making a pass against the Evil Eye, and touched him, and
Pitchouné licked her hand.

Fatou Anni screamed, dropped him, went into the house and made her
ablutions. When she came out Pitchouné sat patiently before the parched
corn, and he again came crawling to her.

The Arabian woman lived in the last hut of the village. She could satisfy
her curiosity without shocking her neighbors. She bent down to scrutinize
Pitchouné's collar. There was a sacred medal on it with sacred inscriptions
which she could not read. But as soon as she had freed him this time,
Pitchouné tore himself away from her, flew out of the sacred ring and
disappeared. Then he ran back, barking appealingly; he took the hem of her
dress in his mouth and pulled her. He repeatedly did this and the
superstitious Arabian believed herself to be called divinely. She cautiously
left the door-step, her veil falling before her face, came out of the sacred
ring, followed to the edge of the berry field. From there Pitchouné sped
over the desert; then he stopped and looked back at her. Fatou Anni did not
follow, and he returned to renew his entreaties. When she tried to touch him
he escaped, keeping at a safe distance. The village began to stir. Blue and
yellow garments fluttered in the streets.

"Allah Akbar," Fatou Anni murmured, "these are days of victory, of


recompense."

She gathered her robe around her and, stately and impressively, started
toward the huts of her grandsons. When she returned, eight young warriors,
fully armed, accompanied her. Pitchouné sat beside the parched corn,
watching the brazier and her meal. Fatou Anni pointed to the desert.

She said to the young men, "Go with this genie. There is something he
wishes to show us. Allah is great. Go."

* * * * * *
*

When the Capitaine de Sabron opened his eyes in consciousness, they


encountered a square of blazing blue heaven. He weakly put up his hand to
shade his sight, and a cotton awning, supported by four bamboo poles, was
swiftly raised over his head. He saw objects and took cognizance of them.
On the floor in the low doorway of a mud hut sat three little naked children
covered with flies and dirt. He was the guest of Fatou Anni. These were
three of her hundred great-great-grandchildren. The babies were playing
with a little dog. Sabron knew the dog but could not articulate his name. By
his side sat the woman to whom he owed his life. Her veil fell over her face.
She was braiding straw. He looked at her intelligently. She brought him a
drink of cool water in an earthen vessel, with the drops oozing from its
porous sides. The hut reeked with odors which met his nostrils at every
breath he drew. He asked in Arabic:

"Where am I?"

"In the hut of victory," said Fatou Anni.

Pitchouné overheard the voice and came to Sabron's side. His master
murmured:

"Where are we, my friend?"

The dog leaped on his bed and licked his face. Fatou Anni, with a whisk
of straw, swept the flies from him. A great weakness spread its wings above
him and he fell asleep.

Days are all alike to those who lie in mortal sickness. The hours are
intensely colorless and they slip and slip and slip into painful wakefulness,
into fever, into drowsiness finally, and then into weakness.

The Capitaine de Sabron, although he had no family to speak of, did


possess, unknown to the Marquise d'Esclignac, an old aunt in the provinces,
and a handful of heartless cousins who were indifferent to him.
Nevertheless he clung to life and in the hut of Fatou Anni fought for
existence. Every time that he was conscious he struggled anew to hold to
the thread of life. Whenever he grasped the thread he vanquished, and
whenever he lost it, he went down, down.
Fatou Anni cherished him. He was a soldier who had fallen in the battle
against her sons and grandsons. He was a man and a strong one, and she
despised women. He was her prey and he was her reward and she cared for
him; as she did so, she became maternal.

His eyes which, when he was conscious, thanked her; his thin hands that
moved on the rough blue robe thrown over him, the devotion of the dog—
found a responsive chord in the great-grandmother's heart. Once he smiled
at one of the naked, big-bellied great-great-grandchildren. Beni Hassan,
three years old, came up to Sabron with his finger in his mouth and
chattered like a bird. This proved to Fatou Anni that Sabron had not the Evil
Eye. No one but the children were admitted to the hut, but the sun and the
flies and the cries of the village came in without permission, and now and
then, when the winds arose, he could hear the stirring of the palm trees.

Sabron was reduced to skin and bone. His nourishment was insufficient,
and the absence of all decent care was slowly taking him to death. It will
never be known why he did not die.

Pitchouné took to making long excursions. He would be absent for days,


and in his clouded mind Sabron thought the dog was reconnoitering for him
over the vast pink sea without there—which, if one could sail across as in a
ship, one would sail to France, through the walls of mellow old Tarascon, to
the château of good King René; one would sail as the moon sails, and
through an open window one might hear the sound of a woman's voice
singing. The song, ever illusive and irritating in its persistency, tantalized
his sick ears.

Sabron did not know that he would have found the château shut had he
sailed there in the moon. It was as well that he did not know, for his
wandering thought would not have known where to follow, and there was
repose in thinking of the Château d'Esclignac.

It grew terribly hot. Fatou Anni, by his side, fanned him with a fan she
had woven. The great-great-grandchildren on the floor in the mud fought
together. They quarreled over bits of colored glass. Sabron's breath came
panting. Without, he heard the cries of the warriors, the lance-bearers—he
heard the cries of Fatou Anni's sons who were going out to battle. The
French soldiers were in a distant part of the Sahara and Fatou Anni's
grandchildren were going out to pillage and destroy. The old woman by his
side cried out and beat her breast. Now and then she looked at him
curiously, as if she saw death on his pale face. Now that all her sons and
grandsons had gone, he was the only man left in the village, as even boys of
sixteen had joined the raid. She wiped his forehead and gave him a potion
that had healed her husband after his body had been pierced with arrows. It
was all she could do for a captive.

Toward sundown, for the first time Sabron felt a little better, and after
twenty-four hours' absence, Pitchouné whined at the hut door, but would
not come in. Fatou Anni called on Allah, left her patient and went out to see
what was the matter with the dog. At the door, in the shade of a palm, stood
two Bedouins.

It was rare for the caravan to pass by Beni Medinet. The old woman's
superstition foresaw danger in this visit. Her veil before her face, her
gnarled old fingers held the fan with which she had been fanning Sabron.
She went out to the strangers. Down by the well a group of girls in
garments of blue and yellow, with earthen bottles on their heads, stood
staring at Beni Medinet's unusual visitors.

"Peace be with you, Fatou Anni," said the older of the Bedouins.

"Are you a cousin or a brother that you know my name?" asked the
ancient woman.

"Every one knows the name of the oldest woman in the Sahara," said
Hammet Abou, "and the victorious are always brothers."

"What do you want with me?" she asked, thinking of the helplessness of
the village.

Hammet Abou pointed to the hut

"You have a white captive in there. Is he alive?"

"What is that to you, son of a dog?"


"The mother of many sons is wise," said Hammet Abou portentously,
"but she does not know that this man carries the Evil Eye. His dog carries
the Evil Eye for his enemies. Your people have gone to battle. Unless this
man is cast out from your village, your young men, your grandsons and
your sons will be destroyed."

The old woman regarded him calmly.

"I do not fear it," she said tranquilly. "We have had corn and oil in
plenty. He is sacred."

For the first time she looked at his companion, tall and slender and
evidently younger.

"You favor the coward Franks," she said in a high voice. "You have
come to fall upon us in our desolation."

She was about to raise the peculiar wail which would have summoned
to her all the women of the village. The dogs of the place had already begun
to show their noses, and the villagers were drawing near the people under
the palms. Now the young man began to speak swiftly in a language that
she did not understand, addressing his comrade. The language was so
curious that the woman, with the cry arrested on her lips, stared at him.
Pointing to his companion, Hammet Abou said:

"Fatou Anni, this great lord kisses your hand. He says that he wishes he
could speak your beautiful language. He does not come from the enemy; he
does not come from the French. He comes from two women of his people
by whom the captive is beloved. He says that you are the Mother of sons
and grandsons, and that you will deliver this man up into our hands in
peace."

The narrow fetid streets were beginning to fill with the figures of
women, their beautifully colored robes fluttering in the light, and there were
curious eager children who came running, naked save for the bangles upon
their arms and ankles.

Pointing to them, Hammet Abou said to the old sage:

You might also like