40
A little hardware; a little software CS 139 – 08/30/06

A little hardware; a little software CS 139 – 08/30/06

Embed Size (px)

Citation preview

Page 1: A little hardware; a little software CS 139 – 08/30/06

A little hardware; a little software

CS 139 – 08/30/06

Page 2: A little hardware; a little software CS 139 – 08/30/06

Algorithm ReviewIn lab yesterday, we built algorithms.Which was the best algorithm?Why?Four characteristics of good algorithms

PreciseSimpleCompleteCorrect

Page 3: A little hardware; a little software CS 139 – 08/30/06

Next weekWe will work more on making the language of algorithms more precise. We may be able to do some of this today.

Page 4: A little hardware; a little software CS 139 – 08/30/06

This sessionWe want to explore some of the environment in which we will implement our algorithms….the computer.Parts of the computerData storageOSFile Systems

Page 5: A little hardware; a little software CS 139 – 08/30/06

Flow of Information The parts are connected to one another by a collection of wires called a bus

Figure 5.2 Data flow through a von Neumann architecture

Page 6: A little hardware; a little software CS 139 – 08/30/06

Stored-Program Concept

Figure 5.1 The von Neumann architecture

Page 7: A little hardware; a little software CS 139 – 08/30/06

The Fetch-Execute CycleFetch the next instructionDecode the instructionGet data if neededExecute the instruction

Page 8: A little hardware; a little software CS 139 – 08/30/06

Memory

Memory is a collection of cells, each with a unique physical address

Page 122

Page 9: A little hardware; a little software CS 139 – 08/30/06

RAM and ROMRAM stands for Random Access Memory

Inherent in the idea of being able to access each location is the ability to change the contents of each location

ROM stands for Read Only MemoryThe contents in locations in ROM cannot be changed

RAM is volatile, ROM is notThis means that RAM does not retain its bit configuration when the power is turned off, but ROM does

Page 10: A little hardware; a little software CS 139 – 08/30/06

Secondary Storage Devices

Because most of main memory is volatile and limited, it is essential that there be other types of storage devices where programs and data can be stored when they are no longer being processed Secondary storage devices can be installed within the computer box at the factory or added later as needed

Page 11: A little hardware; a little software CS 139 – 08/30/06

Magnetic DisksA read/write head travels across a spinning magnetic disk, retrieving or recording data

Figure 5.5 The organization of a magnetic disk

Page 12: A little hardware; a little software CS 139 – 08/30/06

Compact DisksA CD drive uses a laser to read information stored optically on a plastic diskCD-ROM is Read-Only MemoryDVD stands for Digital Versatile Disk

Page 13: A little hardware; a little software CS 139 – 08/30/06

Computer ComponentsConsider the following ad

Page 116

Page 14: A little hardware; a little software CS 139 – 08/30/06

Sizes in Perspective

Page 119

Page 15: A little hardware; a little software CS 139 – 08/30/06

File SystemsA file is a named collection of related dataA file system is the logical view that an operating system provides so that users can manage information as a collection of filesA file system is often organized by grouping files into directories

Page 16: A little hardware; a little software CS 139 – 08/30/06

Directory Trees

Figure 11.4 A Windows directory tree

Page 17: A little hardware; a little software CS 139 – 08/30/06

Directory TreesA directory of files can be contained within another directory

The directory containing another is usually called the parent directory, and the one inside is called a subdirectory

A file system is often viewed as a directory treeThe directory at the highest level is called the root directory

Page 18: A little hardware; a little software CS 139 – 08/30/06

Figure 11.5 A Unix Directory Tree

Page 19: A little hardware; a little software CS 139 – 08/30/06

Directory TreesAt any point in time, you can be thought of as working in a particular location (that is, a particular subdirectory)This subdirectory is referred to as the current working directory

Page 20: A little hardware; a little software CS 139 – 08/30/06

Path NamesTo indicate a particular file using text, we specify that file’s path, which is the series of directories through which you must go to find the fileAn absolute path name begins at the root and specifies each step down the tree until it reaches the desired file or directoryA relative path name begins from the current working directory

Page 21: A little hardware; a little software CS 139 – 08/30/06

Path NamesExamples of absolute pathC:\Program Files\MS Office\WinWord.exeC:\My Documents\letters\applications\vaTech.docC:\Windows\System\QuickTime

Suppose the current working directory isC:\My Documents\letters

Then the following relative path names could be usedcancelMag.docapplications\calState.doc

Page 22: A little hardware; a little software CS 139 – 08/30/06

Exercise 1Open a Command PromptWhat is your working directory?Is there a config.sys file?What is in it?Change to \temp?Make a config.sys using edit.How can you refer to the other config.sys?Change to a different drive.

Page 23: A little hardware; a little software CS 139 – 08/30/06

Text and Binary FilesIn a text file the bytes of data are organized as characters from the ASCII or Unicode character setsA binary file requires a specific interpretation of the bits based on the information in the file

Page 24: A little hardware; a little software CS 139 – 08/30/06

Text and Binary FilesThe terms text file and binary file are somewhat misleadingThey seem to imply that the information in a text file is not stored as binary dataUltimately, all information on a computer is stored as binary digits These terms refer to how those bits are formatted: as chunks of 8 or 16 bits, interpreted as characters, or in some other special format

Page 25: A little hardware; a little software CS 139 – 08/30/06

File TypesMost files, whether they are in text or binary format, contain a specific type of information

For example, a file may contain a Java program, a JPEG image, or an MP3 audio clip

The kind of information contained in a document is called the file type

Most operating systems recognize a list of specific file types

Page 26: A little hardware; a little software CS 139 – 08/30/06

File TypesFile names are often separated, usually by a period, into two parts

Main nameFile extension

The file extension indicates the type of the file

Figure 11.1 Some common file types and their extensions

Page 27: A little hardware; a little software CS 139 – 08/30/06

File ProtectionIn multiuser systems, file protection is of primary importanceWe don’t want one user to be able to access another user’s files unless the access is specifically allowedA file protection mechanism determines who can use a file and for what general purpose

Page 28: A little hardware; a little software CS 139 – 08/30/06

File ProtectionA file’s protection settings in the Unix operating system is divided into three categories

OwnerGroupWorld

Page 356

Page 29: A little hardware; a little software CS 139 – 08/30/06

Problem SolvingProblem solving is the act of finding a solution to a perplexing, distressing, vexing, or unsettled question

Page 30: A little hardware; a little software CS 139 – 08/30/06

Ask Questions...…to understand the problem

What do I know about the problem?

What is the information that I have to process in order the find the solution?

What does the solution look like?

What sort of special cases exist?

How will I recognize that I have found the solution?

Page 31: A little hardware; a little software CS 139 – 08/30/06

AlgorithmsAn algorithm is set of instructions for solving a problem or subproblem in a finite amount of time using a finite amount of dataThe instructions are unambiguous

Page 32: A little hardware; a little software CS 139 – 08/30/06

Computer Problem-Solving

Figure 6.2 The computer problem-solving process

Page 33: A little hardware; a little software CS 139 – 08/30/06

Figure 6.3: The Interactions Between Problem-Solving

Phases

Page 34: A little hardware; a little software CS 139 – 08/30/06

Following an AlgorithmPreparing a Hollandaise sauce

Figure 6.4

Page 35: A little hardware; a little software CS 139 – 08/30/06

Following an Algorithm (cont.)

Preparing a Hollandaise sauce

Page 150

Page 36: A little hardware; a little software CS 139 – 08/30/06

A Computer ExampleProblem

Create an address list that includes each person’s name, address, telephone number, and e-mail address

This list should then be printed in alphabetical order

The names to be included in the list are on scraps of paper and business cards

Page 37: A little hardware; a little software CS 139 – 08/30/06

A Computer Example

Page 156

Page 38: A little hardware; a little software CS 139 – 08/30/06

A Computer Example

Page 157

Page 39: A little hardware; a little software CS 139 – 08/30/06

A Computer Example

Page 158

Page 40: A little hardware; a little software CS 139 – 08/30/06

A Computer Example

Page 159