Chapters_10_14x - SIUE Computer Science
Download
Report
Transcript Chapters_10_14x - SIUE Computer Science
Chapter 10: Operating Systems
An operating system is a set of programs through which
a computer manages its resources.
Its main functions are to:
1) Manage the computer hardware
• CPU performance & utilization
• Memory allocation & protection
• Input-output management
• Keyboard control
• Mouse device driver
• Printer spooling
• Display monitor
Applications
I/O Management
Device Drivers
Memory Management
CPU Scheduling
Hardware
Chapter 10
Operating
Systems
Page 110
2) Support application software
Word processors
Electronic spreadsheets
Database management
Computer graphics & games
Chapter 10
Operating
Systems
Page 111
3) Establish a user interface
Textual, with a commandline prompt
Graphical, with windows, menus,
and icons
Chapter 10
Operating
Systems
Page 112
Different Approaches to Processing
Batch Processing
Time-Sharing
Non-interactive execution of one or more
programs with distinct input and output
sessions
Multiple programs executing “simultaneously”
(via time slices) on a single computer (either many
users on a server or one user “multitasking”)
RAM
Process
Process
Process
PCB
PCB
PCB
CPU
Interactive Processing
Multiprocessing
Execution of a program with
additional input from the user and
output to the user during execution
Multiple CPUs available within the computer
system, either across a network or within a
single machine (e.g., a supercomputer)
Chapter 10
Operating
Systems
Page 113
Memory Management
The operating system must coordinate the use of main
memory for any active program on the computer.
When the
program is
compiled, fake
“virtual”
addresses are
used as
placeholders for
the memory
addresses of data
(i.e., variables)
and instructions
(i.e., functions,
loops, and
conditionals).
When the
program is
loaded into RAM,
the virtual
“logical”
addresses are
mapped to actual
“physical”
addresses where
the various parts
of the program
are really stored.
Chapter 10
Operating
Systems
Page 114
Paging
Since multiple programs might be active simultaneously and since
RAM has a limited capacity, large segments of one program’s
memory might be relegated to a backup device to make room for
another program’s memory needs.
Program A’s
Virtual Space
RAM
6
1
4
1
4
4
5
2
7
1
1
3
2
1
1
2
1
2
3
1
3
6
3
7
3
5
1
24
4
6
4
2
2
3
3
3
8
5
2
4
1
2
3
4
Program B’s
Virtual Space
1
2
3
Backup Storage (Disk)
In this example,
when program B is
activated, space in
RAM is made
available by first
“paging out” part
of program A...
...and then “paging
in” program B.
Chapter 10
Operating
Systems
Page 115
CPU Management
Every process executed by the CPU is managed by the
operating system.
New Process
(In a file on
the hard
drive, it
needs to be
loaded into
RAM)
OS “admits”
process by
loading into
RAM
Conceptually, the operating system
moves the process from state to state
in its journey through CPU execution.
Ready
Process
(Loaded into
RAM, it will
run when
allotted CPU
time)
OS “dispatches”
process by allotting
CPU time
OS “interrupts”
process to give another
process CPU time
OS moves process
to ready state when
it’s ready to resume
Waiting
Process
(Needs I/O or
some event
in memory,
temporarily
can’t run)
Running
Process
(In RAM,
with CPU
processing
its
instructions)
OS moves process
to waiting state
when it starts idling
Terminated
Process
(Finished
executing,
its memory
must be
marked
“free”)
OS starts cleaning
up after the process
has completed
CPU Scheduling
When multiple processes are vying for the CPU’s
attention, the operating system must schedule them.
Common Scheduling Options:
Process 1
Process 2
Process
1.1
Process 2
Process 3
Process 1
Process
2.1
Process
3.1
Process 4
Process 4
Process
4.1
Process
1.2
Process 3
Process
2.2
Process
3.2
First-Come First-Served (FCFS)
Disadvantage: Smaller jobs may
have to wait an inordinate
amount of time.
Shortest Job First (SJF)
Disadvantage: Large jobs must
wait until everything else is
finished before starting.
Process
4.2
Process
1.3
Process
3.3
Round Robin
Disadvantage: Processes constantly interrupted when time slices expire.
Process
4.3
Process
3.4
Resource Allocation Problems
Mutual Exclusion
If two processes require access to the same nonshareable resource at the same time,
then both cannot be accommodated.
Example: Producer & Consumer
Waiting
Producer
Full Queue
Consumer
When extreme cases occur
(either there are no
resources available to be
consumed, or no room for
more to be produced), a
“semaphore” is set to signal
that someone must wait.
Producer
Waiting
Empty Queue
Consumer
Deadlock
If two processes are simultaneously blocking each other’s
progress, then neither one may be able to proceed.
One process copies from the flash to the DVD
One process copies from the DVD to the flash
Chapter 10
Operating
Systems
Page 118
Chapter 11: File Systems and Directories
Data is stored on magnetic and optical disks in files,
named collections which are, in turn, grouped together
into directories.
To distinguish the
types of data being
stored in different
files, the names of
files are suffixed
with an identifying
file extension.
Chapter 11
File Systems and
Directories
Page 119
File Access
There are two major ways in which files are organized
and accessed.
Sequential Access
Direct Access
The records in the file are organized as
a list and are retrieved and processed
one at a time from the beginning to
the end of the file.
The records in the file are arranged
so an individual record may be
retrieved without examining other
records in the file.
Chapter 11
File Systems and
Directories
Page 120
Sequential File Access
With sequential access, records are retrieved by starting
at the beginning of the file and extracting them in the
order in which they exist within the file.
An example of this is the
common input file (cin) in
C++, which uses the input
operator (>>) to access the
next available piece of
keyboard-generated data.
Advantages
• Easy to program
• Allows simple file structures
• Well suited to many common
programming applications
(pattern searches, small files,
rarely processed files)
Disadvantage
• Poor access performance
Chapter 11
File Systems and
Directories
Page 121
Indexed Files
To implement direct access in file organization, an
indexed directory is often stored in memory.
This directory is basically a table consisting of some aspect of
each record (called a key) and the corresponding record’s
location within the file.
Name
Sector
Track
SSN
Sector
Track
Adams
5
68
402231161
5
43
Bosley
4
27
627880013
3
71
Carter
5
43
759307562
4
11
Chapter 11
File Systems and
Directories
Page 122
Hashed Files
To provide direct access to the records in a file without
the overhead of an indexed directory, hashing is a
viable alternative.
With hashing, one of the record’s
key fields is used to map the
record to a particular section (or
“bucket”) in the memory device.
If the hashing function is
strategically chosen, then the
buckets will be relatively balanced
and efficiency will be enhanced.
Fairly Good Hashing Function:
Last digit of SID
0
2
1
2
2
2
3
2
4
3
5
2
6
2
7
3
8
2
9
6
Chapter 11
File Systems and
Directories
Page 123
Directories
To organize files within a computer system,
hierarchical directories are usually implemented.
This traditional
approach to file
organization is
known as the
“folder metaphor”
since it is analogous
to the organization
of paper file
folders.
Chapter 11
File Systems and
Directories
Page 124
Disk Scheduling
Accessing secondary memory is
one of the most time-consuming
aspects of processing, so a
primary goal is to ensure that
such access is handled as
efficiently as possible.
The most common approach is to have the read-write heads
move towards the shaft, reading all requested sectors of all
requested tracks as each successive cylinder is reached.
Once the shaft is reached, the read-write heads move away from
the shaft, reading all requested sector/track combinations until
the outer platter edge is reached, whereupon the entire process
is repeated.
Chapter 11
File Systems and
Directories
Page 125
Chapter 12: Information Systems
Information systems are software
applications that facilitate the
organization and analysis of data.
Example: Spreadsheet software allows
users to place raw data in tables and
then utilize formulas and basic
graphical mechanisms to generate
calculations and illustrations from it.
Chapter 12
Information
Systems
Page 126
Database Structures
An alternative to a distributed information system based
upon files is a centralized system based upon the concept
of databases.
File-Oriented
System
Rental
Dept.
Sales
Dept.
Purchasing
Dept.
Marketing Dept.
Database-Oriented
System
Maintenance
Dept.
Payroll
Dept.
Sales
Dept.
Purchasing
Dept.
Rental
Dept.
Video
Rental
Files
Video
Sales
Files
Video
Purchase
Files
Advertisement
Files
Store
Upkeep
Files
Store
Personnel
Files
DISADVANTAGES OF EACH SYSTEM
File-Oriented
Database-Oriented
Duplication of effort
Data security problems
Multiple error sources
Widespread error effects
Integrated
Database
Payroll
Dept.
Maintenance
Dept.
Marketing Dept.
Chapter 12
Information
Systems
Page 127
A Modular View of a Database System
APPLICATION
SOFTWARE
System of programs
specifying how to
present data to the
user
DATABASE
MANAGEMENT
SYSTEM
System of programs
controlling how data
is accessed
The DBMS uses schema
and subschema to
ensure data security.
A schema describes the
way the entire
database is organized.
A subschema describes
the organization of the
portion of the
database that is
accessible to a
particular type of user.
DATABASE
The stored data
of the system
Chapter 12
Information
Systems
Page 128
The Relational Database Model
The simplest conceptual arrangement of a database uses a table
of rows (called tuples) and columns (called attributes).
Last Name First Name M.I.
SID
Hrs Class GPA Major
DOB
Moose
Bullwinkle
J
900626977
112
Sr
3.24
CHEM
03/21/76
Bear
Yogi
D
900129875
48
So
2.17
BIOL
02/16/79
Coyote
Wile
E
900705548
54
So
3.16
MATH
11/05/81
Hound
Huckleberry
H
900339227
75
Jr
3.05
MKTG
09/12/83
Gorilla
Magilla
B
900187014
102
Sr
3.76
ELED
12/12/80
Pig
Porky
P
900882635
66
Jr
2.38
ECON
05/02/82
The major advantage of
this model is its logical
conceptualization.
The major disadvantage is the substantial
amount of software and hardware overhead
required to maintain and access the table.
Image
Chapter 12
Information
Systems
Page 129
Relational Operator SELECT
The SELECT operation determines which tuples have
particular attributes.
ORIGINAL TABLE
Code
Description
Price
213345
9v Battery
1.92
311452
Power Drill
34.99
254467
60W Bulb
1.47
309772
Mini-Ratchet Set
6.50
256568
Halogen Light
12.99
290031
Flat Screwdriver
8.45
NEW TABLE
Apply
SELECT with
Price < 10.00
Code
Description
Price
213345
9v Battery
1.92
254467
60W Bulb
1.47
309772
Mini-Ratchet Set
6.50
290031
Flat Screwdriver
8.45
Chapter 12
Information
Systems
Page 130
Relational Operator PROJECT
The PROJECT operation limits the scope of the
database to specific attributes.
ORIGINAL TABLE
NEW TABLE
Code
Description
Price
Code
Price
213345
9v Battery
1.92
213345
1.92
311452
Power Drill
34.99
311452
34.99
254467
60W Bulb
1.47
254467
1.47
309772
Mini-Ratchet Set
6.50
309772
6.50
256568
Halogen Light
12.99
256568
12.99
290031
Flat Screwdriver
8.45
290031
8.45
Apply
PROJECT with
Code & Price
Chapter 12
Information
Systems
Page 131
Relational Operator JOIN
The JOIN operation combines multiple tables that have
common attributes.
Table CUSTOMER
CusNo
CusName CusZip
Table SALESREP
RepNo
RepID
RepPhone
1132445
Walker
62449
231
125
6182439887
1321242
Rodriguez
62025
125
167
6183426778
1657399
Vanloo
62363
231
231
6182431124
1312243
Rakowski
62294
167
333
3145267759
1542311
Smithson
62025
421
1217782
Adares
62650
125
Apply JOIN with
CUSTOMER.RepNo =
SALESREP.RepID
NEW TABLE
CusNo
CusName
CusZip
RepNo
RepPhone
1132445
Walker
62449
231
6182431124
1321242
Rodriguez
62025
125
6182439887
1657399
Vanloo
62363
231
6182431124
1312243
Rakowski
62294
167
6183426778
1217782
Adares
62650
125
6182439887
Chapter 12
Information
Systems
Page 132
Concurrency Control
A potential problem with database systems that allow
multiple access points is the loss of data integrity.
At ATM #1: Deposit $400
At ATM #2: Withdraw $200
Get Balance...
$500
Add $400 to Balance... $900
Store new Balance... $900
Get Balance...
$500
Subtract $200 from Balance... $300
Store new Balance...
$300
Either balance that’s stored would be incorrect,
since the correct balance is $700!
Chapter 12
Information
Systems
Page 133
Databases and Privacy
The proliferation of information on database systems
poses a potential threat to the privacy of people about
whom the data refers.
Example: Medical Databases
Advantages:
Disadvantages:
•Reduction of paperwork
•Employer access might cost jobs
•Fewer false insurance claims
•“High risk” insurance increases
•Facilitates disease tracking
•Unsolicited advertisements
•Immediate access in emergency •Fear inhibits candid disclosure
•Cost-effective ID of treatment •Inaccuracies are spread easily
•Safer than paper records
•Dr./patient confidentiality loss
Chapter 12
Information
Systems
Page 134
Cryptography
Networks are set up to send messages right past
stations that aren’t authorized to read them, but
what’s to prevent such unauthorized viewing?
Message
The most common solution to this problem is
encryption, where the message is coded in such a
way that only the receiving station can decode it.
Chapter 12
Information
Systems
Page 135
Public-Key Encryption
I have affixed
to me the dirt
and dust of
countless ages!
1.
Create
Message
Chuck
Linus
Lucy
Patty
mdbriugndlwg
mamnsgfyddkd
qhgwdnchsgsh
ahwbsgcydhzx
2.
Look Up
Recipient’s
Public Key
xsjb2dhdkWb$
xzduYdm!dj5slL
ssghd8nd&hsnq
abi?dsjsg%
3.
Encrypt Message
With Recipient’s
Public Key
4.
Transmit Encrypted
Message
xsjb2dhdkWb$
xzduYdm!dj5slL
ssghd8nd&hsnq
abi?dsjsg%
I have affixed
to me the dirt
and dust of
countless ages!
5.
Decrypt Message With
Recipient’s Private Key
Chapter 12
Information
Systems
Page 136
Key-Based Authentication
When a message is received, how can you be sure who it came from?
I’m going to recruit that
funny-looking kid who
plays shortstop on
Chuck’s team!
Ma3ndhvyr#bcjaqwp
fQkguiorkfohskxi8vc
e%fpgkjfhikfvdamxx
yemfideychssfhsgdha
hdm$dlglyn7buchso
1.
Create Message
2.
Encrypt Message With
Sender’s Private Key
3.
Transmit Encrypted
Message
Ma3ndhvyr#bcjaqwp
fQkguiorkfohskxi8vc
e%fpgkjfhikfvdamxx
yemfideychssfhsgdh
ahdm$dlglyn7buchso
I’m going to recruit
that funny-looking kid
who plays shortstop on
Chuck’s team!
4.
Decrypt Message With
Sender’s Public Key
Chapter 12
Information
Systems
Page 137
Chapter 13: Artificial Intelligence
Computations that make it
possible for a machine to
perceive, reason, and act in a
manner consistent with
human behavior form the
field known as artificial
intelligence.
The Turing Test
A human questioner inputs questions
and guesses which respondent is human,
based on the answers given.
If the questioner cannot tell which
respondent is human, the software
passes the test.
Chapter 13
Artificial
Intelligence
Page 138
Computer Reasoning
To simulate logical reasoning, heuristic functions are often used.
A heuristic is an artificial measure of how close the computer’s current
status is to its problem-solving goal.
F(config) =
(# of completable rows, columns, and diagonals for
X-player) – (# of completable rows, columns, and
diagonals for O-player)
if config is a non-winning
configuration
if config is an X-win
O O
-
if config is an O-win
X
X
1
-
X O O
O O
X
-
X
X O O
O X
X
2-1=1
X O O
X
X O
3-1=2
X O O
X
X
O
2-1=1
X O O
X O
X
O O
X X
X
X X
-
-
X
O O
O O
X
X
X X
X
X
3-1=2
O O O
X X
X
-
O O O
O O
X X
O X X
X
2-1=1
X
-
O O
X X
X O
3-2=1
O O
X X
X
O
2-2=0
O O
X X O
X
O O O
3-2=1
-
X
X X
O O
O X
X X
2-2=0
O O
X
X X O
2-2=0
O O
X O
X X
O O O
3-2=1
-
X
X
X
O O
O X
X
X
2-1=1
O O
X
X O X
3-1=2
O O
X X
X O
2-1=1
O O
X X
X
O
2-1=1
O O
X O
X
X
3-1=2
In the tic-tac-toe example above, when the computer is ready to make an
X-move, it uses the heuristic max{F(config), where config can be the
result of any O-move}.
Chapter 13
Artificial
Intelligence
Page 139
Expert Systems
By programming a computer with the assistance of
experts in a particular field, an expert system can be
developed to perform very specialized tasks.
Users in need of
expert assistance
complete on-line
questionnaires and
the expert system
analyzes their
responses and
assigns probabilities
to various diagnoses.
Chapter 13
Artificial
Intelligence
Page 140
Genetic Algorithms
When a problem has no definitive algorithmic solution, it’s possible that a
technique can be developed by which the solution can evolve.
This type of solution, known as a genetic algorithm, involves the generation of
numerous possible solutions called a population. Each member of the population
has a fitness score based on the goal of the problem. Subsequent generations are
then created by blending members of the population and subjecting some to
mutations. The goal is to “breed” solutions, over multiple generations, that
better solve the problem.
For example, in the example at left, the problem
of producing a flywheel composed of a variety of
ceramic, polymer, and fiber materials is
addressed.
An optimal balance of materials is desired so the
flywheel can spin faster (thus producing greater
kinetic energy), but not so fast that the resulting
shear forces will rip the flywheel apart.
Chapter 13
Artificial
Intelligence
Page 141
Neural Networks
To simulate learning, certain multiprocessor systems, called neural
networks, have been built to “learn” to recognize particular patterns
as correct or incorrect, based upon a trial-and-error process.
In the example below, a neural network is used to teach a
computerized system how to back a truck up to a loading dock.
The physical characteristics of the
truck are programmed, with the
relationship between the steering
wheel, the tires, the cab, and the
trailer formally calculated.
Starting at some initial position, the
truck is backed up one meter at a time,
with programmed steering; the error in
the result is measured and factored into
the next attempt, until the error is zero.
Chapter 13
Artificial
Intelligence
Page 142
Natural Language Processing
Written Comprehension: How can a computer be
programmed to grasp the syntax and semantics of a
natural language?
John saw the boy in the park with
the telescope.
Question: Whose telescope is it? Answer: John’s
John saw the boy in the park with
the puppy.
Question: Whose puppy is it?
Answer: The boy’s
John saw the boy in the park with
the statue.
Question: Whose statue is it?
Answer: The park’s
Chapter 13
Artificial
Intelligence
Page 143
Speech Recognition
1. The PC sound card converts
analog sound waves spoken
into a microphone into a
digital format.
0011010101000
0101111101010
2. A software
0100110101010
acoustical
model breaks 0101011110010
the word into 1011010100110
1010101010101
phonemes.
0101010101001
0011010101000
0101111101010
0100110101010
0101011110010
1011010100110
1010101010101
0101010101001
“K”
“K”
CALM
3. A software
“AH” COMMA
“AH”
language model “M” COMPARE
“M”
compares the “P” COMPETE
“P”
phonemes to “Y” COMPLETE
“Y”
COMPUTE
words in its
“OO”
“OO”
dictionary.
“T”
“T”
4. Once the software decides on the most
likely candidate, it displays that word.
COMPUTE
Chapter 13
Artificial
Intelligence
Page 144
Robotics
Robots are programmable devices capable of manipulating objects
and performing tasks much like humans are able to do.
One of the more difficult problems when programming a robot is determining
when it is about to collide with something, when it has collided with something,
and what to do in response to a collision.
Collision Avoidance
Use scanners to determine the
robot’s proximity to other
objects, redirecting the robot
when a collision is imminent.
Collision Detection
Use sensors at
strategically located places
on the robot to determine
if a collision occurs.
Collision Reaction
Go around?
Climb over?
Bounce back?
Run away?
Drop dead?
Chapter 13
Artificial
Intelligence
Page 145
Robot Challenges
Other common human actions that are difficult to program include
propelled locomotion and manual manipulation.
Walking Gait
How can a robot be programmed
to propel itself forward on
“legs” and still maintain its
balance?
Grasping
How can a robot be programmed to
grasp part of a stack of objects,
without toppling the rest of the
stack?
Chapter 13
Artificial
Intelligence
Page 146
AI in Games
Non-player characters in games need to appear intelligent, even
though they are controlled by the game program instead of by a
game player.
Dead Reckoning
By having a game-driven
predator character react to the
anticipated position of its
player-driven prey (using the
prey’s current position and
velocity), a chase can appear
more realistic.
Flocking
By providing a group of characters with simple
goals and behaviors, a “mob mentality” can be
implemented with a minimum of code.
Chapter 13
Artificial
Intelligence
Page 147
Chapter 14: Simulation, Graphics, and
Other Applications
In order to gain insight into complex systems, scientists often build
computer models to simulate their performance.
Continuous Dynamic Simulation
Elaborate equations representing the
different aspects of the model are
periodically solved to generate a
sequence of snapshots of its
performance (e.g., flight simulators).
Discrete Event Simulation
The system is represented as a
chronological sequence of events,
each of which subtly impacts the
overall state of the system (e.g.,
network modeling).
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 148
Computer Graphics
Recent advances in processor power, display technology,
memory capacity, and rendering algorithms have made it
possible to produce dazzling images using relatively
inexpensive computers.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 149
Drawing Lines and Circles
Pixel-based display technologies cause inherent problems when
displaying circles or non-vertical/non-horizontal lines.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 150
Antialiasing
Complex scenes lose their integrity when using singlecolored pixels.
Jagged Profiles
A common way to address
this problem is with
antialiasing algorithms,
which combine the colors
affecting a particular pixel
into a “blended” color
that will minimize these
negative effects.
Loss Of Detail
Disintegrating Textures
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 151
3D Shading
The easiest way to store
information about most 3D
objects is as a set of polygons.
Unfortunately, smooth objects
aren’t necessarily polyhedral, so
the resulting image looks bad.
The common solution to this
problem is to use a shading
algorithm, which progressively
blends the shading of adjacent
polygons to smooth out the
reflection of the virtual light
across the surface.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 152
Lighting Effects
In order to accurately model lighting
effects, the shading algorithm must
take into account the position of the
graphical scene’s virtual light source
and the rendered objects’ locations
with respect to it.
More sophisticated lighting models
take into account radiosity, the fact
that light reflects off the surface of
some objects and, in turn, illuminates
other objects.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 153
Ray Tracing
Rays are cast from the
viewer’s position
through each pixel;
the first object that’s
hit is the one that’s
rendered in that pixel.
To calculate reflections,
the ray is bounced from
the hit object (if it’s
shiny) at the opposite
angle at which it hit the
object; if another object
is hit, then the second
object will be reflected
on the surface of the
first object.
To calculate shadows, the ray
is bounced from the hit object
to the scene’s light source, if
another object is hit on the
way to the light, then the
original object is in shadow.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 154
Texture Mapping
To give a greater sense of realism to 3D graphical objects, texture
mapping provides an inexpensive means of placing 2D “wallpaper”
around the objects.
Bump mapping can make the results even more visually striking, by
adding a displacement factor across the surface of the objects,
giving the illusion of 3D texture in the resulting lighting effects.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 155
Character Animation
By strategically manipulating specific vertices comprising
an animated model, a graphics artist can make the model
behave in a lifelike manner.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 156
Embedded Systems
Special-purpose computer systems are often designed to
perform a specific list of dedicated tasks.
Embedded systems:
• are often built into the devices they control, rather than being separate
devices.
• frequently have real-time performance constraints.
• often have low performance requirements, allowing cheaper hardware
to be used.
• use software called firmware, usually stored in ROM or flash memory.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 157
Electronic Commerce
As networking capabilities have become ubiquitous, the
ability to conduct financial business electronically has
soared.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 158
Computer Security
A computer virus piggybacks on another file to “infect” a system.
When a user runs an infected
program, the computer starts by
copying the program from the disk,
where it is stored and inactive, into
RAM, where it can be executed.
The viral code begins running
first, while the infected
program is still quiescent.
Its initial work done, the virus
passes control back to the
infected program.
When the user runs a different
program, the dormant virus
begins running again.
The virus copies itself in a part of
RAM separate from the program
so that it can continue its work
even after the user starts running
other software.
It inserts a copy of itself into
the previously uninfected
software so that the cycle of
virulence can repeat.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 159
Worms and Trojan Horses
Worms are parasitic
computer programs that
replicate, but unlike viruses,
do not infect other
computer program files.
Worms can create copies on
the same computer, or can
send the copies to other
computers via a network.
Worms often spread via email or chat applications.
A Trojan horse is a malicious program that
pretends to be a benign application.
A Trojan horse program purposefully
does something the user does not expect.
Trojan horses are not viruses since they
do not replicate, but they can be just as
destructive.
One type of Trojan horse, known as a
logic bomb, is set to execute whenever a
specific event occurs (e.g., a change in a
file, a particular series of keystrokes, a
specific time or date).
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 160
Fighting Viruses
Various techniques have been developed to combat computer
viruses.
Generic Antiviral Program
Signature Scanner
Antiviral Snapshots
Flags activities--such as the
alteration of critical sites in RAM
or particular files on
disk--that are likely to arise from
a virus in action. Preventing these
illicit acts will not eliminate the
virus but can stop it from
infecting additional programs or
interfering with the computer's
normal operation.
Searches a user's
disks looking for
fragments of
program code that
appear in known
viruses.
Capture mathematical
"fingerprints" of crucial
programs and data. Subsequent
changes strongly suggest viral
infection. Advanced algorithms
can use the original fingerprints
to recover a pristine program
from the virus-altered version.
Chapter 14
Simulation,
Graphics, and
Other
Applications
Page 161