1 / 40

A little hardware; a little software

A little hardware; a little software. CS 139 – 08/29/07. Algorithm Review. In lab yesterday, we built algorithms. Which was the best algorithm? Why? Four characteristics of good algorithms Precise – no ambiguity Simple – each step does one discrete thing Complete – no steps are missing

forest
Download Presentation

A little hardware; a little software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A little hardware; a little software CS 139 – 08/29/07

  2. Algorithm Review • In lab yesterday, we built algorithms. • Which was the best algorithm? • Why? • Four characteristics of good algorithms • Precise – no ambiguity • Simple – each step does one discrete thing • Complete – no steps are missing • Correct – leads to the same correct result each time

  3. Next week • We will work more on making the language of algorithms more precise.

  4. This session • We want to explore some of the environment in which we will implement our algorithms….the computer. • Parts of the computer • Data storage • OS • File Systems

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

  6. Stored-Program Concept Figure 5.1 The von Neumann architecture

  7. The Fetch-Execute Cycle • Fetch the next instruction • Decode the instruction • Get data if needed • Execute the instruction

  8. Memory • Memory is a collection of cells, each with a unique physical address Page 122

  9. RAM and ROM • RAM 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 Memory • The contents in locations in ROM cannot be changed • RAM is volatile, ROM is not • This means that RAM does not retain its bit configuration when the power is turned off, but ROM does

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

  11. Magnetic Disks • A read/write head travels across a spinning magnetic disk, retrieving or recording data Figure 5.5The organization of a magnetic disk

  12. Compact Disks • A CD drive uses a laser to read information stored optically on a plastic disk • CD-ROM is Read-Only Memory • DVD stands for Digital Versatile Disk

  13. Sizes in Perspective Page 119

  14. File Systems • A file is a named collection of related data • A file system is the logical view that an operating system provides so that users can manage information as a collection of files • A file system is often organized by grouping files into directories

  15. Directory Trees Figure 11.4 A Windows directory tree

  16. Directory Trees • A 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 tree • The directory at the highest level is called the root directory

  17. Figure 11.5 A Unix Directory Tree

  18. Directory Trees • At 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

  19. Path Names • To 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 file • An absolute path name begins at the root and specifies each step down the tree until it reaches the desired file or directory • A relative path name begins from the current working directory

  20. Path Names • Examples of absolute path C:\Program Files\MS Office\WinWord.exe C:\My Documents\letters\applications\vaTech.doc C:\Windows\System\QuickTime • Suppose the current working directory is C:\My Documents\letters • Then the following relative path names could be used cancelMag.doc applications\calState.doc

  21. Demo

  22. Text and Binary Files • In a text file the bytes of data are organized as characters from the ASCII or Unicode character sets • A binary file requires a specific interpretation of the bits based on the information in the file

  23. Text and Binary Files • The terms text file and binary file are somewhat misleading • They seem to imply that the information in a text file is not stored as binary data • Ultimately, 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

  24. File Types • Most 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

  25. File Types • File names are often separated, usually by a period, into two parts • Main name • File extension • The file extension indicates the type of the file Figure 11.1 Some common file types and their extensions

  26. File Protection • In multiuser systems, file protection is of primary importance • We don’t want one user to be able to access another user’s files unless the access is specifically allowed • A file protection mechanism determines who can use a file and for what general purpose

  27. File Protection • A file’s protection settings in the Unix operating system is divided into three categories • Owner • Group • World Page 356

  28. Algorithms

  29. Problem Solving • Problem solving is the act of finding a solution to a perplexing, distressing, vexing, or unsettled question

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

  31. Algorithms • An algorithm is set of instructions for solving a problem or subproblem in a finite amount of time using a finite amount of data • The instructions are unambiguous

  32. Computer Problem-Solving Figure 6.2 The computer problem-solving process

  33. Figure 6.3: The Interactions Between Problem-Solving Phases

  34. Following an Algorithm • Preparing a Hollandaise sauce Figure 6.4

  35. Following an Algorithm (cont.) • Preparing a Hollandaise sauce Page 150

  36. A Computer Example • Problem • 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

  37. A Computer Example Page 156

  38. A Computer Example Page 157

  39. A Computer Example Page 158

  40. A Computer Example Page 159

More Related