chapter 10: operating systems

52
Chapter 10: Operating Systems Chapter 10 Operating Systems Page 1 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

Upload: adriel

Post on 23-Mar-2016

47 views

Category:

Documents


2 download

DESCRIPTION

Chapter 10: Operating Systems. An operating system is a set of programs through which a computer manages its resources. Its main functions are to:. Manage the computer hardware CPU performance & utilization Memory allocation & protection Input-output management Keyboard control - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 10: Operating Systems

Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 1

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 DriversMemory

ManagementCPU Scheduling

Hardware

Page 2: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 2

2) Support application software

Word processors Electronic spreadsheets

Computer graphics & games

Database management

Page 3: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 3

3) Establish a user interface

Textual, with a command-line

prompt

Graphical, with windows, menus, and icons

Page 4: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 4

Different Approaches to ProcessingBatch Processing

Non-interactive execution of one or more programs with distinct

input and output sessions

Time-SharingMultiple programs executing

“simultaneously” (via time slices) on a single computer (either many users on a server or one user “multitasking”)

Interactive ProcessingExecution of a program with

additional input from the user and output to the user

during execution

MultiprocessingMultiple CPUs available within the computer system, either across a

network or within a single machine (e.g., a supercomputer)

RAMProcess Process Process

PCB PCBPCB

CPU

Page 5: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 5

Memory ManagementThe 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.

Page 6: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 6

PagingSince 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 Space1

2

3

4

Program B’s

Virtual Space1

2

3

RAM

4

1

5

1

2

3

7

4

2

3

2

Backup Storage (Disk)

7

1

3

5

6

6

4

12

6

1

4

1

3

2

3

2

2

1

1

3

4

3

5

8

4 1

4

3

1

2

3

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.

Page 7: Chapter 10: Operating Systems

CPU ManagementEvery 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) Ready

Process(Loaded

into RAM, it will run

when allotted

CPU time) Waiting Process(Needs I/O or some

event in memory,

temporarily can’t

run)

Terminated

Process(Finished executing

, its memory must be marked “free”)Running

Process(In RAM, with CPU processin

g its instructio

ns)

OS “admits” process

by loading

into RAM

OS “dispatches” process by

allotting CPU timeOS “interrupts”

process to give another process

CPU timeOS moves process to

waiting state when it starts

idling

OS moves process to ready state

when it’s ready to resume

OS starts cleaning up

after the process has completed

Conceptually, the operating system moves the process from state to state in its

journey through CPU execution.

Page 8: Chapter 10: Operating Systems

CPU SchedulingWhen multiple processes are vying for the CPU’s attention, the operating system must schedule them.Common Scheduling Options:

Process 1 Process 2 Process 3 Process 4

First-Come First-Served (FCFS)Disadvantage: Smaller jobs may have to wait an inordinate amount of time.

Process 2 Process 1 Process 4 Process 3

Shortest Job First (SJF)Disadvantage: Large jobs must wait until everything else is finished before starting.

Process 1.1

Process 2.1

Process 3.1

Process 4.1

Process 1.2

Process 2.2

Process 3.2

Process 4.2

Process 1.3

Process 3.3

Process 4.3

Process 3.4

Round RobinDisadvantage: Processes constantly interrupted when time slices expire.

Page 9: Chapter 10: Operating Systems

Chapter 10Operating SystemsPage 9

Resource Allocation Problems

Producer

Consumer

Waiting

Full Queue

Producer

Consumer

WaitingEmpty Queue

Mutual ExclusionIf two processes require access to the same nonshareable

resource at the same time, then both cannot be accommodated.Example: Producer & 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.DeadlockIf 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

Page 10: Chapter 10: Operating Systems

Chapter 11: File Systems and Directories

Chapter 11File Systems

and Directories

Page 10

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.

Page 11: Chapter 10: Operating Systems

File Access

Chapter 11File Systems

and Directories

Page 11

There are two major ways in which files are organized and accessed.

Sequential AccessThe 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.

Direct AccessThe records in the file are arranged so an individual record may be retrieved without examining other

records in the file.

Page 12: Chapter 10: Operating Systems

Sequential File Access

Chapter 11File Systems

and Directories

Page 12

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

Page 13: Chapter 10: Operating Systems

Indexed Files

Chapter 11File Systems

and Directories

Page 13

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

Adams

5 68

Bosley

4 27

Carter 5 43

SSN Sector

Track

402231161

5 43

627880013

3 71

759307562

4 11

Page 14: Chapter 10: Operating Systems

Hashed Files

Chapter 11File Systems

and Directories

Page 14

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 SID0 21 22 23 24 35 26 27 38 29 6

Page 15: Chapter 10: Operating Systems

Directories

Chapter 11File Systems

and Directories

Page 15

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.

Page 16: Chapter 10: Operating Systems

Disk Scheduling

Chapter 11File Systems

and Directories

Page 16

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.

Page 17: Chapter 10: Operating Systems

Chapter 12: Information Systems

Chapter 12Information

SystemsPage 17

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.

Page 18: Chapter 10: Operating Systems

Database Structures

Chapter 12Information

SystemsPage 18

An alternative to a distributed information system based upon files is a centralized system based upon the concept of databases.File-Oriented

SystemDatabase-OrientedSystem

Video Rental Files

Rental

Dept.

VideoSalesFiles

Sales Dept.

Video Purchase Files

Purch-asing Dept.

Advertise-

mentFiles

Market-ing

Dept.

Store Upkeep

Files

Maint-

enance

Dept.

Store Personne

l Files

Payroll

Dept.Renta

l Dept.

Sales Dept.

Purch-asing Dept.

Market-ing

Dept.

Integrated

Database

Maint-

enance

Dept.

Payroll

Dept.DISADVANTAGES OF EACH

SYSTEMFile-Oriented Database-

OrientedDuplication of effort Data security

problemsMultiple error sources Widespread error

effects

Page 19: Chapter 10: Operating Systems

A Modular View of a Database System

Chapter 12Information

SystemsPage 19

APPLICATION SOFTWARESystem of programs specifying how to present data to the user

DATABASE MANAGEMENT

SYSTEMSystem of programs

controlling how data is accessed

DATABASE

The stored data of the

system

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.

Page 20: Chapter 10: Operating Systems

The Relational Database Model

Chapter 12Information

SystemsPage 20

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 Image

Moose Bullwinkle J 900626

977112 Sr 3.2

4CHEM

03/21/76

Bear Yogi D 900129875 48 So 2.1

7 BIOL 02/16/79

Coyote Wile E 900705548 54 So 3.1

6MAT

H11/05/

81

Hound Huckleberry H 900339

227 75 Jr 3.05

MKTG

09/12/83

Gorilla Magilla B 900187014

102 Sr 3.7

6 ELED 12/12/80

Pig Porky P 900882635 66 Jr 2.3

8ECO

N05/02/

82The 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.

Page 21: Chapter 10: Operating Systems

Relational Operator SELECT

Chapter 12Information

SystemsPage 21

The SELECT operation determines which tuples have particular attributes.

ORIGINAL TABLECode Description Pric

e21334

59v 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 TABLECode Description Pric

e21334

59v Battery 1.92

254467

60W Bulb 1.47

309772

Mini-Ratchet Set

6.50

290031

Flat Screwdriver

8.45

Apply SELECT

withPrice < 10.00

Page 22: Chapter 10: Operating Systems

Relational Operator PROJECT

Chapter 12Information

SystemsPage 22

The PROJECT operation limits the scope of the database to specific attributes.

ORIGINAL TABLECode Description Pric

e21334

59v 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

Code Price

213345

1.92

311452

34.99

254467

1.47

309772

6.50

256568

12.99

290031

8.45

Apply PROJECT

withCode & Price

Page 23: Chapter 10: Operating Systems

Relational Operator JOIN

Chapter 12Information

SystemsPage 23

The JOIN operation combines multiple tables that have common attributes.

Table CUSTOMERCusN

oCusNa

meCusZ

ipRepN

o11324

45Walker 6244

9231

1321242

Rodriguez

62025

125

1657399

Vanloo 62363

231

1312243

Rakowski

62294

167

1542311

Smithson

62025

421

1217782

Adares 62650

125

NEW TABLECusNo CusNa

meCusZi

pRepNo RepPhon

e11324

45Walker 62449 231 61824311

2413212

42Rodrigu

ez62025 125 61824398

8716573

99Vanloo 62363 231 61824311

2413122

43Rakowsk

i62294 167 61834267

7812177

82Adares 62650 125 61824398

87

Apply JOIN withCUSTOMER.Rep

No = SALESREP.RepI

D

Table SALESREP

RepID RepPhone

125 6182439887

167 6183426778

231 6182431124

333 3145267759

Page 24: Chapter 10: Operating Systems

Concurrency Control

Chapter 12Information

SystemsPage 24

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 $200Get Balance...

$500Get Balance... $500Add $400 to

Balance... $900Subtract $200 from Balance... $300Store new Balance...

$900Store new Balance... $300

Either balance that’s stored would be incorrect, since the correct balance is $700!

Page 25: Chapter 10: Operating Systems

Databases and Privacy

Chapter 12Information

SystemsPage 25

The proliferation of information on database systems poses a potential threat to the privacy of people about whom the data refers.

Example: Medical DatabasesAdvantages:

• Reduction of paperwork• Fewer false insurance

claims• Facilitates disease

tracking• Immediate access in

emergency• Cost-effective ID of

treatment• Safer than paper

records

Disadvantages:• Employer access might

cost jobs• “High risk” insurance

increases• Unsolicited

advertisements• Fear inhibits candid

disclosure• Inaccuracies are spread

easily• Dr./patient

confidentiality loss

Page 26: Chapter 10: Operating Systems

Cryptography

Chapter 12Information

SystemsPage 26

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?

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.

Message

Message

Page 27: Chapter 10: Operating Systems

Public-Key Encryption

Chapter 12Information

SystemsPage 27

1.Create

Message

I have affixed to me the dirt and dust of countless ages!

Chuck mdbriugndlwgLinus mamnsgfyddkdLucy qhgwdnchsgshPatty ahwbsgcydhzx

2.Look Up

Recipient’s Public

Key

3.Encrypt

Message With Recipient’s Public Key

xsjb2dhdkWb$xzduYdm!dj5slLssghd8nd&hsnqabi?dsjsg%

4.Transmit

Encrypted Message

xsjb2dhdkWb$xzduYdm!dj5slLssghd8nd&hsnqabi?dsjsg%

5.Decrypt Message With Recipient’s

Private Key

I have affixed to me the dirt and dust of countless ages!

Page 28: Chapter 10: Operating Systems

Key-Based Authentication

Chapter 12Information

SystemsPage 28

When a message is received, how can you be sure who it came from?

1.Create

Message

I’m going to recruit that funny-looking kid who plays shortstop on Chuck’s team!

2.Encrypt Message

With Sender’s Private Key

Ma3ndhvyr#bcjaqwpfQkguiorkfohskxi8vce%fpgkjfhikfvdamxxyemfideychssfhsgdhahdm$dlglyn7buchso

3.Transmit

Encrypted Message

Ma3ndhvyr#bcjaqwpfQkguiorkfohskxi8vce%fpgkjfhikfvdamxxyemfideychssfhsgdhahdm$dlglyn7buchso

4.Decrypt Message

With Sender’s Public Key

I’m going to recruit that funny-looking kid who plays shortstop on Chuck’s team!

Page 29: Chapter 10: Operating Systems

Chapter 13: Artificial Intelligence

Chapter 13Artificial

IntelligencePage 29

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 TestA 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.

Page 30: Chapter 10: Operating Systems

Computer Reasoning

Chapter 13Artificial

IntelligencePage 30

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.

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}.

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- if config is an O-win

O OX

X

X O OX

X

X O OO XX

X O OX

X O

X O OX

X O

X O OX O

X2-1=1 3-1=2 2-1=1 3-1=2

O OX XX

O O OX XX

O OX XX O

O OX XX O

O OX X OX

- 3-2=1 2-2=0 3-2=1

O OX

X X

O O OX

X X

O OO XX X

O OX

X X O

O OX O

X X- 2-2=0 2-2=0 3-2=1

O OX X

X

O O OX X

X

O OO X XX

O OX X

X O

O OX X

X O- 2-1=1 2-1=1 2-1=1

O OX

X X

O O OX

X X

O OO XX X

O OX

X O X

O OX O

X X- 2-1=1 3-1=2 3-1=2

1

- - -

-

Page 31: Chapter 10: Operating Systems

Expert Systems

Chapter 13Artificial

IntelligencePage 31

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.

Page 32: Chapter 10: Operating Systems

Genetic AlgorithmsWhen 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 13Artificial

IntelligencePage 32

Page 33: Chapter 10: Operating Systems

Neural Networks

Chapter 13Artificial

IntelligencePage 33

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.

Page 34: Chapter 10: Operating Systems

Natural Language Processing

Chapter 13Artificial

IntelligencePage 34

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

Page 35: Chapter 10: Operating Systems

Speech Recognition

Chapter 13Artificial

IntelligencePage 35

0011010101000010111110101001001101010100101011110010101101010011010101010101010101010101001

1. The PC sound card converts analog sound waves spoken into a microphone into a digital format.

2. A software acoustical model breaks the word into phonemes.

0011010101000 “K”0101111101010 “AH”0100110101010 “M”0101011110010 “P”1011010100110 “Y”1010101010101 “OO”0101010101001 “T”

3. A software language model compares the phonemes to words in its dictionary.

“K”“AH”“M”“P”“Y”“OO”“T”

CALMCOMMACOMPARECOMPETECOMPLETECOMPUTE

4. Once the software decides on the most likely candidate, it displays that word.

COMPUTE

Page 36: Chapter 10: Operating Systems

Robotics

Chapter 13Artificial

IntelligencePage 36

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 AvoidanceUse scanners to

determine the robot’s proximity to other

objects, redirecting the robot when a collision

is imminent.

Collision DetectionUse 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?

Page 37: Chapter 10: Operating Systems

Robot Challenges

Chapter 13Artificial

IntelligencePage 37

Other common human actions that are difficult to program include propelled locomotion and manual manipulation.

Walking GaitHow can a robot be

programmed to propel itself forward on “legs”

and still maintain its balance?

GraspingHow can a robot be

programmed to grasp part of a stack of objects,

without toppling the rest of the stack?

Page 38: Chapter 10: Operating Systems

AI in Games

Chapter 13Artificial

IntelligencePage 38

Non-player characters in games need to appear intelligent, even though they are controlled by the game program instead of by a game player.

FlockingBy providing a group of characters with simple goals and behaviors, a

“mob mentality” can be implemented with a minimum of

code.

Dead ReckoningBy 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.

Page 39: Chapter 10: Operating Systems

Chapter 14: Simulation, Graphics, and Other Applications

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 39

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 SimulationThe system is

represented as a chronological sequence of

events, each of which subtly impacts the overall state of the system (e.g.,

network modeling).

Page 40: Chapter 10: Operating Systems

Computer Graphics

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 40

Recent advances in processor power, display technology, memory capacity, and rendering algorithms have made it possible to produce dazzling images using relatively inexpensive computers.

Page 41: Chapter 10: Operating Systems

Drawing Lines and Circles

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 41

Pixel-based display technologies cause inherent problems when displaying circles or non-vertical/non-horizontal lines.

Page 42: Chapter 10: Operating Systems

Antialiasing

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 42

Complex scenes lose their integrity when using single-colored pixels.

Jagged Profiles Loss Of Detail Disintegrating Textures

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.

Page 43: Chapter 10: Operating Systems

3D Shading

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 43

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.

Page 44: Chapter 10: Operating Systems

Lighting Effects

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 44

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.

Page 45: Chapter 10: Operating Systems

Ray Tracing

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 45

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 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.

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.

Page 46: Chapter 10: Operating Systems

Texture Mapping

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 46

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.

Page 47: Chapter 10: Operating Systems

Character Animation

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 47

By strategically manipulating specific vertices comprising an animated model, a graphics artist can make the model behave in a lifelike manner.

Page 48: Chapter 10: Operating Systems

Embedded Systems

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 48

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.

Page 49: Chapter 10: Operating Systems

Electronic Commerce

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 49

As networking capabilities have become ubiquitous, the ability to conduct financial business electronically has soared.

Page 50: Chapter 10: Operating Systems

Computer Security

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 50

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.

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.

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.

It inserts a copy of itself into the

previously uninfected software so that the cycle of virulence can

repeat.

Page 51: Chapter 10: Operating Systems

Worms and Trojan Horses

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 51

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 e-mail 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).

Page 52: Chapter 10: Operating Systems

Fighting Viruses

Chapter 14Simulation, Graphics, and Other

ApplicationsPage 52

Various techniques have been developed to combat computer viruses.

Generic Antiviral Program

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.

Signature Scanner

Searches a user's disks looking for

fragments of program code that appear in

known viruses.

Antiviral SnapshotsCapture 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.