100% found this document useful (1 vote)
67 views

Download Complete Essential Computer Science: A Programmer’s Guide to Foundational Concepts 1st Edition Paul D. Crutcher PDF for All Chapters

Foundational

Uploaded by

lapisofernon17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
67 views

Download Complete Essential Computer Science: A Programmer’s Guide to Foundational Concepts 1st Edition Paul D. Crutcher PDF for All Chapters

Foundational

Uploaded by

lapisofernon17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download Full Version ebook - Visit ebookmeta.

com

Essential Computer Science: A Programmer’s Guide


to Foundational Concepts 1st Edition Paul D.
Crutcher

https://ebookmeta.com/product/essential-computer-science-a-
programmers-guide-to-foundational-concepts-1st-edition-paul-
d-crutcher-2/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

Essential Computer Science: A Programmer’s Guide to


Foundational Concepts 1st Edition Paul D. Crutcher

https://ebookmeta.com/product/essential-computer-science-a-
programmers-guide-to-foundational-concepts-1st-edition-paul-d-
crutcher-2/
ebookmeta.com

Computer Science Principles The Foundational Concepts of


Computer Science Kevin Hare

https://ebookmeta.com/product/computer-science-principles-the-
foundational-concepts-of-computer-science-kevin-hare/

ebookmeta.com

Computer Science Principles : The Foundational Concepts of


Computer Science 4th Edition Kevin Hare

https://ebookmeta.com/product/computer-science-principles-the-
foundational-concepts-of-computer-science-4th-edition-kevin-hare/

ebookmeta.com

Teaching English Language and Literature 16 19 1st Edition


Furzeen Ahmed Marcello Giovanelli Megan Mansworth Felicity
Titjen
https://ebookmeta.com/product/teaching-english-language-and-
literature-16-19-1st-edition-furzeen-ahmed-marcello-giovanelli-megan-
mansworth-felicity-titjen/
ebookmeta.com
Understanding Religion and Popular Culture 2nd Edition
Elizabeth Rae Coody

https://ebookmeta.com/product/understanding-religion-and-popular-
culture-2nd-edition-elizabeth-rae-coody/

ebookmeta.com

Physics for Clinical Oncology Second Edition Amen Sibtain

https://ebookmeta.com/product/physics-for-clinical-oncology-second-
edition-amen-sibtain/

ebookmeta.com

Medical Biostatistics 4th Edition Abhaya Indrayan

https://ebookmeta.com/product/medical-biostatistics-4th-edition-
abhaya-indrayan/

ebookmeta.com

The Healer Second Circle 1st Edition Mike Ignatov

https://ebookmeta.com/product/the-healer-second-circle-1st-edition-
mike-ignatov/

ebookmeta.com

The Binding 1st Edition Rebecca Rathe

https://ebookmeta.com/product/the-binding-1st-edition-rebecca-rathe/

ebookmeta.com
CSEP Certified Personal Trainer CSEP CPT Certification and
Study Guide 3rd Edition Canadian Society Of Exercise
Physiology Csep
https://ebookmeta.com/product/csep-certified-personal-trainer-csep-
cpt-certification-and-study-guide-3rd-edition-canadian-society-of-
exercise-physiology-csep/
ebookmeta.com
Essential
Computer Science
A Programmer’s Guide to
Foundational Concepts

Paul D. Crutcher
Neeraj Kumar Singh
Peter Tiegs
Essential Computer
Science
A Programmer’s Guide to
Foundational Concepts

Paul D. Crutcher
Neeraj Kumar Singh
Peter Tiegs
Essential Computer Science: A Programmer’s Guide to Foundational
Concepts
Paul D. Crutcher Neeraj Kumar Singh
Welches, OR, USA Bangalore, Karnataka, India
Peter Tiegs
Hillsboro, OR, USA

ISBN-13 (pbk): 978-1-4842-7106-3 ISBN-13 (electronic): 978-1-4842-7107-0


https://doi.org/10.1007/978-1-4842-7107-0

Copyright © 2021 by Paul D. Crutcher, Neeraj Kumar Singh, and Peter Tiegs
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Susan McDermott
Development Editor: Laura Berendson
Coordinating Editor: Rita Fernando
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York,
1 New York Plaza, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-­sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available
to readers on GitHub via the book’s product page, located at www.apress.com/9781484271063. For
more detailed information, please visit http://www.apress.com/source-­code.
Printed on acid-free paper
To my wife, Lisa, for her unending support and
encouragement; to my sons currently studying
computer science, Kyle and Cameron, may this be
a bit of inspiration for their journey in life; and to the
memory of my father, Edwin Lee Crutcher, who passed
away while I worked on this book. I love you, Dad!
—Paul
To my wife, Shilpi, for her unwavering support.
—Neeraj
To Karen, Jane, Josephine, Henri, and
Jeanette, my family, for all of their support,
patience, and encouragement.
—Peter
Table of Contents
About the Authors�������������������������������������������������������������������������������xv

About the Contributors���������������������������������������������������������������������xvii

About the Technical Reviewer�����������������������������������������������������������xix


Acknowledgments�����������������������������������������������������������������������������xxi
Introduction�������������������������������������������������������������������������������������xxiii

Chapter 1: Fundamentals of a Computer System���������������������������������1


von Neumann Architecture�����������������������������������������������������������������������������������1
CPU: Fetch, Decode, Execute, and Store���������������������������������������������������������������3
Fetch����������������������������������������������������������������������������������������������������������������4
Decode, Execute, and Store���������������������������������������������������������������������������10
Controlling the Flow��������������������������������������������������������������������������������������13
The Stack�������������������������������������������������������������������������������������������������������15
Instruction Pipeline����������������������������������������������������������������������������������������21
Flynn’s Taxonomy������������������������������������������������������������������������������������������22
Main Memory and Secondary Storage����������������������������������������������������������������24
Input and Output (I/O)������������������������������������������������������������������������������������������26
Summary������������������������������������������������������������������������������������������������������������27
References and Further Reading������������������������������������������������������������������������28

v
Table of Contents

Chapter 2: Programming��������������������������������������������������������������������29
Programming Language Fundamentals��������������������������������������������������������������30
Hello, World!��������������������������������������������������������������������������������������������������31
Compile, Link, and Load���������������������������������������������������������������������������������32
High-Level Languages�����������������������������������������������������������������������������������35
Programming Paradigms������������������������������������������������������������������������������������38
Imperative Programming�������������������������������������������������������������������������������39
Declarative Programming������������������������������������������������������������������������������40
Object-Oriented Programming�����������������������������������������������������������������������42
Interpreted Programming������������������������������������������������������������������������������45
Parallel Programming������������������������������������������������������������������������������������47
Machine Learning������������������������������������������������������������������������������������������49
Summary������������������������������������������������������������������������������������������������������������50
References and Further Reading������������������������������������������������������������������������50

Chapter 3: Algorithm and Data Structure�������������������������������������������53


What Is an Algorithm�������������������������������������������������������������������������������������������53
Good and Not So Good Algorithm������������������������������������������������������������������������54
Time/Space Complexity���������������������������������������������������������������������������������54
Asymptotic Notation��������������������������������������������������������������������������������������55
Fundamental Data Structures and Algorithms����������������������������������������������������57
Store (Data Structure)������������������������������������������������������������������������������������57
Problem Solving Techniques�������������������������������������������������������������������������������66
Recursion������������������������������������������������������������������������������������������������������67
Divide and Conquer���������������������������������������������������������������������������������������68
Brute Force����������������������������������������������������������������������������������������������������70
Greedy Algorithms�����������������������������������������������������������������������������������������70
Class of Problems�����������������������������������������������������������������������������������������������71
NP-Complete and NP-Hard Problems������������������������������������������������������������71

vi
Table of Contents

Databases�����������������������������������������������������������������������������������������������������������72
Persistence and Volume��������������������������������������������������������������������������������72
Fundamental Requirements: ACID�����������������������������������������������������������������72
Brief History of Database System Evolution��������������������������������������������������74
Most Prominent Current Database Systems��������������������������������������������������74
Relational Data and SQL��������������������������������������������������������������������������������74
NoSQL������������������������������������������������������������������������������������������������������������77
Summary������������������������������������������������������������������������������������������������������������78
References and Further Reading������������������������������������������������������������������������78

Chapter 4: Operating System��������������������������������������������������������������81


What Is an Operating System������������������������������������������������������������������������������81
OS Categories������������������������������������������������������������������������������������������������84
Why We Need an OS��������������������������������������������������������������������������������������������85
Purpose of an OS�������������������������������������������������������������������������������������������87
Complex and Multiprocessor Systems����������������������������������������������������������88
Multitasking and Multifunction Software������������������������������������������������������88
Multiuser Systems�����������������������������������������������������������������������������������������89
Why Is It Important to Know About the OS?���������������������������������������������������90
Responsibilities of an OS������������������������������������������������������������������������������������92
Scheduling����������������������������������������������������������������������������������������������������������93
Program and Process Basics�������������������������������������������������������������������������94
Process States�����������������������������������������������������������������������������������������������94
Process Control Block (PCB)��������������������������������������������������������������������������95
Context Switching�����������������������������������������������������������������������������������������97
Scheduling�����������������������������������������������������������������������������������������������������98
Scheduling Criteria��������������������������������������������������������������������������������������100
Thread Concepts������������������������������������������������������������������������������������������101

vii
Table of Contents

Memory Management���������������������������������������������������������������������������������������102
Address Binding������������������������������������������������������������������������������������������103
Logical vs. Physical Address�����������������������������������������������������������������������105
Inter-process Communication���������������������������������������������������������������������107
I/O Management�����������������������������������������������������������������������������������������������109
I/O Subsystem���������������������������������������������������������������������������������������������110
Polled vs. Interrupt I/Os�������������������������������������������������������������������������������114
I/O and Performance�����������������������������������������������������������������������������������115
Synchronization Concepts���������������������������������������������������������������������������116
File Systems������������������������������������������������������������������������������������������������������122
File Concepts�����������������������������������������������������������������������������������������������123
Directory Namespace����������������������������������������������������������������������������������124
Access and Protection��������������������������������������������������������������������������������������126
Rings: User Mode and Kernel Mode������������������������������������������������������������126
Virtualization������������������������������������������������������������������������������������������������127
Protection����������������������������������������������������������������������������������������������������128
User Interface and Shell������������������������������������������������������������������������������������128
Some OS Specifics��������������������������������������������������������������������������������������������129
Summary����������������������������������������������������������������������������������������������������������130
References and Further Reading����������������������������������������������������������������������131

Chapter 5: Computer Networks and Distributed Systems����������������133


History and Evolution of Networks and the Internet�����������������������������������������133
Protocols: Stateful and Stateless����������������������������������������������������������������������139
Internet Protocol (IP): TCP and UDP�������������������������������������������������������������������139
Host, IP Address, MAC Address, Port, Socket�����������������������������������������������143
DNS and DHCP���������������������������������������������������������������������������������������������145
Proxy, Firewall, Routing�������������������������������������������������������������������������������147

viii
Table of Contents

Distributed Systems: Prominent Architectures�������������������������������������������������150


Client Server������������������������������������������������������������������������������������������������150
Peer to Peer�������������������������������������������������������������������������������������������������151
N-Tiered�������������������������������������������������������������������������������������������������������152
Distributed System Examples���������������������������������������������������������������������������153
FTP��������������������������������������������������������������������������������������������������������������153
The World Wide Web������������������������������������������������������������������������������������155
Case Study: Web Application�����������������������������������������������������������������������������158
System Architecture������������������������������������������������������������������������������������158
HTML, CSS, and JavaScript�������������������������������������������������������������������������159
Front End�����������������������������������������������������������������������������������������������������160
Back End�����������������������������������������������������������������������������������������������������162
Summary����������������������������������������������������������������������������������������������������������163
References and Further Reading����������������������������������������������������������������������164

Chapter 6: Computer Security����������������������������������������������������������165


Access Control��������������������������������������������������������������������������������������������������166
Confidentiality���������������������������������������������������������������������������������������������167
Integrity�������������������������������������������������������������������������������������������������������169
Availability���������������������������������������������������������������������������������������������������170
Symmetric Key Cryptography����������������������������������������������������������������������170
Asymmetric Key Cryptography��������������������������������������������������������������������171
Digital Signatures����������������������������������������������������������������������������������������172
Digital Certificates���������������������������������������������������������������������������������������172
Certificate Chains����������������������������������������������������������������������������������������173
Salts and Nonces�����������������������������������������������������������������������������������������173
Random Numbers����������������������������������������������������������������������������������������174
Security in Client Computing Systems��������������������������������������������������������175

ix
Table of Contents

Malware, the Bad Apples of Software����������������������������������������������������������175


Trusted Execution Environments and Virtual Machines�������������������������������181
Communication Security: Security of Data in Motion����������������������������������������185
Transport Layer Security�����������������������������������������������������������������������������186
Virtual Private Network��������������������������������������������������������������������������������188
IP Security���������������������������������������������������������������������������������������������������189
Writing Secure Programs: Where Do We Start?������������������������������������������������189
Summary����������������������������������������������������������������������������������������������������������192
References and Further Reading����������������������������������������������������������������������192

Chapter 7: Cloud Computing�������������������������������������������������������������195


Cloud Computing Models����������������������������������������������������������������������������������196
IaaS�������������������������������������������������������������������������������������������������������������197
PaaS������������������������������������������������������������������������������������������������������������198
Serverless����������������������������������������������������������������������������������������������������199
SaaS������������������������������������������������������������������������������������������������������������200
Comparison of Cloud Computing Models����������������������������������������������������200
Benefits of Cloud Computing����������������������������������������������������������������������������201
Cost�������������������������������������������������������������������������������������������������������������201
Scalability����������������������������������������������������������������������������������������������������202
Velocity��������������������������������������������������������������������������������������������������������203
Reliability and Availability����������������������������������������������������������������������������203
Productivity��������������������������������������������������������������������������������������������������203
Performance������������������������������������������������������������������������������������������������204
Ease of Use and Maintenance���������������������������������������������������������������������204
Cloud Deployment Configurations���������������������������������������������������������������������204
Private Cloud�����������������������������������������������������������������������������������������������205
Public Cloud�������������������������������������������������������������������������������������������������205

x
Table of Contents

Hybrid Cloud������������������������������������������������������������������������������������������������206
Ideal Cloud Deployment Configuration��������������������������������������������������������206
Cloud Configuration Interface/Mechanism��������������������������������������������������������207
Cloud Service Providers������������������������������������������������������������������������������������209
Considerations in Choosing a CSP���������������������������������������������������������������209
Motivation for Switching CSPs��������������������������������������������������������������������210
Considerations for Developing Portable and Interoperable Cloud Solutions�����212
Interoperability vs. Portability����������������������������������������������������������������������213
Containers, Docker, and Kubernetes������������������������������������������������������������216
The Way Forward����������������������������������������������������������������������������������������������221
Recommendations���������������������������������������������������������������������������������������222
Summary����������������������������������������������������������������������������������������������������������223
References and Further Reading����������������������������������������������������������������������223

Chapter 8: Machine Learning�����������������������������������������������������������225


Brief History of Machine Learning��������������������������������������������������������������������226
Artificial Intelligence, Machine Learning, and Deep Learning���������������������������228
Fundamental Tenets of Machine Learning��������������������������������������������������������229
Models���������������������������������������������������������������������������������������������������������230
Training��������������������������������������������������������������������������������������������������������231
Prediction (Inference)����������������������������������������������������������������������������������232
Categories of Machine learning������������������������������������������������������������������������232
Supervised Learning������������������������������������������������������������������������������������232
Unsupervised Learning��������������������������������������������������������������������������������234
Semi-supervised Learning��������������������������������������������������������������������������234
Reinforcement Learning������������������������������������������������������������������������������234
Machine Learning in Practice���������������������������������������������������������������������������235
Leading Machine Learning Frameworks�����������������������������������������������������235

xi
Table of Contents

Machine Learning and Cloud Computing����������������������������������������������������������236


The Way Forward����������������������������������������������������������������������������������������������237
Summary����������������������������������������������������������������������������������������������������������239
References��������������������������������������������������������������������������������������������������������240

Appendix A: Software Development Lifecycle����������������������������������241


P lanning������������������������������������������������������������������������������������������������������������242
Analysis�������������������������������������������������������������������������������������������������������������243
Architecture and Design�����������������������������������������������������������������������������������244
Implementation�������������������������������������������������������������������������������������������������244
Test�������������������������������������������������������������������������������������������������������������������245
Deploy���������������������������������������������������������������������������������������������������������������246
Maintenance�����������������������������������������������������������������������������������������������������247

Appendix B: Software Engineering Practices�����������������������������������249


Planning and Management Practices: Agile������������������������������������������������������249
Scrum����������������������������������������������������������������������������������������������������������249
Kanban��������������������������������������������������������������������������������������������������������251
Analysis and Design������������������������������������������������������������������������������������252
Scaling Agile Practices��������������������������������������������������������������������������������252
Documentation��������������������������������������������������������������������������������������������������253
Requirements, Design, and Architecture�����������������������������������������������������253
Comments and Code�����������������������������������������������������������������������������������254
User�������������������������������������������������������������������������������������������������������������254
Testing��������������������������������������������������������������������������������������������������������������254
Phases and Categories of Testing and Goals�����������������������������������������������255
Test-Driven Development����������������������������������������������������������������������������256

xii
Table of Contents

Developing for Debug����������������������������������������������������������������������������������������256


Asserts and Exceptions�������������������������������������������������������������������������������257
Logging and Tracing������������������������������������������������������������������������������������257
Source Control Management����������������������������������������������������������������������������258
Purpose and Mechanism�����������������������������������������������������������������������������258
Tools������������������������������������������������������������������������������������������������������������260
Build Optimizations and Tools���������������������������������������������������������������������������261
Purpose and Mechanism�����������������������������������������������������������������������������261
Tools������������������������������������������������������������������������������������������������������������262
Continuous Integration and Continuous Delivery����������������������������������������������264
Purpose and Mechanism�����������������������������������������������������������������������������264
Tools������������������������������������������������������������������������������������������������������������266

Appendix C: ACPI System States������������������������������������������������������269


Global and System States���������������������������������������������������������������������������������270
Device States����������������������������������������������������������������������������������������������������273
Processor States�����������������������������������������������������������������������������������������������274

Appendix D: System Boot Flow���������������������������������������������������������277

Index�������������������������������������������������������������������������������������������������281

xiii
About the Authors
Paul D. Crutcher is a senior principal
engineer at Intel Corporation, managing
the Platform Software Architecture team in
the Client Computing Group (CCG). Paul
has worked at Intel for more than 25 years
and has also worked at two smaller software
companies. Paul has a degree in computer
science, with expertise spanning software
development, architecture, integration, and
validation based on systems engineering
best practices in multiple areas. He holds
several patents and has multiple papers and
presentations to his credit.

Neeraj Kumar Singh is a principal engineer


at Intel with more than 15 years of system
software and platform design experience.
His areas of expertise are hardware/software
(HW/SW) codesign, system/platform
architecture, and system software design and
development. Neeraj is the lead author of
two other books, System on Chip Interfaces
for Low Power Design and Industrial System
Engineering for Drones: A Guide with Best
Practices for Designing, in addition to many
other papers and presentations.

xv
About the Authors

Peter Tiegs is a principal engineer at Intel


with around 20 years of software experience.
Inside Intel, he often consults on DevOps
topics such as build automation and source
code branching. Over the last decade, Peter
evangelized continuous integration and
delivery as well as agile practices at Intel.
Peter has written software at all levels of the
stack from embedded C code to Vue.js. His
programming language of choice is Python.

xvi
About the Contributors
Chockalingam Arumugam is a system
software architect with expertise in design,
development, and delivery of software
solutions that work across OSs. He holds a
master’s degree in software systems from
Birla Institute of Technology and a bachelor’s
degree in electronics and communications
from Anna University. He is a hands-on
technologist on OS-agnostic software
development and has over 12 years of
experience in the industry. In recent years, he has been specializing in
cloud-based telemetry solutions.
Through his career, he has worked on a broad set of domains,
including device drivers, firmware/platform services, desktop/universal
applications, web applications, and services. He specializes in the areas of
Platform Health Analytics, Windows crash decode, and thermal and power
management debug and has led multiple engagements in these areas.
These solutions are used extensively in the industry for client platform
validation and debug. He is currently based out of Bangalore, India, and
works at Intel Corporation.

xvii
About the Contributors

Prashant Dewan is a principal engineer at


Intel and is very passionate about computer
security. At Intel, he has worked on multiple
security technologies and has filed 100+
patents in the area of computer security. He
has a master’s and doctorate in computer
science from Arizona State University.

xviii
About the Technical Reviewer
Kenneth Knowlson is a senior principal
engineer in the Client Computing Group
(CCG) division at Intel. He leads a group
of principal engineers in the Analytics and
DevOps subgroup, within CCG, leading the
organization’s strategic and technical direction
in these dynamic areas. Prior to joining CCG,
Ken invented the processes and procedures
for “pre-silicon” (Pre-Si) software and system
development at Intel. The Pre-Si initiative is
focused on accelerating time to market by
shifting SW and FW development “left,” before
Si is available, enabling products to come to market much faster than they
would otherwise. Pre-Si uses technologies like Virtual Platform, FPGA, and
System-Level Emulation to approximate the final Si-based product. Ken
also has a long history at Intel creating and delivering consumer-connected
media products streaming media space.
Ken holds bachelor’s degrees in mathematics and physics from the
University of California Santa Cruz. Ken enjoys swimming and running
and also holds black belts in taekwondo and hapkido, although he no
longer practices.

xix
Acknowledgments
We would like to express gratitude to the people who helped us through
this book, some of them directly and many others indirectly. It’s impossible
to not risk missing someone, but we will attempt anyway.
First and foremost, we would like to sincerely thank our technical
reviewer, Ken Knowlson, for meticulous reviews; it helped the book
significantly. Thank you, Ken!
We would like to acknowledge Prashant Dewan for writing Chapter 6
and Chockalingam A. for his help on Chapter 4 of the book.
Thank you so much Rita Fernando, Susan McDermott, and all of the
Apress publishing team for the outstanding work, help, guidance, and
support; you have gone the extra mile to make the book what it is.
Above all, we thank our family and friends for their understanding and
support and for being continuous sources of encouragement.

xxi
Introduction
According to code.org, there are 500,000 open programming positions
available in the United States alone – compared to an annual crop of just
50,000 graduating computer science majors. The US Department of Labor
predicted there will be 1.4 million computer science jobs by 2020, however,
only enough people to fill roughly 30% of these jobs. To bridge the gap,
many people not formally trained in computer science are employed in
programming jobs. While they are able to start programming and coding
quickly, it often takes them time to acquire the necessary understanding
and gain the requisite skills to become an efficient computer engineer or
advanced developer.
The goal of the book is to provide the essential computer science
concepts and skills necessary to develop a sound understanding of the
field. It focuses on the foundational and fundamental concepts upon
which expertise in specific areas can be developed, including computer
architecture, programming language, algorithm and data structure,
operating systems, computer networks, distributed systems, security, and
more.
This is a must-read for computer programmers lacking formal
education in computer science. Secondarily, it is a refresher for all,
including people having formal education in computer science as well as
anyone looking to develop a general understanding of computer science
fundamentals.
Overall, we authors have attempted to make it as lucid as possible, so
people with limited or even no background in computer science can pick
up the book and go through the journey to develop a good understanding
of computer science. We’re excited to have you on board.

xxiii
CHAPTER 1

Fundamentals of a
Computer System
There are many resources online to get you started programming,
but if you don’t have training in computer science, there are certain
fundamental concepts that you may not have learned yet that will help
you avoid getting frustrated, such as choosing the wrong programming
language for the task at hand or feeling overwhelmed. We wrote this book
to help you understand computer science basics, whether you already
started programming or you are just getting started. We will touch on the
topics someone with a computer science degree learns above and beyond
the semantics and syntax of a programming language. In this first chapter,
we will cover a brief history and evolution of a computer system and the
fundamentals of how it operates. We will cover some low-level computer
architecture and programming concepts in this chapter, but subsequent
chapters will cover higher-level programming concepts that make it much
easier to program the computer.

von Neumann Architecture


You’ve probably heard stories about computers the size of an entire
room in the 1940s into the 1970s, built with thousands of vacuum tubes,
relays, resistors, capacitors, and other components. Using these various

© Paul D. Crutcher, Neeraj Kumar Singh, and Peter Tiegs 2021 1


P. D. Crutcher et al., Essential Computer Science,
https://doi.org/10.1007/978-1-4842-7107-0_1
Chapter 1 Fundamentals of a Computer System

components, scientists invented the concept of gates, buffers, and


flip-­flops, the standard building blocks of electronic circuits today. In the
1970s, Intel invented the first general-purpose microprocessor, called
the 8088, that IBM used to make the first PC that was small enough for
personal use. Despite the continuous advancements that have made it
possible to shrink the microprocessor, as you’ll see, the core elements of
today’s desktop or laptop computer are consistent with the first computers
designed in the 1940s!
In 1945, John von Neumann documented the primary elements of a
computer in the “First Draft of a Report on the EDVAC” based on the work
he was doing for the government. EDVAC stands for Electronic Discrete
Variable Automatic Computer, which was the successor to the Electronic
Numerical Integrator and Computer (ENIAC), the first general-purpose
computer developed during World War II to compute ballistic firing tables.
EDVAC was designed to do more general calculations than calculating
ballistic firing tables. As depicted in Figure 1-1, von Neumann described
five subdivisions of the system: central arithmetic and central control (C),
main memory (M), input (I), output (O), and recording medium (R). These
five components and how they interact is still the standard architecture of
most computers today.

Figure 1-1. Primary Architecture Elements of a Computer

2
Chapter 1 Fundamentals of a Computer System

In his paper, von Neumann called the central arithmetic and control
unit the central control organ and the combination of central control
and main memory as corresponding to associative neurons. Even today,
people refer to the central processing unit, or CPU, as the “brain” of the
computer. Don’t be fooled, though, because a computer based on this
architecture does exactly what it is programmed to do, nothing more and
nothing less. Most often the difficulties we encounter when programming
computers are due to the complex nature of how your code depends on
code written by other people (e.g., the operating system), combined with
your ability to understand the nuances of the programming language
you’re using. Despite what a lot of people might think, there’s no magic to
how a computer works, but it can be complicated!

CPU: Fetch, Decode, Execute, and Store


The CPU’s job is to fetch, decode, execute, and store the results of
instructions. There are many improvements that have been invented to
do it as efficiently as possible, but in the end, the CPU repeats this cycle
over and over until you tell it to stop or remove power. How this cycle
works is important to understand as it will help you debug multi-threaded
programs and code for multicore or multiprocessor systems.

Note Threads are a mechanism used to simulate executing a set of


instructions in parallel (at the same time), whereas multiple cores in
the same system actually do execute instructions in parallel.

The basic blocks of a CPU are shown in Figure 1-2. The CPU needs a
clock that sends an electric pulse at a regular interval, called a frequency.
The frequency of the clock dictates how fast the CPU can execute its
internal logic. The control unit drives the fetch, decode, execute, and store

3
Chapter 1 Fundamentals of a Computer System

function of the processor. The arithmetic and logic unit, or ALU, performs
math operations and digital logic operations like AND, OR, XOR, and so
on. The CPU has an internal memory unit for registers and one or more
high-speed memory caches to store data proactively pulled in from main
memory.

Figure 1-2. Basic Blocks Inside a CPU

Fetch
The CPU fetches instructions from memory using addresses. Consider
your home’s mailbox; it has an address and, if it’s anything like my
mailbox, contains junk mail and a letter from my mom, if I’m lucky. Like
the mail in your mailbox, instructions sit in memory at a specific address.
Your mailbox is probably not much bigger than a shoebox, so it has a limit
to how much mail the mail carrier can put into it. Computer memory
is similar in that each address location has a specific size. This is an
important concept to grasp because much of computer programming has

4
Chapter 1 Fundamentals of a Computer System

to do with data and instructions stored at an address in memory, the size


of the memory location, and so on.
When the CPU turns on, it starts executing instructions from a specific
location as specified by the default value of its instruction pointer. The
instruction pointer is a special memory location, called a register, that
stores the memory address of the next instruction.
Here’s a simple example of instructions in memory that add two
numbers together:

Address     Instruction     Human-Readable Instruction
200         B80A000000      MOV EAX,10
205         BB0A000000      MOV EBX,10
20A         01D8          ADD EAX,EBX

The first column is the address in memory where the instruction is


stored, the second column is the instruction itself, and the third column
is the human-readable version of the instruction. The address and
instruction numbers are in hexadecimal format. Hexadecimal is a base
16 number system, which means a digit can be 0—F, not just 0—9 as with
the decimal system. The address of the first instruction is 200, and the
instruction is “mov eax,10,” which means “move the number 10 into the
EAX register.” B8 represents “move something into EAX,” and 0A000000 is the
value. Hexadecimal digit A is a 10 in decimal, but you might wonder why
it’s in that particular position.
It turns out that CPUs work with ones and zeros, which we call
binary. The number 10 in binary is 1010. B8 is 10111000 in binary, so the
instruction B80A000000 in binary would be 1011 1000 0000 1010 0000
0000 0000 0000 0000 0000. Can you imagine having to read binary
numbers? Yikes!
In this binary format, a single digit is called a “bit.” A group of 8 bits is
called a “byte.” This means the maximum value of a byte would be 1111
1111, which is 255 in decimal and FF in hexadecimal. A word is 2 bytes,
which is 16 bits. In this example, the “MOV EAX” instruction uses a byte for

5
Chapter 1 Fundamentals of a Computer System

the instruction and then 4 words for the data. If you do the math, 4 words
is 8 bytes, which is 32 bits. But if you are specifying the number 10 (or 0A
in hexadecimal) to be moved into the EAX register, why is it 0A000000?
Wouldn’t that be 167,772,160 in decimal? It would, but it turns out
processors don’t expect numbers to be stored in memory that way.

bit          0 or 1
byte         8 bits
word         2 bytes = 16 bits
dword        2 words = 4 bytes = 32 bits

Most CPUs expect the lower byte of the word to be before the upper
byte of the word in memory. A human would write the number 10 as a
hexadecimal word like this: 000A. The first byte, 00, would be considered
the most significant byte; and the second byte, 0A, would be the least
significant. The first byte is more significant than the second byte because
it’s the larger part of the number. For example, in the hexadecimal
word 0102, the first byte 01 is the “most significant” byte. In this case, it
represents the number 256 (0100 in hexadecimal is 256). The second
02 byte represents the number 2, so the decimal value of the hexadecimal
word 0102 is 258. Now, let’s look at the “MOV EAX,10” instruction as a
stream of bytes in memory:

200:  B8    <- Instruction (MOV EAX)


201:  0A    <- Least significant byte of 1st word
202:  00    <- Most significant byte of 1st word
203:  00    <- Least significant byte of 2nd word
204:  00    <- Most significant byte of 2nd word
205:  ??    <- Start of next instruction

The instruction is a single byte, and then it expects 4 bytes for the data,
or 2 words, also called a “double word” (programmers use DWORD for
short). A double word, then, is 32 bits. If you are adding a hexadecimal
number that requires 32 bits, like 0D0C0B0A, it will be in this order in

6
Chapter 1 Fundamentals of a Computer System

memory: 0A0B0C0D. This is called “little-endian.” If the most significant


byte is first, it’s called “big-endian.” Most CPUs use “little-endian,” but
in some cases data may be written in “big-endian” byte order when sent
between devices, for instance, over a network, so it’s good to understand
the byte order you’re dealing with.
For this example, the CPU’s instruction pointer starts at address 200.
The CPU will fetch the instruction from address 200 and advance the
instruction pointer to the location of the next instruction, which in this
case is address 205.
The examples we’ve been studying so far have been using decimal,
binary, and hexadecimal number conventions. Sometimes it is hard to
tell what type of number is being used. For example, 10 in decimal is 2 in
binary and 16 in hexadecimal. We need to use a mechanism so that it is
easy to tell which number system is being used. The rest of this book will
use the following notation:

Decimal: No modifier. Example: 10

Hexadecimal: Starts with 0x or ends in h. Example:


0x10 or 10h

Binary: Ends in b. Example: 10b

Instruction Set Architecture


Instructions are defined per a specification, called instruction set
architecture, or ISA. There are two primary approaches to instruction set
architecture that have evolved over time: complex instruction sets and
reduced instruction sets. A system built with a complex instruction set is
called a complex instruction set computer, abbreviated as CISC. Conversely,
a system built with a reduced instruction set is referred to as a reduced
instruction set computer, abbreviated as RISC. A reduced instruction set is
an optimized set of instructions that the CPU can execute quickly, maybe in
a single cycle, and typically involves fewer memory accesses.

7
Chapter 1 Fundamentals of a Computer System

Complex instructions will do more work in a single instruction and


take as much time to execute as needed. These are used as guiding
principles when designing the instruction set, but they also have a
profound impact on the microarchitecture of the CPU. Microarchitecture
is how the instruction set is implemented. There are multiple
microarchitectures that support the same ISA, for example, both Intel and
AMD (Advanced Micro Devices) make processors that support the x86 ISA,
but they have a different implementation, or microarchitecture. Because
they implement the same ISA, the CPU can run the exact same programs
as they were compiled and assembled into binary format. If the ISA isn’t
the same, you have to recompile and assemble your program to use it on a
different CPU.

Note A compiler and an assembler are special programs that take


code written by humans and convert it into instructions for a CPU that
supports a specific instruction set architecture (ISA).

Whether it is complex or reduced, the instruction set will have


instructions for doing arithmetic, moving data between memory locations
(registers or main memory), controlling the flow of execution, and more.
We will use examples based on the x86 ISA to understand how the CPU
decodes and executes instructions in the following sections.

R
 egisters
CPUs have special memory locations called registers. Registers are used to
store values in the CPU that help it execute instructions without having to
refer back to main memory. The CPU will also store results of operations in
registers. This enables you to instruct the CPU to do calculations between
registers and avoid excess memory accesses. Table 1-1 is the original x86
ISA base register set.

8
Chapter 1 Fundamentals of a Computer System

Table 1-1. x86 Base Register Set


64 bits 32 bits 16 bits(8086)
(x86_64) (x86) 8 bits 8 bits
Accumulator RAX EAX AX
AH AL
Base register RBX EBX BX
BH BL
Counter RCX ECX CX
CH CL
Data RDX EDX DX
DH DL
Base pointer RBP EBP BP
BPL
Source index RSI ESI SI
SIL
Destination index RDI EDI DI
DIL
Stack pointer RSP ESP SP
SPL
General purpose R8-R15 R8D-R15D R8W-R15W
R8B-R15B

It’s important to understand how the registers are used by the CPU
for the given ISA. For example, the 32-bit counter, in this case ECX, will be
automatically decremented by the loop instruction. Another example is the
stack pointer where you can directly manipulate it, but it’s modified by many
other instructions (we will explore the concept of a stack later in this chapter).

9
Chapter 1 Fundamentals of a Computer System

The x86 register set has evolved over time and is meant to be backward
compatible with older versions of x86 CPUs. You can see the progression
from the original 16-bit processor to 32-bit and the now more common
64-bit memory address sizes. As the memory address size increased, so
did the register size, and new names were given to allow using the different
register sizes with the appropriate instructions. Even when in 64-bit mode,
the 32-bit register names enable programs written for 32 bits to run on
64-­bit machines.
A typical ISA will have multiple register sets. For example, x86 has a
floating-point register set and another register set for handling large data
sets. The popular ARM architecture also has multiple register sets. The
register set and the ISA go hand in hand!

Decode, Execute, and Store


Decoding is when the CPU interprets the instruction and transfers the data
needed to execute the instruction into the CPU to prepare to execute the
instruction.
Instructions are formatted in a particular way to enable efficient
decoding. The instruction format specifies the opcode (the operation to be
performed), the operands (the registers or data needed for the operation),
and the addressing mode. The number and order of the operands depends
on the instruction addressing mode as follows:
Register Direct: Both operands are registers:

ADD EAX, EAX

Register Indirect: Both operands are registers, but one contains the
address where the operand is stored in memory:

MOV ECX, [EBX]

10
Discovering Diverse Content Through
Random Scribd Documents
“Why do you say ‘suppose’?” asked Lord Southwick sharply.
“Well, if you want to know, because of certain fancies that have
come into my head. Now tell me, have you heard anything?”
“Yes, I have, and I was going to speak to you on the matter. Some
queer things have come to my knowledge lately. First of all, we have
found out that all that yarn with which Dick Learmer stuffed up my
late chief is nonsense, for that Egyptian sergeant, Abdullah, was
mortally wounded a few months ago, and before he died made a
confession that he had told lies, and that he ran away at the very
beginning of the fight between Ullershaw and those Arab rascals.
So, of course, he didn’t see him killed as he said he did.”
“Oh! But what yarn of Learmer’s do you mean?”
“Why, that Ullershaw had taken up with some pretty native woman
and was travelling with her. Learmer gave us to understand that he
had private confirmation of the fact, and, perhaps foolishly, we
believed him, and that’s what made my old chief so wild with your
cousin. Now it appears from Abdullah’s statement, which has just
been forwarded home, as they say out there, ‘to clear the shadow
that has fallen upon the reputation of a very gallant officer,’ all that
Ullershaw did was to give escort to two helpless females across the
desert, partly from charity and partly because he thought that their
presence would make his caravan look more like a trading
expedition.”
“I see,” said Lord Devene; but to himself he added: “Dick again!
What a cowardly, black-hearted scoundrel! Well, is there any more?”
“Yes. You may remember it was stated in Parliament that this
abortive expedition had cost the authorities about £2,000. Well,
within the last year, £2,000 have been paid into the Treasury from a
source that we cannot trace, accompanied by a rather involved
written message to this effect: ‘That the money was to be applied to
reimburse the costs incurred in the diplomatic mission to certain
chiefs on the borders of the Soudan, in the fitting out and providing
with funds of the expedition under the command of Lieutenant-
Colonel Rupert Ullershaw, C.B., by a person who desires to clear
away the reproach that had been laid upon him of having been the
cause of a waste of public money.’ Now did you, or his widow, do
this?”
“Most certainly not!” answered Lord Devene, with a touch of his
old sarcasm. “Are either of us people likely to repay to Government
money to which they have no legal claim? How did the cash come?”
“Through a bank that would only say that it had been received
from its branch in Egypt. Further, reports have reached us that the
Tama oasis, which no one has visited for generations, is now virtually
ruled by a white man who is said to have been a British officer,
although its real chief is a woman. This woman, who is called the
lady Mea, or after her territory, Tama simply, has recently put herself
in communication with the Egyptian Government, demanding to be
accorded its protection, and offering to pay taxes, etc. The style of
the letter made it certain that it was never written by an Arab woman,
so a political officer was sent to see into the matter. He got to the
oasis, and found that it is a perfect garden, and very rich, having of
late established an enormous trade in dates, salt, horses, etc., with
the surrounding tribes. Of the white man, however, he saw nothing,
his questions on the point being politely ignored. Still he did hear by
side winds that such a person exists. That is all I can tell you about
the thing, but it might be worth your while to follow it up. I hope you
will indeed, and still more, that Ullershaw may prove to be alive. In
my opinion, he has been a cruelly-treated man, and it is just possible
that a fellow of his character, knowing this and not caring to defend
himself, has chosen to remain lost.”
“Thank you, I will,” said Lord Devene, and going home he wrote a
note to Edith telling her to come to see him.
CHAPTER XX.
REVELATIONS
As it happened, Edith had just left London for a week to stay with
friends in Cornwall, and therefore could not obey Lord Devene’s
summons till after her return. When at length she did arrive, she was
shocked at the change in his appearance.
“You think that I look ill?” he said, reading her mind.
“Yes, I must say that I do, Cousin George,” she answered, as she
contemplated his snow-white hair, shrunken figure, and thin face
worn with sorrow and weariness.
“Well, you see, I am no longer young. Threescore and ten are the
full years of man, and I have just completed them. But that’s not the
worst of it; the old sleeplessness is back upon me with a vengeance.
I have scarcely closed my eyes for six nights. This last job, the loss
of my poor boy, has finished me, and now I don’t care how quickly I
follow him into the dark; the sooner the better, I think; yes, the
sooner the better.”
“Don’t say that,” said Edith gently. “I hope that you have a good
many years before you.”
“No, no, nor months, nor perhaps weeks,” he added slowly. “My
treadmill is nearly finished, the accursed wheel is going to stop. But,”
he went on swiftly, as though to prevent her answering him, “I have
sent for you to talk about your affairs, not mine. Why will you not
marry Dick Learmer?”
“Do you consider him a desirable man for a woman to marry,
Cousin George?”
“No, I don’t. He has gone all to bits of late, and he doesn’t exactly
give off an odour of sanctity, does he? In fact, if you ask me my
private opinion as his relative, who has had the honour of supporting
him more or less for many years, I should say that he was about as
big a blackguard as you could find in London, and I have always
wondered how you could care twopence about him.”
“And yet you suggest that I should marry him.”
“Well, you know he is going to be a rich man, and you might as
well have your share. But I understand that you won’t.”
“No,” said Edith decidedly, “I won’t. He did fascinate me rather
once, but I have got over that, and now I dislike him. It is curious how
we change in these matters—only I wish I had seen the truth earlier.”
“Yes, so do I. If you had, perhaps you would have gone to Egypt
when you thought fit to stay at home. Well, if you won’t commit
bigamy, which I admit is an awkward thing to do, why not make it up
with Rupert?”
Edith gasped and sank back in her chair.
“How do you—I mean, what do you know?” she exclaimed. “Has
Dick told you?”
“Ho!” said this wise old man, drawing his white eyebrows together,
“so Master Dick has a finger in this pie too, has he? He has not only
murdered Rupert; he has buried him also.”
“Murdered!”
“What else do you call it when he got him sent off to Egypt on his
wedding day upon a particularly dangerous mission, and when, on
the failure of that mission and his reported death, he even took the
opportunity to poison the minds of his chiefs and so blacken his
memory.”
“So he really did those things?” remarked Edith reflectively.
“Certainly; I will give you chapter and verse for it if you like. But
about Rupert.” He paused, and drew a bow at a venture. “What
happened when you saw him?”
“So Dick has told you,” she said. “Well, if he will lie about one
thing, he will lie about another. But why force me to repeat the
story?”
“Because I should like to hear it first-hand. What happened, and
when?”
“Over seven years ago,” answered Edith hoarsely, “Rupert came
back, on New Year’s Eve, a Sunday, after Dick had been to lunch.
He was dressed in horrible rough clothes, and his hair was long and
tangled like that of a wild man. His foot had been cut off, and his left
eye put out by those savages there in the Soudan. They tortured him
because he would not become a Mahommedan.”
“Ah!” said Lord Devene, “personally I think that the Mahommedan
religion has points, but—plucky fellow, Rupert; it might have
recommended him to some women. Well?”
“Well, he was horrible to me. As a friend I could scarcely have
borne him, but as a husband—oh! you know.”
“I think you said that Dick had been to luncheon, did you not?
Now, had he perhaps suggested himself as what on a Board of
Directors is called an alternative?”
“He had asked me to marry him,” replied Edith, dropping her head.
“With the usual concomitants, I suppose, and perhaps had not
been too roughly rebuffed. He was better-looking then, wasn’t he?
Well, under the circumstances, no doubt, a mere martyr in badly
fitting clothes, and without a foot, would have seemed horrible to any
refined young woman. Husbands often assume that appearance to
wives who chance to have followed their finer instincts, and fallen in
love with somebody else. But what became of our martyr? Is he now
preaching Christianity among the benighted Mahommedans?”
“You are cruel to me,” said Edith, with something like a sob.
“Then learn patience from the example of the martyr, who seems
to have suffered much without complaining, for conscience’ sake—
like you, dear Edith, and—answer the question.”
“I told him,” she said, in a low voice, “that as he was dead, he had
better remain dead. He went away; I don’t know what became of
him, or whether he is alive or not.”
“Then allow me to reassure your anxious heart upon that point. To
the best of my belief, unless I am very much mistaken, the admirable
Rupert is at present living in an oasis called Tama, somewhere in the
desert, not far from the Soudan; I don’t know the exact locality, but
doubtless it can easily be ascertained. Moreover, he has prospered
better than most martyrs do, for with characteristic folly, he has paid
back £2,000, which he did not owe, to the Government, in some
particularly stupid and roundabout fashion. By the way, you never
claimed his insurance, did you? No. Well, that’s lucky, for you might
have been prosecuted. To return—in this happy oasis, as I believe,
Rupert lives at ease, assisting its fair ruler to govern some primitive
community, who apparently grow dates and manufacture salt for his
and her benefit, for he seems to have relaxed his iron principles
sufficiently to allow himself to contract a morganatic marriage, of
which, under the circumstances, you will be the last to complain.”
“I don’t believe it,” said Edith, with some energy. “It’s not like
Rupert to break his word.”
“It would be like a born idiot if he didn’t. Why should you have a
monopoly in that respect?” Lord Devene answered, with withering
sarcasm. “But perhaps the best thing to do would be to go and find
out. Look here, Edith,” he said, dropping his bitter, bantering tone, “I
have never set up for virtue; I hate the name of it as it is commonly
used, but I must tell you that I think you an exceedingly wicked
woman. What business have you to treat the man whom you had
married in this way, just because you had been philandering with that
accursed Dick, and because he had lost his leg and his prospects of
a title? Well, his leg won’t grow again, but the title is sprouting finely.
Hadn’t you better make haste and secure it? Lady Devene sounds
better than Mrs. Ullershaw, relict of a forgotten colonel in the
Egyptian army. Also, perhaps you would be happier as the wife of an
honourable man than as the friend of Dick Learmer.”
“I’m not his friend,” replied Edith indignantly, “—now after what you
have told me, for it was base to try to blacken the reputation of a
dead man. Also, I don’t like him at all; his ways of life and even his
appearance disgust me.”
“I am glad to hear it,” said Lord Devene.
“As for your reproaches about poor Rupert,” she went on, “you find
it convenient to forget that it was you who forced me into that
marriage. I never pretended to be in love with him, although it is true
that now, when I am older, I see things in a different light, and have
more regard for him than ever I had before.”
“Now, when you have escaped from the blighting shadow of the
other man’s influence, you mean, Edith. But, whatever the reason,
better late than not at all. You blame me for having, by a gift of
£25,000, etc., ‘forced’ you into the marriage. Well, would you like to
know why I did so?”
“Yes; I should very much.”
“Then I see no reason why I should not tell you—now. It was
because you happen to be my daughter, Edith.”
She gasped again, then said: “Is that the truth, or one of your bad
jokes?”
“The truth. I would rather not enter on the subject with you, but you
can have your mother’s statement to read afterwards, if you like, and
I don’t know that the fact need distress you.”
“It distresses me very much,” answered Edith bitterly. “Hitherto I
always thought that my mother was honest, and that my father was a
good if a foolish man. Now those illusions have gone, like the rest,
and now, too, I understand where all that is bad in me came from,
and that my odd dislike of Rupert was inherited—for I have heard
that story from Dick.”
Even the hardened Lord Devene winced a little beneath these
bitter shafts.
“It would seem, my dear Edith,” he said, “that your powers of
offensive speech are at least your own, since mine, which some
people think considerable, are put to the blush by them.”
“I pay you back in your own coin, that is all. For an hour you have
sat there mocking and insulting me, tearing me to pieces and
stamping on me, ending up with the information that I am—what I
am. Do you wonder, then, that I retaliate? Cousin—I beg your
pardon, but how do you wish me to address you in future? Well,” she
went on, without waiting for an answer, “I am glad that Rupert knew
nothing about it, for at any rate, as I think you once said, he was the
only respectable man in the family, and he might have felt aggrieved
under all the circumstances.”
“It is highly probable that he did. Do you remember a letter which
the footman gave to him at the train when he was starting for Egypt
after your marriage? Yes? Well, that letter informed him of our exact
relationship, leaving it optional with him to pass on the facts to you,
or not, as he liked.”
“He never said a word,” exclaimed Edith. “No, not even in that
scene when we parted, and he might so easily have used what he
knew to hurt me. Oh! he is different to us all—he is different.”
“Quite so, and that is why I wished you to marry him. Also, then as
now he was going to get the title and the property, and, unnatural
creature though you think me to be, I had, as it happened, a wish
that you should share those temporalities. Indeed I have it still, and
that is why I desire and implore that you should make it up with
Rupert if he is still living. Listen, Edith!” he went on earnestly, “you
are still a beautiful and admired woman, but you are now well past
your youth, and soon the admirers will fall away and you haven’t
many real friends, and can’t marry anyone else to protect and look
after you. So I suggest that for your own sake you should take refuge
with a husband in whom you yourself admit that there is much to
esteem. Edith, my days are almost done; it is very probable that I
shall have no further opportunity of talking to you upon this or any
other subject. I urge you therefore as one who, being responsible for
your presence in the world, has your welfare most earnestly at heart,
to promise me that you will make inquiries, and if you find that
Rupert is living, as I believe, that you will go to him, for he will
certainly not come to you, and ask his pardon for the past. Will you
do it?”
“I—think so,” she answered slowly, “and yet, after all that has been
—oh! how can I? And how will he receive me?”
“I am not sure,” answered Lord Devene. “Were I in his place, I
know how I should receive you,” he added, with a grim little laugh,
“but Rupert is a forbearing creature. The trouble is that he may have
formed other ties. All I can suggest is that you should be patient and
try to work upon his feelings and sense of duty. Now I have said all I
can, and shall say no more who have other things to think of. You
have made your own bed, Edith, and if you can’t re-make it, you
must lie on it as it is, that’s all. Good-bye.”
She rose and held out her hand.
“Before you go,” he said, with a nervous little clearing of the throat,
—“it seems weak I know, but I should like to hear you say that you
forgive me, not about the Rupert business, for there I am sure I did
the best I could for you, but for bringing you into this world at all. So
far, I admit, whoever’s the fault may be, you do not seem to have
made a great success of it, any more than I have. As you know, I am
troubled by no form of the common superstitions of our age, holding
as I do that we are the purest accidents, born like gnats from the life-
creating influences of sun and air and moisture, developed out of
matter and passing back into matter, to live again as matter, whereof
our intellect is but a manifestation, and no more. Still I cannot help
acknowledging, after many years of observation, that there does
seem to be some kind of fate which influences the affairs of men,
and at times brings retribution on them for their follies and mistakes.
If that is so, Edith, it is this fate which you should blame,” and the old
man looked at her almost appealingly.
“No,” she answered, in a cold voice. “Once I remember, when I did
not know that you were my father, I told you that I loved you—I
suppose that the kinship of our blood prompted me. Now when I
know how close that kinship is, and in what way it came about, by
the disgrace of my mother during the life-time of her husband, I love
you no more. It is not the fate that I blame, but you, you—its
instrument, who were free to choose the better part.”
“So be it,” replied Lord Devene quietly. “Apply those words to your
own life, Edith, and by them let it be judged as you have judged me.”
Then they parted.

Edith kept her promise. Going to a great lawyer, famous for his
investigations of difficult matters, she told him merely that rumours
had reached her to the effect that her husband, who for many years
had been supposed to be dead, was in reality alive in the Soudan, or
in its bordering desert, and suggested that he should put himself in
communication with Lord Southwick and the Egyptian authorities
with the object of ascertaining the truth, and if necessary send
someone out to Egypt. The lawyer made notes, said that the matter
should be followed up, and that he would keep her advised as to the
results of his inquiries. Thereupon Edith, who, after their last bitter
and tragic interview, did not wish to see anything more at present of
the man whom she must believe to be her father, left town, as indeed
it was her custom to do during the month of August, and went away
to Scotland. When she had been there nearly six weeks, she
received one morning a telegram from Lady Devene, which was
dated from Grosvenor Square and read:

Come here at once. Your Cousin George is no more. I


want your help.

Shocked by this news she managed to catch the midday train to


London. At Rugby she saw the placard of an evening paper. On it,
among other news’ headings, was printed: “Sad death of a well-
known peer.” She bought the paper, and after some search found a
short paragraph which said:

“We regret to announce that Lord Devene was found


dead in bed at his house in Grosvenor Square this
morning. The cause of his death is not yet known.”
Then followed some biographical details and these
words: “As Lord Devene lost his only son some months
ago, it is believed that the peerage becomes extinct.
The settled property, however, passes to his cousin,
Richard Learmer, Esq., M.P.”

From the station Edith drove direct to Grosvenor Square and was
received by Tabitha in the drawing-room. There she sat in her black
dress, sad-faced, calm, imposing, like an incarnation, Edith thought,
of that fate whereof her father had spoken to her at their last
interview. They embraced each other without warmth, for at heart
these two women were not friends.
“How did it happen?” asked Edith.
“He died as her first ladyship died,” answered the widow, “by an
overdose of chloral. You know he could never sleep.”
“How did he come to take an overdose?” asked Edith again.
“I do not know,” she answered meaningly; “perhaps the doctors
they can tell you. Would you like to see him?”
“No,” said Edith, with a shudder; “I had rather not.”
“Ach!” said Lady Devene, “I forgot; you did always run away from
the sick and fear the dead; it is your nature.”
“Are you sorry?” said Edith curiously, perhaps to change the
conversation.
“Yes; for his soul which goes to its reward I am sorry, for he did not
repent before he died, who had many things of which he should
repent. For myself I am not sorry, for I have done my duty by him,
and now at last the chains do fall off my neck and God has set me
free to give me time to make my peace with Him before I die also.”
Then saying that she must get some food, Edith left her, for she
did not wish to pursue this painful conversation.
If the doctors of whom Lady Devene had spoken suspected
anything unusual, they were singularly reticent upon the point. All
they could or would say was that Lord Devene, who for many years
had been in the habit of taking chloral to combat his constitutional
sleeplessness, had on this particular night taken too much. So the
usual verdict was returned: “Death from misadventure, the cause
being an overdose of chloral,” and many comments were made on
the curious fact that Lord Devene and his first wife should have
come to a precisely similar end.
The will, which had been executed after the death of the little boy,
was found to be very short. It made no mention of the entailed
property, leaving the next heir to establish his claim, and after stating
that the testator’s wife was provided for by settlement, appointed
Edith Ullershaw residuary legatee without restrictions. This sounded
simple enough, but when matters came to be looked into it was
found that Edith took real and personal estate to the value of
£200,000. Subject to the life-interest of the widow, even the house in
Grosvenor Square was hers, so she was now a rich woman.
“Ach! my dear Edith,” said Lady Devene, when she learned that
she had a right to continue to live in the great mansion, “take it, take
it at once. I hate the place. Two thousand pounds a year, that is
plenty for me—£500 to live on, and £1,500 to give away. Yes, at last
the poor shall get some of all those monies which have been
collected out of their toil and their drink-vices.”
Needless to say, the exultant Dick swooped upon the settled
property like a famished hawk, demanding to be declared its rightful
possessor. But then arose a most unpleasant hitch, for just at this
time there came a letter to Edith from her lawyers, announcing that
they had received telegraphic advices from the agent whom they had
despatched to Egypt, informing them that it appeared to be almost
certain that the white man who was living in the oasis Tama was
none other than that Colonel Rupert Ullershaw who was supposed to
have been killed many years before. The lawyers added that, on
their own responsibility, and on behalf of her husband, whom they
believed to be alive and the present Lord Devene, they had made
representations in the proper quarter, as a result of which no one
would be allowed to touch the settled property until the matter was
thoroughly investigated.
Of course all this strange story soon found its way into the
newspapers, and many were the rapturous congratulations which
Edith received, even from persons with whom she had the very
smallest acquaintance. Meanwhile the lawyers had again been in
communication with their agent, who was established at Wady-Halfa.
A second telegram was received from this capable and enterprising
person, announcing that with great difficulty he had succeeded in
reaching the oasis, and in sending a message to Colonel Ullershaw,
informing him of his accession to the title, adding, however, that all
his lordship had replied was, that he did not want the title, and
refused to leave the place.
“It would appear,” went on their letter to Edith, covering this cable,
“that his lordship has suffered somewhat mentally from long
confinement among these savages, who, we are informed, have cut
off his foot to prevent his escaping, as they regard him as a god who
has brought them great prosperity which would vanish if he left them.
We presume, therefore, that your ladyship will proceed to Egypt as
soon as possible and use your personal influence to withdraw him
from his unhappy situation. We are informed that the people of the
oasis are peaceable, but, if necessary, that the authorities will give
you any assistance which may be required.”
Now the whole thing was out, and became a subject of general
conversation at a hundred dinner tables. Moreover, it was rumoured
that some years before Rupert Ullershaw had actually been seen in
London. General Sir Alfred Alltalk declared that he had met him upon
the steps of the Army and Navy Club, and a further ill-natured tale
was whispered that he had come to see his wife, who would have
nothing to do with him, because at that time he had ceased to be
heir to the peerage. This story, which Edith was not wrong in
ascribing to the indiscreet or malicious utterances of Dick, who was
furious with disappointment and thirsting for revenge, soon reached
her ears. Of course she contradicted it, but equally of course she
had now no alternative but to go to Egypt.
“Ach!” said the Dowager Lady Devene, when Edith expatiated to
her upon the hardship and dangers of the journey which she must
undertake alone—“ach! if that is all, I will come with you as a
companion. I am not afraid, and I have always wished to see the
land where Pharaoh oppressed the Israelites. We will start next
week, and in a month I hope to see my dear Rupert again—almost
as much as you do,” she added, looking at Edith sideways.
Now as this speech was made before several other people, Edith
had no choice but to acquiesce, and indeed it had come to this—she
also wished to see Rupert. Even in her somewhat flinty heart
remorse had been at work of late years; also, she had wearied of her
lonely life, and wished to put a stop to the scandals that were floating
about concerning her, which, as she foresaw, would soon culminate
in her being exposed to much annoyance from Dick. In fact, he was
already threatening to blackmail her and making unpleasant remarks
as to certain indiscreet letters that she had written to him after
Rupert’s visit to London, in which that visit and other matters
showing the extreme intimacy which existed between them were
alluded to not too obscurely. So she arranged to depart for the East,
accompanied by Lady Devene.
Before they sailed, she received a packet from the late Lord
Devene’s bankers, which, they stated by the mouth of a confidential
clerk, they had been directed to deliver to her one month after his
death, and not before. On opening it she found that it contained that
statement concerning herself made by her mother, to which Lord
Devene had alluded. Also, there were two letters from him, one
addressed to her and the other to Rupert, the latter being left open
that she might read it.
That to herself was brief, and ran:

I have given you all I can. Accept this wealth as a


make-weight to the initial wrong I did to you by
becoming your father. I was weak enough to hope that
when I revealed that fact to you, you would show some
affection towards a lonely and broken-hearted man.
You, however, took another view, irritated perhaps by
our previous somewhat acrimonious conversation. I
grieve to say that on such argumentative occasions I
have never been quite able to master my tongue, and
as you remarked, you seem to have inherited the
weakness. At least I have not cared to expose myself
to a second rebuff. I do not blame you, but it is true
that from that day forward I made up my mind to end
an existence which has become hateful to me. If its
dregs could have been sweetened by the love of one
who is, after all, my child, I should probably have been
content to endure its physical and mental miseries
whilst awaiting their natural termination. But it has
been destined otherwise, so like some of those old
Romans whom I so much admire, my day done, I go
from this hated scene out into the utter darkness
whence I came. Good-bye! May you be happier than
your father,
D.

It was a horrible letter for a daughter to receive from the author of


her being, but fortunately it did not affect Edith so much as would
have been the case with many women. She felt that there was a
certain injustice about the thing. To begin with, her father had taken
her at her word after the incomprehensible male habit. Then she had
spoken when utterly irritated, first by his bitter gibes and sarcasms,
and secondly by being suddenly informed that she was quite another
person than she had supposed herself to be for over thirty years.
Still, now when it was too late, she felt grieved. It was generally
Edith’s lot to be grieved—too late. Yes, she was grieved, no more,
when others might have been paralysed with horror and unavailing
remorse.
Afterwards, she took out of its envelope and read the letter to
Rupert. Here it is:

DEAR DEVENE,—For I give you the name which will


be yours when you read this, if you should ever do so.

I have learned all your story, or if not all of it, at least


enough to show me how accurate was the estimate
which I formed of you long ago. Had not fortune fought
against you, you would have been a great man, if such
a creature really exists, which I doubt, since in nine
hundred and ninety-nine cases out of a thousand,
‘great’ is only a popular translation of the vulgar word
‘successful.’

I write now to express the sincere hope that if, as I


believe, you are still living, you and Edith, forgetting
your previous diversities, and many another trouble
and sorrow, will agree to live together in the
accustomed, time-hallowed fashion, and if possible
leave children behind you to carry on the race. Not that
it is worth carrying on, except, perhaps, for certain
qualities of your own, but one must make sacrifices
upon the altars of habit and sentiment. For what other
possible reason can the populations of the earth be
continued? Yet there is one—Nature—(perhaps in the
wilderness you have found out what that word means)
—commands what the good sense of her most
cultivated children condemns as entirely useless and
undesirable. Perhaps there is some ultimate object in
this, though personally I can see none. To me it
appears to be nothing more than a part of the blind
brutality of things which decrees the continuance, at
any rate for a little while, of the highly nervous,
overbred and unsatisfactory animal called Man. Well,
soon or late he will die of his own sufferings, that
increase daily as he advances in the scale of
progressive degeneracy, which he dignifies by the
name of civilisation. Then perhaps Nature (God is your
name for it) will enjoy a good laugh over the whole
affair, but as human tears will have ceased to fall, what
will that matter?

Edith will tell you of the fashion of my end; how, worn


out at length by grief—one of the worst gifts of the said
civilisation, for the savage feels little—and bodily
weakness—the worst gift of our primeval state, I have
determined to put an end to both, though this is a fact
which there is no need for you to blazon abroad.

I can see you solemnly lifting your eyes and saying:


‘Lo! a judgment. What the man drove that unfortunate
woman to has fallen back upon his own head. (Under
the circumstances “unfortunate” is the exact word that
you will use, tempered by a romantic sigh, whereas, in
fact, poor Clara was but a very ordinary and middle-
class kind of sinner, who did not even shrink from the
ruin of the boy whom she pretended to love.) How
wonderful is the retribution of Providence! The same
death, the same means of death!’
Well, you will be quite wrong. Whether one suffers from
sleeplessness or from the fear of intolerable exposure
does not matter. One takes the most convenient
method to end it, and in this case they happen to be
identical. There is no Providence, no poetic justice
about the business, nothing but what novelists, or
rather their critics, call the ‘long arm of coincidence.’

Good-bye! I wonder what you have been doing all


these years in the Soudan. I should like to hear the
story from you; I am sure that it must be interesting.
But I am quite convinced that I shall never have the
chance. Nothing is absolutely certain except the
absolute nothingness that awaits us all.—Believe me,
my dear Devene, yours more sincerely than you may
think,

Devene.

“What an odd letter,” thought Edith, as she returned the sheets to


their envelope. “I don’t quite understand all of it, but I think that under
other circumstances my father might have been a very different man.
I wonder if we are quite responsible for what we do, or if the
circumstances are responsible? If so, who makes the
circumstances?”
CHAPTER XXI.
ZAHED
Rupert was disturbed in his mind. No one was less superstitious.
He had advanced spiritually beyond the reach of superstition. He
had grasped the great fact still not understood by the vast majority of
human beings, that the universe and their connection with it is a
mighty mystery whereof nine hundred and ninety-nine parts out of a
thousand are still veiled to men. These are apt to believe, as Lord
Devene believed, that this thousandth part which they see bathed in
the vivid, daily sunlight is all that there is to see. They imagine that
because only one tiny angle of the great jewel catches and reflects
the light, the rest must be dark and valueless. They look upon the
point of rock showing above the ocean and forget that in its secret
depths lies hid a mountain range, an island, a continent, a world,
perhaps, whereof this topmost peak alone appears.
With Rupert, to whom such reflections were familiar, it was not so.
Yet perhaps, because he remembered that every outward
manifestation, however trivial, doubtless has its root in some hidden
reason, and that probably the thing we call coincidence does not in
truth exist, it did trouble and even alarm him when, riding one
morning with Mea down a deep cleft in Tama, he heard upon the cliff,
to the right of them, the wild and piercing music of the Wandering
Players. Looking up, he saw upon the edge of that cliff those strange
musicians, swathed as before in such a fashion that their faces were
invisible, three of them blowing on their pipes and two keeping time
with the drums, for the benefit, apparently, of the birds of the air and
the beasts of the earth, since no biped was near to them.
He hailed them angrily from the valley, but they took not the
slightest notice, only blew more weirdly and beat the louder. He tried
to get up to them, but discovered that in order to do so he must ride
round for five miles. This he accomplished at last, only to find that
they were gone, having probably slipped down the slope of the
mountain away into their home, the desert. Indeed, it was reported to
him afterwards that some people, accompanied by two donkeys, had
been seen in the distance tramping across the sand.
“Why are you so vexed, Rupert?” asked Mea, when they
descended the cliffs again, after their fruitless search.
“I don’t know,” he answered, with a laugh, “but that music is
associated with disagreeable recollections in my mind. The first time
we heard it, you remember, was just before I lost my foot and eye,
and the next time was as I embarked upon the ship on my way to
England, an unhappy journey. What have they come for now, I
wonder?”
“I don’t know,” she answered, with her sweet smile; “but I at least
have no cause to fear them. After their first visit I saved you; after
their second you came back to me.”
“And after their third—?” asked Rupert.
“After their third I have said, I do not know; but perhaps it means
that we shall take a long journey together.”
“If that’s all, I don’t care,” he replied. “What I dread is our taking
journeys away from each other.”
“I thank you,” she answered, bowing to him gravely, “your words
are pleasant to me, and I bless those musicians who made you
speak them, as I am sure that our roads branch no more.”
So, still smiling at each other like two happy children, they rode on.
They visited the salt works which Rupert had established to the
enormous benefit of everyone in the oasis.
Passing through groves of young date-palms that he had planted,
they came to the breeding grounds of camels, mules, and horses,
the last of which had attained a great reputation, and having
inspected the studs, turned back through the irrigated lands that now
each year produced two crops instead of one.
“You have done well for us, Rupert,” said Mea, as they headed
homewards. “Tama has not been so wealthy since the days of my
forefathers, who called themselves kings, and now that the Khalifa is
broken and the land has become safe, this is but a beginning of
riches.”
“I don’t know about that,” he answered, with his jolly laugh, “but I
have done very well for myself. Do you know that out of my
percentage I have saved more money than I can spend? Now I am
going to build a hospital and hire a skilled man to attend to it, for I am
tired of playing doctor.”
“Yes,” she answered, “I have thought of it before, only I said
nothing because it means bringing white folk into the place, and we
are so happy without them. Also, our people do not like strangers.”
“I understand,” he answered, “but the Europeans have discovered
us already. It is impossible to keep them out now that we pay taxes
to the Government. You remember that man a few months ago who
came to tell me that I am Lord Devene, and that since I became so
my wife is making inquiries about me. I would not see him, and you
sent him away, but he, or others, will be back again soon.”
“And then will you wish to leave with him, Rupert, and take your
own place in the West?” she asked anxiously.
“Not I,” he answered, “not if they offered to make me a king.”
“Well, why should you?” Mea said, with her sweet little laugh, “who
are already a king here,” and she touched her breast; “and there,”
and she nodded towards some people who bowed themselves
before him; “and everywhere,” and she waved her hand at the oasis
of Tama in general.
“Well,” he answered, “the first is the only crown I want.” Then,
having no more words to say, this strange pair, divorced for the
kingdom of Heaven’s sake, yet wedded indeed, if ever man and
woman have been, for truly their very souls were one, looked at each
other tenderly. They had changed somewhat since we saw them last
over seven years before. Their strange life had left its seal upon
them both. Mea’s face was thinner, the rich, full lips had a little wistful
droop; the great, pleading eyes had grown spiritual, as though with
continual looking over the edge of the world; the air of mystery which

You might also like