iCarnecie SSD2 Book

255
SSD2: Introduction to Computer Systems iCarnegie training course

Transcript of iCarnecie SSD2 Book

Page 1: iCarnecie SSD2 Book

SSD2: Introduction to Computer SystemsiCarnegie training course

Page 2: iCarnecie SSD2 Book

ОглавлениеUnit 1. Computer Systems.............................................................................................................................................12

1.1 Overview of Computer Systems...........................................................................................................................12

1.1.1 Components of a Computer System.................................................................................................................12

Hardware System...................................................................................................................................................13

Software System—Operating System Software and Application Software............................................................15

Network System.....................................................................................................................................................16

1.2 Evolution of Computer Systems...........................................................................................................................17

1.2.1 Brief History......................................................................................................................................................18

1200s—Manual Calculating Devices......................................................................................................................19

1600s—Mechanical Calculators.............................................................................................................................19

1800s—Punched Cards..........................................................................................................................................19

1940s—Vacuum Tubes..........................................................................................................................................20

1950s—Transistors................................................................................................................................................21

1960s—Integrated Circuits....................................................................................................................................22

1970s to Present—Microprocessor.......................................................................................................................22

Pace of Advancement............................................................................................................................................23

1.2.2 Applications of Computer Systems...................................................................................................................24

In Education...........................................................................................................................................................24

In Business.............................................................................................................................................................30

In Entertainment....................................................................................................................................................31

1.3 Data Representation in a Computer System........................................................................................................32

1.3.1 Bits and Bytes...................................................................................................................................................33

Data Representation Using Binary Digits...............................................................................................................33

Increasing Need for Bytes......................................................................................................................................34

1.3.2 Number Systems...............................................................................................................................................34

Decimal..................................................................................................................................................................35

Binary.....................................................................................................................................................................36

Hexadecimal..........................................................................................................................................................37

Learning Exercise...................................................................................................................................................39

Unit 2. Hardware Systems.............................................................................................................................................39

2.1 Processor and Memory........................................................................................................................................43

2.1.1 Processor Basics................................................................................................................................................43

Page 3: iCarnecie SSD2 Book

Processor...............................................................................................................................................................43

Instruction Execution with the CPU.......................................................................................................................44

Performance: Factors and Measures.....................................................................................................................46

Types of Processors...............................................................................................................................................47

2.1.2 Types of Memory..............................................................................................................................................48

RAM.......................................................................................................................................................................48

ROM.......................................................................................................................................................................50

CMOS Memory......................................................................................................................................................50

Summary................................................................................................................................................................51

2.1.3 Lab: Benchmarking (Optional)..........................................................................................................................52

2.2 Peripherals...........................................................................................................................................................52

2.2.1 Connecting Peripherals.....................................................................................................................................53

Expansion Slots and Cards.....................................................................................................................................54

Ports......................................................................................................................................................................56

USB and FireWire...................................................................................................................................................57

Comparing Different Ports.....................................................................................................................................58

2.2.2 Buses.................................................................................................................................................................58

2.2.3 Input/Output Devices.......................................................................................................................................61

Input Devices.........................................................................................................................................................61

Output Devices: Monitors and Projectors..............................................................................................................62

Output Devices: Printers........................................................................................................................................63

2.3 Storage Devices....................................................................................................................................................64

2.3.1 Disk Controller Interfaces.................................................................................................................................65

IDE Interface..........................................................................................................................................................65

EIDE Master/Slave.................................................................................................................................................66

2.3.2 Mass Storage....................................................................................................................................................66

How Mass Storage Devices Differ from RAM.........................................................................................................66

Disk Drive Reliability..............................................................................................................................................67

Optical Media: CDs versus DVDs............................................................................................................................67

Magnetic Media.....................................................................................................................................................68

Optical versus Magnetic.........................................................................................................................................68

Solid State..............................................................................................................................................................69

Comparing Storages...............................................................................................................................................69

2.4 Putting Together the Hardware Components......................................................................................................70

2.4.1 How Components Work Together....................................................................................................................70

Page 4: iCarnecie SSD2 Book

2.4.2 Lab: Researching a Computer System...............................................................................................................72

2.4.3 Lab: Online Configuration.................................................................................................................................72

2.5 Improving Computer Performance......................................................................................................................73

2.5.1 Moore's Law.....................................................................................................................................................73

2.5.2 Bottlenecks.......................................................................................................................................................76

Bottlenecks—Slowing a Process............................................................................................................................76

Typical Bottlenecks................................................................................................................................................77

Eliminating Bottlenecks..........................................................................................................................................77

2.5.3 Throughput and Latency...................................................................................................................................77

Unit 1 and Unit 2 Review Materials...............................................................................................................................78

Unit 3. Operating System Software................................................................................................................................85

3.1 Structure..............................................................................................................................................................85

3.1.1 Layers of Software............................................................................................................................................85

Layers and Process Management..........................................................................................................................86

Encapsulation and Abstraction..............................................................................................................................86

Layers of Software.................................................................................................................................................87

3.1.2 The BIOS: Life at the Bottom.............................................................................................................................89

The Role of the BIOS..............................................................................................................................................89

Changing BIOS Settings..........................................................................................................................................90

3.1.3 Process Control.................................................................................................................................................91

3.1.4 Lab: The Task Manager.....................................................................................................................................91

3.2 Device Management and Configuration..............................................................................................................92

3.2.1 Interrupt Handling............................................................................................................................................93

Interrupts...............................................................................................................................................................93

Interrupt Priority and Nested Interrupts................................................................................................................93

Traps and Faults.....................................................................................................................................................94

3.2.2 Hardware Attributes.........................................................................................................................................94

Installing Drivers....................................................................................................................................................94

Changing a Driver's Configuration.........................................................................................................................95

3.2.3 Configuration....................................................................................................................................................96

3.2.4 Lab: Device Management.................................................................................................................................97

3.3 Resource Sharing.................................................................................................................................................99

3.3.1 Virtual Memory...............................................................................................................................................100

Managing Memory..............................................................................................................................................100

Relocation............................................................................................................................................................100

Page 5: iCarnecie SSD2 Book

Virtual Memory....................................................................................................................................................101

3.3.2 File and Printer Sharing...................................................................................................................................102

Files......................................................................................................................................................................102

Printers................................................................................................................................................................102

3.4 File Systems.......................................................................................................................................................102

3.4.1 File Organization.............................................................................................................................................103

Files......................................................................................................................................................................104

Folders.................................................................................................................................................................104

Drives...................................................................................................................................................................104

Paths....................................................................................................................................................................104

Shortcuts..............................................................................................................................................................105

File Names and Types..........................................................................................................................................105

3.4.2 File Allocation Table and NT File System.........................................................................................................106

Clusters and File Allocation Tables.......................................................................................................................106

FAT16...................................................................................................................................................................107

FAT32...................................................................................................................................................................108

NT File System.....................................................................................................................................................108

NTFS versus FAT...................................................................................................................................................108

NTFS.....................................................................................................................................................................108

FAT32...................................................................................................................................................................108

FAT16...................................................................................................................................................................108

Operating System................................................................................................................................................108

Windows XP.........................................................................................................................................................108

Windows 2000.....................................................................................................................................................108

Windows NT.........................................................................................................................................................108

Windows XP.........................................................................................................................................................108

Windows 2000.....................................................................................................................................................108

Windows 98.........................................................................................................................................................108

Windows ME........................................................................................................................................................108

Windows 95 OEM Service Release 2 (OSR2)........................................................................................................108

All versions of Microsoft Windows.....................................................................................................................108

DOS......................................................................................................................................................................108

Max Volume Size*................................................................................................................................................108

2 TB......................................................................................................................................................................108

32 GB...................................................................................................................................................................108

Page 6: iCarnecie SSD2 Book

2 GB.....................................................................................................................................................................108

Files per Volume*................................................................................................................................................108

~ 4 billion.............................................................................................................................................................108

~ 4 million............................................................................................................................................................108

~ 64,000...............................................................................................................................................................108

Max File Size*......................................................................................................................................................108

2 TB......................................................................................................................................................................108

4 GB.....................................................................................................................................................................108

2 GB.....................................................................................................................................................................108

Unit 4. Application Software........................................................................................................................................109

4.1 Software Basics..................................................................................................................................................109

4.2 Using Software Systems.....................................................................................................................................110

4.2.1 Lab: DOS Commands.......................................................................................................................................110

4.2.2 Lab: Macros....................................................................................................................................................111

4.2.3 Lab: Embedding Application Objects..............................................................................................................113

4.3 Batch Script Files................................................................................................................................................114

4.3.1 Advanced Command-Line Functions...............................................................................................................115

DOS Command Syntax.........................................................................................................................................115

Review of File System Commands.......................................................................................................................116

Wildcard Characters............................................................................................................................................117

Redirection and Piping.........................................................................................................................................118

4.3.2 Batch File Commands.....................................................................................................................................119

Batch Files............................................................................................................................................................120

Commands...........................................................................................................................................................120

4.3.3 Lab: Creating a Batch File................................................................................................................................121

Example of a Batch File........................................................................................................................................121

Example of a Batch File with Arguments.............................................................................................................122

4.4 Databases..........................................................................................................................................................123

4.4.1 Lab: Searching the Library of Congress...........................................................................................................124

4.5 Software Engineering.........................................................................................................................................124

4.5.1 Issues in Large-Scale Software Development..................................................................................................125

The Software Development Process....................................................................................................................125

Define or Redefine the Problem..........................................................................................................................126

Plan a Solution to the Problem............................................................................................................................126

Code the Solution................................................................................................................................................126

Page 7: iCarnecie SSD2 Book

Evaluate and Test Everything...............................................................................................................................127

4.5.2 Open Source Model........................................................................................................................................127

Free Software.......................................................................................................................................................127

4.5.3 Tools for Software Creation and Management...............................................................................................128

Editors..................................................................................................................................................................128

Compilers.............................................................................................................................................................128

Debuggers............................................................................................................................................................129

Integrated Development Environments (IDEs)....................................................................................................129

Unit 3 and Unit 4 Review Materials.............................................................................................................................129

Unit 5. Network Systems.............................................................................................................................................133

5.1 Internet Basics...................................................................................................................................................133

5.1.1 MIME Types....................................................................................................................................................133

5.1.2 Internet Languages.........................................................................................................................................134

HTML...................................................................................................................................................................134

XML......................................................................................................................................................................135

JavaScript.............................................................................................................................................................136

Java......................................................................................................................................................................137

5.2 Local and Wide Area Networks..........................................................................................................................137

5.3 Communication Strategies.................................................................................................................................137

5.3.1 Client-Server Framework................................................................................................................................138

5.3.2 Peer-to-Peer Connectivity...............................................................................................................................138

5.4 Data Transfer Technologies...............................................................................................................................139

5.5 Internet Architecture.........................................................................................................................................139

5.5.1 Routers and TCP/IP.........................................................................................................................................139

Internet Protocol.................................................................................................................................................140

Routers................................................................................................................................................................140

Transmission Control Protocol.............................................................................................................................140

5.5.2 Domain Name Service.....................................................................................................................................140

Naming................................................................................................................................................................141

Domain Name Service..........................................................................................................................................141

5.5.3 Connectivity....................................................................................................................................................142

Conventional Analog Phone Lines........................................................................................................................142

ISDN: Integrated Services Digital Network...........................................................................................................142

Cable Modem......................................................................................................................................................142

xDSL: Digital Subscriber Line................................................................................................................................142

Page 8: iCarnecie SSD2 Book

Dedicated High Speed Lines.................................................................................................................................143

5.5.4 Internet Service Providers...............................................................................................................................143

Unit 6. Computer Security...........................................................................................................................................144

6.1 Security Threats.................................................................................................................................................144

6.1.1 Intruders: Who, Why, and How?....................................................................................................................146

6.1.2 Identity Theft and Privacy Violation................................................................................................................147

Password Cracking...............................................................................................................................................148

Packet sniffing......................................................................................................................................................148

Social Engineering/Fraud.....................................................................................................................................149

Spoofing...............................................................................................................................................................149

Port Scanning.......................................................................................................................................................150

6.1.3 Malicious Software.........................................................................................................................................150

Virus.....................................................................................................................................................................151

Trojan Horse........................................................................................................................................................152

Worm...................................................................................................................................................................153

Prevention...........................................................................................................................................................153

Detection.............................................................................................................................................................153

Counter Measures...............................................................................................................................................154

6.1.4 Denial of Service.............................................................................................................................................154

Network Connectivity..........................................................................................................................................154

Network Bandwidth.............................................................................................................................................155

Other Resource Consumption Attacks.................................................................................................................155

Distributed Denial of Service Attack....................................................................................................................156

Prevention...........................................................................................................................................................157

6.2 Security Technologies........................................................................................................................................157

6.2.1 Encryption.......................................................................................................................................................158

Substitution Cipher..............................................................................................................................................158

Transmitting the Key............................................................................................................................................161

Private Key Encryption Scheme...........................................................................................................................162

Public Key Encryption Scheme.............................................................................................................................162

Hybrid Encryption Schemes.................................................................................................................................163

6.2.2 Applications of Encryption..............................................................................................................................164

Email....................................................................................................................................................................164

Hard Drives..........................................................................................................................................................164

DVD Movies.........................................................................................................................................................164

Page 9: iCarnecie SSD2 Book

Cellular Phones....................................................................................................................................................164

6.2.3 Authentication................................................................................................................................................165

Strong Passwords.................................................................................................................................................165

Smart Cards.........................................................................................................................................................166

Biometrics............................................................................................................................................................166

Digital Signatures.................................................................................................................................................167

Digital Certificates and Certificate Authorities.....................................................................................................169

SSL Protocol.........................................................................................................................................................172

6.3 Prevention, Detection, and Recovery................................................................................................................173

6.3.1 Firewall...........................................................................................................................................................174

Application Gateway............................................................................................................................................175

Packet Filter.........................................................................................................................................................175

Application Gateway versus Packet Filter............................................................................................................176

Hybrid..................................................................................................................................................................176

Intruder Attacks Prevented by Firewall................................................................................................................176

Setting up a Firewall.............................................................................................................................................177

6.3.2 Intrusion Detection Tools................................................................................................................................177

Intrusion Detection Systems................................................................................................................................177

Network Monitoring Tools...................................................................................................................................179

Anti-Virus Software..............................................................................................................................................180

6.3.3 Data Recovery.................................................................................................................................................180

6.3.4 Summary of Security Tips................................................................................................................................182

Unit 5 and Unit 6 Review Materials.............................................................................................................................184

Appendix A. Running a Visual Basic File...................................................................................................................185

Appendix B. Downloading WinZip Application.........................................................................................................185

SSD2 Reading Assignments (NOTE: updated for the 10th and 11th editions of the course reference textbook)....186

Page 10: iCarnecie SSD2 Book

This course provides an introduction to some of the most important features of present-day computer systems. You will learn how computers work and how they are used to solve problems. In order to concentrate your studies on one particular type of computer system, a Microsoft Windows-based personal computer is used as the primary example.

This course is organized into six units. Each unit contains information in the form of textbook readings, Web notes readings, and learning exercises designed to help you understand the material. Each unit also has several quizzes and a homework exercise, which allow you to demonstrate your knowledge of the material. There are three exams, one occurring after every two units. In the course Help pages, you can read about how to work through the quizzes, exercises, and exams. Please note that several of the pages in this course contain links to Web sites outside the iCarnegie site, and from time to time one or another of these sites become temporarily unavailable, causing the course links to them to fail.

Prerequisites

SSD1 (may be taken concurrently)

Course Textbook

June J. Parsons and Dan Oja, New Perspectives on Computer Concepts 10th Edition—Comprehensive, Thomson Course Technology, a division of Thomson Learning, Inc Cambridge, MA, COPYRIGHT © 2008; ISBN-10: 1-4239-0610-1, ISBN-13: 978-1-4239-0610-0.

OR

June J. Parsons and Dan Oja, New Perspectives on Computer Concepts 11th Edition—Comprehensive, Thomson Course Technology, a division of Thomson Learning, Inc Cambridge, MA, COPYRIGHT © 2008; ISBN-10: 1-4239-2518-1, ISBN-13: 978-1-4239-2518-7.

Important: Reading assignments are included at the start of each course section and are valid for any edition unless otherwise noted. You can also refer to Appendix C. Compiled Readings List for a complete listing of all course readings.

Hardware/Software Requirements

Microsoft Windows-based machine To see movie files in 1.2.2 Applications of Computer Systems, Windows compatible sound card and

speakers (or headphones) are needed.

To complete Exercise 3, Visual Basic 6.0 or Visual Basic 6.0 Run-Time Files are required. Refer to Appendix A. Running a Visual Basic File for instructions on running a Visual Basic file.

To complete Optional Exercise 1, Microsoft Access 2000 or higher is required.

To complete Exercise 3, WinZip application is required. Refer to Appendix B. Downloading WinZip Application for instructions to download WinZip application.

The purpose of SSD2 is for students to

1. Learn the fundamentals of using and maintaining computer systems in an Internet environment.

Page 11: iCarnecie SSD2 Book

2. Learn the basic components and functions of a computer and network.

3. Become familiar with procedures and software tools for system operation and maintenance.

4. Gain exposure to future trends.

Students successfully completing SSD2 will be able to

I. Produce 1. Appropriate system configurations based on the intended use

2. Informed selections of peripheral devices

3. Informed selections of software

4. Backup schedules for computer systems

5. Batch files and macros

6. Configurations of operating systems (OS), basic input/output systems (BIOS), Web browsers, and networks

II. Use 1. Uniform resource locators (URLs) to map to Internet protocol addresses (IP addresses)

2. Virus protection software

III. Knowledgeably Discuss 1. Computer hardware (processors, memory, buses), concepts for measuring computation (bits,

bytes, megahertz, instructions per second [IPS], storage capacity), and peripheral devices (video cards, keyboards, mouse devices, printers)

2. Operating system architecture and device management (virtual memory, multitasking)

3. Software development and engineering

4. Applications software, including user interfaces, database systems, and Internet applications

5. Network architecture, such as local area networks (LANs), wide area networks (WANs), network topologies, Ethernet cards, modems, network protocols, name resolution, and client/server architectures

6. The Internet, including services and trends

7. Maintenance of system integrity, including disk backups, security, and power

8. Risk management of a computer system, covering viruses, Trojan horses, worms, and encryption

IV. Hold Positions

Page 12: iCarnecie SSD2 Book

Those who certify in this course will understand the fundamentals of computer systems and networks. This includes the ability to automate simple tasks on the computer, such as designing and creating macros. Students who certify in this course will have the background knowledge and skills to hold positions in computer sales, to work as purchasing coordinators for computer equipment, and to work as computer consultants for small businesses.

*This material is to be used in conjunction with New Perspectives on Computer Concepts 10th Edition—Comprehensive, or 11th Edition —Comprehensive, published by Thomson Course Technology, a division of Thomson Learning, Inc. All images with the Thomson Learning logo are used with the permission of Thomson Learning. They may not be copied, scanned, cut, pasted, altered, revised, modified, or adapted in any way without the prior written permission of Thomson Learning.

Page 13: iCarnecie SSD2 Book

Unit 1. Computer Systems

Computer Systems are enabled by many subsystems, namely, the hardware subsystem, the software subsystem, and the network subsystem. Understanding how these subsystems work together will help you understand how a computer system works as a whole. In this unit, you will see a high-level view of a computer system broken down into these sub-components and learn about the primary role each of the sub-systems play. You will then learn about each sub-system in subsequent units in this course.

In order to gain insight into the next step of computer advancement, it is also important to know how computers came about, and how they have evolved. And, unless you know how computers can be used, their power may not be apparent. To expand your perspective on the application of computer systems, we include some interesting examples of how computers can be used. Perhaps you will discover a computer-related career path that fits your interest.

After getting the "big picture" about how computers work and how they can be used, you should read about the development of the computing industry and the job outlook in this field in your textbook. Before moving onto the next unit, which delves into the details of hardware systems, we will explain the fundamental concept of computer systems, representing data using numeric encoding.

1.1 Overview of Computer Systems

This section provides a top-level view of the different components in a computer system. You will also obtain a basic understanding of how a computer works using its sub-components.

Reading Sequence:

1.1.1 Components of a Computer System . Learning Goal: To gain a general overview of computer system components, the hardware system, the software system, and the network system.

Parsons/Oja, Chapter 1-Section B. Learning Goal: Knowledge of the basic computer operations (input, processing, and output).

Questions for your reading: Upon completing this reading, test your understanding by trying to answer the following questions:

-What different kinds of computers are available?-How can you add optional equipment to a computer?-Why is it useful for computers to be able to communicate with each other?-Why do you think devices like monitors, printers, and keyboards are called "peripherals"?

Optional: Parsons/Oja, Chapter 1-Lab: "Operating a Personal Computer". Learning Goal: Knowledge of the process involved in turning on a computer and having it run a program.

1.1.1 Components of a Computer System Hardware System Software System — Operating System Software and Application Software

Network System

Page 14: iCarnecie SSD2 Book

A computer is an electronic machine that performs input, processing, storing, and output according to programmed instructions to carry out specific tasks. Formerly, computers were used primarily to do arithmetic computations, hence the term, computer. Consider the primitive form of a computer, a calculator. You input the numbers and the arithmetic operation you need the calculator to perform, for example, “3+5=”, and then the calculator processes the arithmetic expression by adding 3 and 5, stores the result of 8, and outputs the result onto the display area.

The modern computer operates in a similar fashion. Input to a computer can be sent through the keyboard or mouse. The computer then processes the input, stores the result, and displays the result via the monitor, speaker, printer, or other output devices. For example, when you request for a web page by typing in its URL (Uniform Resource Locator), "http://www.icarnegie.com", the computer processes your input by fetching the requested page over the Internet. It then displays the fetched page on your monitor as output.

In general, a computer system can be decomposed into the hardware system, the software system, and the network system. Each of these subsystems will be discussed in more detail in subsequent units of this course. The figure below illustrates the major subsystems in a computer system with some examples.

Figure 1 Components of a computer system

Let us now look at each subsystem and their main functionality.

Hardware System

Page 15: iCarnecie SSD2 Book

The hardware system consists of external and internal physical components that enable a computer to accept input, process the input, store data, and produce outputs. Each of the hardware components will be discussed in more detail in Unit 2. Hardware Systems.

The figures below show some external hardware components of a computer.

Figure 2 Hardware components

The diagram below indicates the hardware components inside the system unit. Each of these components plays an essential role in the operation of a computer system.

Page 16: iCarnecie SSD2 Book

Figure 3 Components inside the system unit

Hardware components provide the physical interface to a computer system. However, they cannot function without instructions to operate them. These instructions are software programs.

Software System—Operating System Software and Application Software

The two different types of software programs are (1) operating system software and (2) application software. The diagram below illustrates the levels of interaction among users, application software, operating system software, and the hardware system.

Page 17: iCarnecie SSD2 Book

Figure 4 Interaction among hardware system, operating system software, application software, and users

The operating system software serves as the interface between application software and the hardware components. And, the application software interfaces with the users of the computer system.

Operating system software provides instructions to hardware system components. Examples of operating systems are the Microsoft Windows operating system and the Macintosh operating system. When an input is entered, the operating system program provides instructions to send the input to appropriate hardware components for processing. Then, it provides instructions for the result to be sent to the appropriate output device. For example, when a user types using a keyboard, the Microsoft Windows operating system takes the input sent through the keyboard and displays the typed letters on the monitor. You will learn more about how operating system software works in Unit 3. Operating System Software.

Application software provides instructions that enable the user to perform specific tasks such as creating presentations, composing written documents, and editing images. Examples of application software programs are Microsoft Word and Notepad. Application software instructions are handled by the operating system. For instance, when you open a file using Microsoft Word, first the application provides the user-interface for you to specify which file you want to open (for example, the menu bar). Once you have selected the file, the application notifies the operating system that a certain file is needed. The operating system then requests for the file from the hard drive of the computer. You can view the application software currently on your computer by clicking on the Start button and select Programs. If you are reading this page online, then you are probably using the Internet Explorer or Netscape web browser program. More about how application software works will be discussed in Unit 4. Application Software.

Network System

The worldwide system of computer networks is the Internet, a network of networks. Via the Internet, computers on the network can access other computers on the network. The Internet allows data to be moved from one computer to another.

The network system manages how data is transferred from one computer to another and how different components of a network system work together. The diagram below illustrates the network components needed for a computer to communicate to other computer via the Internet.

Page 18: iCarnecie SSD2 Book

Figure 5 Network connection components

A network interface card (NIC) sends data from a computer over a network, and collects incoming data sent by other computers. A modem is a device that enables data from a computer to be transmitted via phone lines or television cable lines to reach other computers on the Internet. In addition to these hardware network components, a computer also needs an Internet service provider such as America Online to enable its connection to the Internet. Application software such as Web browsers (for example, Internet Explorer and Netscape) and electronic mail (for example, Outlook and Netscape Mail) also enhance the usefulness of a network system. More about how the network system works will be discussed in Unit 5. Network Systems.

1.2 Evolution of Computer Systems

In this section, you will learn about both the origins and the advancements of computer technology. Then you will explore innovative uses of computers to enhance different aspects of our lives. You may also discover how computers can be helpful in your field of interest, whether it is education services, medical research, business management, or entertainment. At the end of this section, you can read about the computer industry, which has become a major segment of the world economy, generating many types of career opportunities and businesses.

Reading Sequence:

1.2.1 Brief History . Learning Goal: Understand the origins and the advancements of computer technology. Parsons/Oja, Chapter 9-Section A. Learning Goal: Knowledge of the history of computing and computers.

1.2.2 Applications of Computer Systems . Learning Goal: Gain a broad understanding of how computers can be used to enhance different aspects of our lives.

Parsons/Oja, Chapter 9-Section B. Learning Goal: Knowledge of the computer and IT (information technology) industries and their impact on the modern world markets, product life cycles, and market tiers.

Parsons/Oja, Chapter 9-Section C. Learning Goal: Knowledge of the different careers available in the computer industry.

In Addition: There are several popular websites for job seekers. After completing this reading, go to Monster.com and click Search Jobs to search for computer-related jobs in your area. First, in the Location Search box, select a location near you, and then enter a keyword such as "programmer" or

Page 19: iCarnecie SSD2 Book

"database" in the Keyword Search box.

1.2.1 Brief History 1200s—Manual Calculating Devices 1600s—Mechanical Calculators

1800s—Punched Cards

1940s—Vacuum Tubes

1950s—Transistors

1960s—Integrated Circuits (IC)

1970s to Present—Microprocessor

Pace of Advancement

As commerce developed in earlier societies, people began to realize the need for a bookkeeping system to enable them to add, subtract, and record simple transactions. To facilitate the bookkeeping process, counting devices were developed. At first, people used fingers, stones, and sticks to count. Later on, mechanical calculators emerged, but they were slow and bulky. When electricity was discovered, electronic components replaced the bulky mechanical parts and enabled smaller, faster computing devices. Computers are continually evolving towards faster computations, increased storage capacity, and smaller size, while maintaining their affordability.

With advancements in computing devices, the uses of computers have gone beyond the scope of commerce and they are integral to many aspects of our lives. Purchases are processed through computers. Products are designed using computers. Movies are made with computer simulations. The growth of the computing industry is driven by the numerous ways computing technology can be applied in areas such as commerce, communications, banking, and education. In the next section, we will discuss how computer technology can be used.

We will begin our discussion on how computers developed by examining periods in time characterized by its pioneering research to bring computing to solve data-intensive or compute-intensive problems. You will see how computing methods advanced to where we are today.

1200s—Manual Calculating Devices

Manual calculating devices required the use of hands to move components on the device.

The first calculation device, the abacus, was used in China. It involved manually moving beads to do calculations. Below is a picture of an abacus.

Page 20: iCarnecie SSD2 Book

Figure 1 Abacus

1600s—Mechanical Calculators

Mechanical calculators used wheels, gears, and counters.

1642: Blaise Pascal invented the Pascaline, which is a mechanical calculator. The machine used some principles of the abacus, but used wheels to move counters.

1800s—Punched Cards

Punched cards use holes following a specific pattern to represent the instructions given to the machine or stored data. The idea of storing data and program instructions on punched cards came from the Jacquard loom. It used pasteboard cards with patterns of punched holes to produce mass quantity of fabrics weaved in a variety of patterns. Each punched card represents a pattern and the punched card can be fed through the Jacquard loom to produce weaved fabrics of the pattern repeatedly. Similarly, different program instructions can be stored on separate punched cards, which can be fed through the computing machine repeatedly. Using punched cards, program instructions and data can be stored.

1834: Charles Babbage designed a new general-purpose calculating device, the Analytical Engine, which is the ancestor of modern computers. It included the essential components of present-day computers, which are input, process, storage, and output of data.

Babbage's assistant, Augusta Ada King, Countess of Lovelace and daughter of English poet Lord Byron, would create the instruction routines stored on punched cards to tell the machine what to do. Instruction routines used by the computer are known as "computer programs." She is thus the first female computer programmer, and in her honor, the U.S. Defense Department named the programming language ADA.

Below is an image of an analytical engine.

Page 21: iCarnecie SSD2 Book

Figure 2 Analytical engine

1890: Herman Hollerith designed an electronic punched card tabulating device that enabled the U.S. Census Bureau to tabulate the 1890 census in six months, which would have otherwise taken more than 7 years. Hollerith’s machine used punched cards to store data instead of instruction routines.

1896: Hollerith thought the business world could benefit from the electronic punched card tabulating device, and founded Tabulating Machine Company, which later became International Business Machines (IBM) in 1924.

1940s—Vacuum Tubes

Vacuum tubes are used to control the flow of electrons. Since vacuum tubes responded faster than mechanical components, faster computations were possible. But, the tubes consumed a lot of power and burned out quickly.

Below is a picture of vacuum tubes.

Page 22: iCarnecie SSD2 Book

Figure 3 Vacuum tubes

1945: The first computer prototype using vacuum tubes, ENIAC (Electronic Numerical Integrator and Computer) was designed to calculate trajectory tables for the U.S. Army during World War II, but it was not completed until three months after the war.

The machine was 100 feet long and 10 feet high and weighed 30 tons. It had over 18,000 vacuum tubes. But, in the first year, a total of 19,000 tubes burned out and were replaced. The ENIAC could perform 5,000 additions per second, but its operation has to be programmed manually by connecting cables and setting 6,000 switches.

The first commercially successful computer, UNIVAC was developed by Eckert-Mauchly Computer Corporation (later acquired by Remington Rand). The machine was 14.5 feet long, 7.5 feet high, and 9 feet wide. It could read 7,200 characters per second. It was priced at $930,000. Another important development was the invention of the compiler by Admiral Grace Hopper who was working at Eckert-Mauchly Computer Corporation at the time. A compiler enables program instructions to be written in English and then translated into a language that the machine can understand. This invention made the task of programming easier and faster.

1950s—Transistors

Transistors performed functions similar to vacuum tubes but they were smaller, cheaper, and more reliable. Additionally, they consumed less power. The ability for transistors to replace vacuum tubes was first demonstrated in AT&T’s Bell Laboratories. Transistor-based computers could perform 200,000 to 250,000 calculations per second.

Transistors are also used in other electrical devices such as the radio. Below is a picture of a radio and transistors.

Figure 4 Transistors

1960s—Integrated Circuits

An integrated circuit, also called a "microchip" or "chip," is a thin slice of silicon packed with microscopic circuit elements such as wires, transistors, capacitors, and resistors. It was developed in 1958 by Jack Kilby at Texas Instruments and independently by Robert Noyce at Fairchild Semiconductor. Integrated circuits enabled the equivalent of thousands of vacuum tubes or transistors to be packed onto a single miniature chip

Page 23: iCarnecie SSD2 Book

about the size of your fingernail, reducing the physical size, weight, and power requirements for devices such as computers. Computers became ever smaller as more components could fit onto the chip. More information about the IC chip can be found at the Smithsonian Institute's Jerome and Dorothy Lemelson Center for the Study of Invention and Innovation.

1970s to Present—Microprocessor

The microprocessor combined components of a computer on a microchip. Before the microprocessor was developed, each integrated circuit had to be manufactured for a particular purpose, but now a microprocessor can be manufactured and then programmed for various purposes to other needs. Below is a picture of a microprocessor. Note that millions of wires are etched onto an area the size of a fingernail.

Figure 6 Microprocessor chip

The first general-purpose microprocessor was the Intel 4004. It was developed in 1971 by Ted Hoff. The Intel 4004 enabled microprocessor-based computer systems to become faster, smaller, and less expensive than before.

Pace of Advancement

Transistors are still continuing to decrease in size. As transistors become smaller, more transistors can be placed on a given chip. This implies faster processing speeds and greater data storage capacity. In 1965, Gordon Moore, a founder of Intel, one of the largest microchip manufacturers, made his observation that there is an exponential growth in the number of transistors per integrated circuit. He predicted that the number of transistors that can be put on a microchip will double every 12 months, until physical limitations are reached. This observation was termed "Moore’s Law." Now the exponential growth has slowed down to doubling every 18 months, nevertheless, the rate of growth is still exponential. The figure below shows the number of transistors on a microchip increasing exponentially. More about Moore’s Law will be explained in page 2.5.1 Moore’s Law.

Page 24: iCarnecie SSD2 Book

Figure 7 Moore's Law applied to Intel processors [Moore's Law, The Future - Technology & Research at Intel]

Year of Introduction Transistors

4004 1971 2,250

8008 1972 2,500

8080 1974 5,000

8086 1978 29,000

286 1982 120,000

386TM processor 1985 275,000

486TM DX processor 1989 1,180,000

Pentium® processor 1993 3,100,000

Pentium II processor 1997 7,500,000

Pentium III processor 1999 24,000,000

Pentium 4 processor 2000 42,000,000

Itanium 2 processor 2002 220,000,000

Table 1 Number of transistors used in Intel processors over the years [Intel Research Site]

Page 25: iCarnecie SSD2 Book

1.2.2 Applications of Computer Systems In Education

o Multimedia-Facilitated Learning

o Simulation-Based Education

o Intelligent Machine-Based Training

o Interactive Learning

In Business

o Supply Chain Management

o Project Management

o Customer Relationship Management

o Sales and Marketing Using Electronic Commerce

o Manufacturing Research

In Entertainment

o Movies

o Video Games

o Music

o Digital Photography

o Travel

o Wearable Computer Systems

Computer systems are instrumental in improving our lives in many ways. You will see in the following examples how the innovative use of computers can enhance how we learn, conduct business, and enjoy life. As you begin to explore the applications of computer systems, think about how you can use or develop computer technologies in your own field of interest.

In Education

Multimedia-Facilitated Learning

Multimedia is defined by Webopedia as "the use of computers to present text, graphics, video, animation, and sound in an integrated way." Software applications such as Microsoft PowerPoint allow lectures to be conducted with animated visual aids. Educational software applications can be used to enhance students' learning by providing an interactive, multimedia environment that can be more engaging. Students can click on buttons on the computer screen to access different sections of the learning material. An example of this can be found on the Intel education site (requires Flash Player). Computers can help enrich students' learning experience.

Page 26: iCarnecie SSD2 Book

Simulation-Based Education

Computers can be programmed to generate images and animations that model other systems. These systems can be those that exist in the physical world in which we live (for example, people and objects), as well as those from the imagination (e.g. life on the moon and mythical beings). For example, the Sim Theme Park program allows users to design their own roller coasters, and provides the option to turn off gravity. Simulations can also be used to emulate scenarios that may be too dangerous to practice with real people. Pilots often use simulations when learning about new equipments. Furthermore, computers can be used to model elements that are hard to observe such as molecular structures. You will see how simulations can help learning in the following examples.

The Talking Head below demonstrates how it may be used in language training. The Talking Head realistically simulates the head of a human being, with a computer-synthesized voice that sounds human-like. Click on the image below to see a demonstration of how 3-D imaging and voice simulation can assist in language learning in ways that may not be achievable in the real world.

Figure 1 The Talking Head

Courtesy of Dominic Asarco, Professor of Psychology, University of California- Santa Cruz

Other examples of simulation-based training discussed below are medical training, molecular modeling, and military training.

• Medical Training

In the U.S. army, a 3-D virtual reality (VR) software is used to help measure and improve the effectiveness of medical training in the field. The software enables students to practice trauma assessment and treatment on wounded soldiers using their computer. This would eliminate the need to send trainees to the field and expedite the training process. Details about the training software can be found in the article, "3-D Training Software Helps Army Compare Medical Training Methodologies".

A joint research project in surgical simulation was conducted by Millers University’s Haptics research group and Penn State University’s College of Medicine. The project aimed at developing software that can be used to simulate a suite of surgical procedures. Using a virtual reality surgical simulator that provides sensitive

Page 27: iCarnecie SSD2 Book

touch feedback along with realistic 3D imagery (virtual reality), medical students and surgeons will be able to practice and test their surgery skills. This would decrease consumption of resources such as organs and physical surgery spaces.

Below is an image of a medical student at the deformable organs simulation station using a pair of scissors.

Figure 2 Student using simulation tool

The student sees the image below- a deformable stomach and the scissors that the student uses to interact with the visual simulation.

Figure 3 Deformable stomach being manipulated by a virtual scissors

© Copyright 2002 Department of Computer Science, Millersville University Reprinted with permission.

• Molecule Modeling

Researchers from the Department of Biochemistry and Molecular Biophysics in Columbia University and the Howard Hughes Medical Institute use a software visualization tool, Graphical Representation and Analysis of Structural Properties (GRASP), to create 3-D models of chemical molecules and explore their properties.

Below is a screenshot of a DNA simulation.

Page 28: iCarnecie SSD2 Book

Figure 4 DNA modeling

© Copyright 2002 Barry Honig's group in the Department of Biochemistry and Molecular Biophysics of Columbia University and the Howard Hughes Medical Institute.Reprinted with permission.

Visual simulations of molecules can also be animated to show how they change over time. See recordings of molecule simulations. More visual simulations for studies in Chemistry can be found at http://www.csc.fi/chem/gallery.phtml.

An interdisciplinary applied research center, CRS4 (Center for Advanced Studies, Research and Development in Sardinia), is developing simulation techniques to create visual models in the various fields including medical imaging, fluid dynamics, environment modeling, and more. See CRS4’s Animation Gallery.

• Military Training

Page 29: iCarnecie SSD2 Book

3-D simulations can be used build virtual environments that replicate the interior of military crafts to train engineering officers for material readiness assessment. Using simulations, physical crafts do not need to be used during training, and the number of people that can be trained at one time is not limited. Additionally, training can be provided to persons in different geographic locations. You can learn more about the benefit of virtual reality simulations in training on the Education & Training Technology page from Research Triangle Institute (RTI)

Below is a screenshot of a virtual environment built by Research Triangle Institute (RTI) using 3-D simulation software from Sense8.

Figure 5 Virtual training for military personnel

© Copyright 2001 Research Triangle Institute.Reprinted with permission.

Intelligent Machine-Based Training

Computer systems can be programmed to react based on user behavior. For example, to facilitate learning a foreign language, researchers at Carnegie Mellon University developed Fluency: Automatic Foreign Language Pronunciation Training software that can interpret pronunciations and provide feedback on how we pronounce a word and how to correct the pronunciations.

Page 30: iCarnecie SSD2 Book

Figure 6 Language training software

© Copyright 2002 Language Technology Institute, Carnegie Mellon UniversityReprinted with Permission. (Note: This software has a patent pending and has been licensed through the CMU Tech Transfer Office exclusively to the Carnegie Speech Company, a spin-off of Carnegie Mellon University.)

Interactive Learning

Music composer and inventor Tod Machover at the MIT Media Lab and Media Lab Europe started Toy Symphony, an international music performance and education project aimed at introducing children to new ways to make music. The project involves using Music Toys to engage children in listening, performing, and music-composing tasks. Children can play along with some of the world's most accomplished musicians who are participating in this project.

Below is an image of one of the toys. Read about what it does.

Page 31: iCarnecie SSD2 Book

Figure 7 Beatbug music toy

© Copyright 2002-2003 MIT Media LabReprinted with permission.

In Business

Supply Chain Management

Supply chain management aims to manage and track the supply of raw components, their usage in the manufacturing process, and delivery of finished products to customers. Some supply chain management software applications use mathematical algorithms to improve the flow of the supply chain and minimize inventory. You can read more about Supply Chain Management.

Project Management

Product development information, which includes product requirements, work schedules, project milestones, budgets, and product design need to be organized and tracked to monitor the progress of the project. Software applications are capable of keeping track of the product database, work schedule, and budget of the project to help you pinpoint potential barriers to the timely completion of the project. You can see some project management software system demos provided by Microsoft (requires Macromedia Flash Player and Microsoft Internet Explorer).

Customer Relationship Management

Customer relationship management (CRM) is a process that gathers information about the customer base, marketing effectiveness, and market trends in order to learn more about customers' behaviors. A CRM software system can collect information about customer demographics, and investigate customer-purchasing behaviors with the objective of predicting customer needs and increasing revenues.

A CRM system may involve the use of an "Intelligent Agent," which is a program that collects information about a user's behavior, and customizes the content on a website accordingly. For example, when you go to Amazon.com, the site can generate a personalized page for you that contain advertisements of products that may interest you based on your purchasing history. If you had bought a novel in the Harry Potter children's fiction series, then your Amazon page may advertise other Harry Potter volumes or other books about adolescent adventure that you have not purchased.

Page 32: iCarnecie SSD2 Book

You can learn more about CRM by reading some CRM Case Studies.

Sales and Marketing Using Electronic Commerce

Using the Internet, commerce can be conducted online through the World Wide Web. To enable electronic transactions, a company would need software for generating purchase orders or quotation requests, process invoices, build marketing material, mechanism to respond to customers and process orders, and keep track of customer-purchasing behaviors. Additionally, some commercial websites allow you to customize your own product. For example, Nike's website enables you to purchase shoes designed by you. You can choose different color combinations for your shoe. You can even specify personalized text to be placed on the shoe.

Manufacturing Research

Computer simulation tools can be used to design products. For example, in automobile tire research, simulation tools can be used to estimate braking distances of tires under various road conditions and tire tread patterns. Researchers from Pusan National University (J.R. Cho, H.W. Lee and W.S. Yoo) have used computer simulation and published their results in a paper titled A wet-road braking distance estimate utilizing the hydroplaning analysis of patterned tire in the International Journal for Numerical Methods in Engineering. Volume 69 Issue 7.

Find out more about software applications for businesses.

In Entertainment

Movies

Computer-generated special effects have made possible the creation of award-winning films such as Star Wars: Episode II, Jurassic Park, Men in Black, Jumanji, Forrest Gump, and the Perfect Storm.

In particular, Star Wars: Episode II was the first major motion picture to be shot entirely on digital cameras. The production team saved time and money usually invested in film stock and photochemical processing by using digital cameras. Traditionally, images shot on film had to be scanned and transformed into digital media to incorporate visual effects. Digital cameras facilitated the process of transferring movie images from different stages of production.

You can read about how movie effects are incorporated using computer technology by Industrial Light & Magic, the company that created the visual effects for the first Star Wars movie.

Video Games

The video gaming industry has advanced greatly from the simple black and white dotted images of video game characters from the 70s to the life-like 3-D simulations of video game creatures. Video game systems are computer systems integrated with sophisticated video imaging technology to bring a world of fantasy to life on your computer screen. You can browse through a sample video game website.

Music

Distribution of music in the 20th century has evolved from analog to digital form. Music can be downloaded from Internet sites and stored in hand-held size MP3 players. This expanded the volume of music selections that can be stored and played. You can read about how MP3 Players work.

Page 33: iCarnecie SSD2 Book

Digital Photography

More and more people are using digital cameras instead of conventional film cameras. All digital cameras have a built-in computer that records images in electronic form. Images can be viewed immediately after they have been captured, and they can be uploaded onto a computer or exchanged over the Internet. You can read about how digital cameras work.

Travel

Researchers at the School of Computer Science, Carnegie Mellon University have created software that reads Chinese signs and translates them into English using only a palm-size computer equipped with a small camera. Find out more about the sign translation technology.

Figure 9 Sign translation device

© Copyright 2002 interACT, Carnegie Mellon University 2002Reprinted with permission.

Wearable Computer Systems

Computer systems can also be embedded in devices that are more portable such as a wristwatch or a headphone. For example, a GPS (Global Position System) can be embedded in your wristwatch to help you find directions to a specific destination. You can read about fashion-oriented accessories that incorporate technology being developed at Carnegie Mellon University, and wearable technology developed at MIT Media Lab.

For additional applications of computer systems current being investigated, you can read about research at Carnegie Mellon University and research at MIT Media Lab.

1.3 Data Representation in a Computer System

Computers represent data using 0's and 1's, also known as binary numbers. Why do computers use binary notation instead of the more familiar decimal notation (using digits 0-9) that people use? Each digit, whether binary or decimal, must be represented by a voltage in the computer's circuitry. It is easy to build circuits that discriminate between two voltages. We could call these voltages "on" and "off." It is much harder, though not impossible, to build circuits to discriminate reliably among ten different voltages.

Page 34: iCarnecie SSD2 Book

Reading Sequence:

Parsons/Oja, Chapter 1-Section C. Learning Goal: Knowledge of the basics of computer hardware and binary notation.

1.3.1 Bits and Bytes . Learning Goal: Knowledge of how data is represented using binary digits of 0's and 1's. Also, learn about how data storage capacity is described using typical units of measure used over the years.

1.3.2 Number Systems . Learning Goal: Knowledge of numbering systems used to represent data in computing.

1.3.1 Bits and Bytes Data Representation Using Binary Digits Increasing Need for Bytes

Data Representation Using Binary Digits

A piece of data, such as an alphabet letter, may be represented using a sequence of binary digits- 0's and 1's. There are several types of codes used to represent character data. For example, using extended ASCII (America Standard Code for Information Interchange) code, the alphabet letter "a" can be represented using a series of eight binary digits, "01100001." Each binary digit is called a bit. And, eight bits is one byte. Extended ASCII code uses eight bits (or one byte) to represent input characters. Below are binary representations of characters in extended ASCII code.

Figure 1 ASCII code

Page 35: iCarnecie SSD2 Book

All data, including audio, visual, and program instruction data can be represented and stored using a sequence of binary digits, or a sequence of bytes. Recall that a file is a collection of data. In some files, the bits of data directly encode individual letters, numbers, and punctuation symbols that make up words and sentences. In other files such as an image file, the bits of data need to be computed in order for them to transform to images that we can interpret.

Most applications such as Microsoft Word or PowerPoint encode information in specialized ways that are not readable by humans. Thus, even though Microsoft Word is often used to edit text, a Word document cannot be properly displayed by a simple text editor like Notepad because the document includes information in a format specific to Microsoft Word. Therefore, it must be opened by Microsoft Word to be read. Some files have a header section that indicates which format was used to encode the data in order to allow the computer to reassemble the binary data back into the human-readable form of the document.

Increasing Need for Bytes

In the late 1970s and early 1980s, inexpensive personal computers were manufactured for the first time, and soon a large consumer market developed. At first small amounts of memory such as thousands of bytes were all that was needed to handle the simple spreadsheet and word processing tasks. But, before long, users wanted software to allow them to do more tasks such as creating drawings and generating complex page layouts. As consumer demand grew, computing requirements also grew. This demand led to new developments that expanded memory capacities. By the mid 1980s, memory was up to millions of bytes. Today, office and home computers often have billions of bytes in memory capacity. Memory for data-intensive systems, such as the Geographic Information System (GIS), require trillions of bytes. Below is a chart illustrating the storage capacity over the years since the 1970s with their associated prefix and abbreviation.

Decade 1970s 1980s 1990s 2000s

Order of magnitude in

Storage capacityThousands Millions Billions Trillions

Prefix Kilo (103) Mega (106) Giga (109) Tera (1012)

Abbreviation K M G T

In terms of storage, more is better—which means more information in the form of both data and programs that act on that data can be stored. Corresponding to the growth in storage capacity, memory capacity is also increasing. Moreover, memory technologies are getting smaller, lighter, and faster, for about the same price. You will learn more about storage and memory technologies in the next unit of this course.

1.3.2 Number Systems Decimal Binary

Hexadecimal

Learning Exercise

Page 36: iCarnecie SSD2 Book

The world of computing uses several number systems to represent data. While the decimal system, also known as base10, will be familiar to people, as it is the numbering system used in everyday life, binary (base2) and hexadecimal (base16) are common number systems used in computing today.

Decimal

We will start our discussion on number systems by examining the decimal system as an example of a number system. The decimal number system contains ten values- 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each number in the decimal number system can be broken into digits by their "place" in the number. Using the number 43,872 as an example, 2 is in its 0th place, 7 is in its first place, 8 in its second, 3 in its third, and 4 in its fourth. Each place has a value that can be represented either exponentially or by its decimal values. The following table shows the exponential and decimal representation for each place in the number 43,872.

Place 4th 3rd 2nd 1st 0th

Digit 4 3 8 7 2

Exponential value of the place 104 103 102 101 100

Decimal value of the place 10,000 1,000 100 10 1

Table 1 Exponential and decimal values corresponding to a digit's place in a number

Note that the exponential values are raised to a power corresponding to the place of the digit. For example, the exponential value of the 4th place is 104.

To determine the value of the number, multiply the digit contained in a column by the value that column represents. The following is a sample calculation for the previous example.

4 × 104 + 3 × 103 + 8 × 102 + 7 × 101 + 2 × 100 =4 × 10,000 + 3 × 1000 + 8 × 100 + 7 × 10 + 2 × 1 =40,000 + 3000 + 800 + 70 + 2 =43,872

While performing these calculations on a decimal number seems trivial, it demonstrates a pattern, or formula can be used to convert a number in any numbering system to decimal.

dp(b)p + dp-1(b)p-1 + . . . + d0(b)0

Where p is the place, b is the base, dp is the digit in the highest place in the number, and dp-1 is the next highest place in the number, and so on.

Using the number example above, dp = 4, dp-1 = 3, b = 10, and p = 4.

4 × 104 + 3 × 103 + 8 × 102 + 7 × 101 + 2 × 100 = 43,872

The formula above can be used to compute the decimal value of any number in a given base. Below is the calculation for converting 214 to its decimal value:

Place 1st 0th

Page 37: iCarnecie SSD2 Book

Digit 2 1

Exponential value of the place 41 40

Decimal value of the place 4 1

Table 2 Exponential and decimal values corresponding to a digit's place in a number

2(4)1 + 1(4)0 =2× 4 + 1 × 1 =8 + 1 =9

So far, we have only discussed converting numbers to decimal. It is also important to be able to convert numbers from decimal to other numbering systems. Continuing with the base4 system, let us convert 89 from decimal to base4.

First, find the value p, where 4p < = 89 < 4p+1. In this case p = 3. p is the value of the highest place.

Now we can proceed by filling out the following chart:

Place 3 2 1 0

Exponential value of the place 43 42 41 40

Decimal value of the place 64 16 4 1

Calculation89 ÷ 64

25 ÷ 16 9 ÷ 4 1 ÷ 1

Result 1 1 2 1

Remainder 25 9 1 0

Table 3 Converting numbers from base 10 to base 4

Therefore, 8910 = 11214.

We are now going to review binary and hexadecimal more closely.

Binary

Since all numbering-systems are treated the same, you already have all the tools necessary to convert to and from binary. Let's review converting from binary to decimal the number 101101102.

The highest place, p, is obtained by counting the number of places in the binary number, starting from zero. In this case, p = 7.

1 × 27 + 0 × 26 + 1 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20 =1 × 128 + 0 × 64 + 1 × 32 + 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 0 × 1 =

Page 38: iCarnecie SSD2 Book

128 + 0 + 32 + 16 + 0 + 4 + 2 + 0 =182

For example, in 1001102 the largest place is 2p, where p = 5. Because binary is the easiest numbering system to convert into decimal, it will help us later when we are convert hexadecimal numbers.

Hexadecimal

You should notice that it takes more digits to express a value in binary notation than in decimal notation. For example, the number 99 in decimal is 1100011 in binary. Computer professionals have adopted hexadecimal notation as shorthand for binary so that they can express binary values more concisely.

Hexadecimal (base16), or "hex," is most likely the largest numbering system that you will work with. In the modern decimal system, the Arabic number set 0-9 has to be supplemented by additional values to represent the decimal equivalents of 10, 11, 12, 13, 14, and 15. Instead of inventing new symbols to represent these numbers, the letters A-F are used. Hexadecimal is represented by the set of numbers 0-F. While both lower case and upper case letters can be used in hexadecimal for A-F. In this course, we will use upper case A-F. Hexadecimal, however, is not usually represented by appending a 16 as a subscript to the number. There are two differing formats for representing hexadecimal numbers: prepending 0x or appending h. We will use 0x to denote hexadecimal numbers.

Place 4 3 2 1 0

Exponential value of the place 164 163 162 161 160

Decimal value of the place 65,536 4096 256 16 1

Table 4 Exponential and decimal values corresponding to a digit's place in a number

There are two methods for converting hexadecimal into decimal. There is the direct approach using the formula:

p(b)p + dp-1(b)p-1 + . . . + d0(b)0

Where dp is the digit in the highest place in the number, and dp-1 is the next highest place in the number, and so on. b is the base and p is the value of the highest place.

The conversion is as follows:

4 × 163 + A × 162 + 3 × 161 + F × 160 =4 × 4096 + 10 × 256 + 3 × 16 + 15 × 1 =16,384 + 2560 + 48 + 15 =19,007

This method is particularly useful for larger hexadecimal numbers. However, for smaller numbers of one or two digits, it is often faster to convert the hexadecimal number to binary before converting it to decimal. Hexadecimal maintains a relationship with binary as it is a derivative of a base2 system. Each hexadecimal digit represents four binary places. The chart below shows the relationship between binary, hexadecimal, and decimal for 0x0-0xF.

Decimal Binary Hexadecimal

Page 39: iCarnecie SSD2 Book

0 0000 0x0

1 0001 0x1

2 0010 0x2

3 0011 0x3

4 0100 0x4

5 0101 0x5

6 0110 0x6

7 0111 0x7

8 1000 0x8

9 1001 0x9

10 1010 0xA

11 1011 0xB

12 1100 0xC

13 1101 0xD

14 1110 0xE

15 1111 0xF

Table 5 Decimal, binary, and hexadecimal conversions

Let us convert 0x3B to decimal via binary. The first step is to find out what the individual hexadecimal number represents in binary. Replace the hexadecimal number with the binary number. Therefore, 0x3B becomes 001110112. As you may recall from the previous section on binary, converting numbers from binary to decimal is much easier than with other systems, since multiplying by binary digits of 0 and 1 are trivial.

0x3B=001110112=32 + 16 + 8 + 2 + 1 =59

Page 40: iCarnecie SSD2 Book

A byte of data (eight bits) can be written as just two hex digits. For example, the character "N" in extended ASCII code has the binary representation 01001110. If we write this as two groups of four bits each, we get 0100.1110. Using table 5 above, we find that 0100 is 0x4 and 1110 is 0xE. Therefore, the corresponding hexadecimal code for 0100.1110 is 0x4E.

When setting up or maintaining a computer system, you will sometimes encounter hexadecimal numbers as representations of memory addresses, network addresses, or other hardware-related qualities. You may encounter them in operating system-related contexts as well, such as when a machine "crashes" and displays a failure report.

Learning Exercise

You can experiment with conversions between binary, decimal, and hexadecimal using the Microsoft Calculator accessory.

Using the Windows operating system, click the Start button, select Programs, then select Accessories, and then select Calculator. To perform the functions required in this exercise you must click the calculator's View menu and select Scientific.

To use the calculator for data conversion, click its Dec radio button to put the calculator into decimal mode, type a number, and then click the Hex radio button to convert the number to hexadecimal. You can convert from hexadecimal to decimal as well; the A-F keys are enabled whenever you are in hexadecimal mode.

What is the hexadecimal representation of the number 255? What is the decimal equivalent of 0x4D2?

Unit 2. Hardware Systems

This unit covers computer hardware—the components that make up a computer system and how they work together. First, you will learn about how the computer processes information and how memory works. Then you will learn about how data can be moved among components inside and outside the system unit. You will also become familiar with different media for storing data. By the end of this unit, you should have a basic understanding of how a computer works. Understanding this unit will also help you become an informed consumer of computer equipment.

Reading Sequence:

2.1 Processor and Memory 2.2 Peripherals

2.3 Storage Devices

2.4 Putting Together the Hardware Components

2.5 Improving Computer Performance

Assessments:

Exercise 2

To guide you through the hardware components that will be covered in this unit, the diagram below illustrates a top-level view of the components in a computer system.

Page 41: iCarnecie SSD2 Book

Figure 1 Component overview

The microprocessor, also called the processor, is the main component that executes instructions stored in the main memory. The microprocessor is sometimes referred to as the "brain" of the computer system, making decisions and sending commands to the other components to complete a set of instructions. The main memory stores instructions to be executed by the microprocessor. The data stored in main memory is lost when the computer is turned off. In contrast to main memory, storage devices such as CD-ROM drives and floppy disk drives store data permanently even when the computer is turned off.

Peripherals enable data input and output. Examples of peripheral devices include the monitor, the printer, the keyboard, and the mouse. The peripherals also include mechanisms that allow data to be transferred in and out of a computer system.

The chipset acts as the traffic cop controlling the flow of data and coordinating interactions among components in the system. Components pass data through the chipset, and the chipset monitors the data flow and passes data to other components.

We will now visit an example of how these components work together. In this example, the computer system completes a request to open a file and display the opened file on the monitor. The following four steps are taken to complete the task:

1. The microprocessor sends instructions to the storage devices (via the chipset) requesting the specified file to be loaded into main memory.

2. The storage devices send the file through the chipset to main memory.

3. The microprocessor fetches the file contents from main memory.

4. The microprocessor sends the display data to the monitor via the chipset.

Page 42: iCarnecie SSD2 Book

Below is a diagram of the data flow between components.

Figure 2 Data flow in a computer system

In each section of this unit, you will learn more about the major components illustrated in the diagram above and gain more in-depth understanding of how these components work together. To help you become familiar with the physical appearance of hardware components, the image below illustrates the major components inside a system unit. The image is followed by brief descriptions of components labeled in the image.

Page 43: iCarnecie SSD2 Book

Figure 3 Components inside a computer

A. Motherboard

Provides sockets for microprocessor and memory chips, slots for circuit boards, and the circuitry that enable electrical signals to travel from component to component. Most of the hardware components inside the system unit are attached to the motherboard.

B. Power supply

Provides electrical power to the computer system.

C. Microprocessor

Processes instructions stored in main memory. Sometimes, the microprocessor is found underneath a cooling fan to prevent it from overheating.

D. Expansion slot

Serves as a socket on the motherboard into which an expansion card maybe inserted.

E. Expansion card

Enables a computer to control peripheral devices such as the monitor and the microphone.

F. Chipset

Controls data flow among components.

G. IDE (Integrated Drive Electronics) cable

Page 44: iCarnecie SSD2 Book

Transfers data from storage devices to the motherboard.

H. Disk drives

Stores data permanently (even after the computer is turned off). They may be any drives such as floppy disk drive, the CD-ROM/CD-RW, DVD-ROM/DVD+/-RW drive, and the hard disk drive.

2.1 Processor and Memory

The processor and memory are essential components that enable a computer to process commands. The processor carries out instructions given to the computer. These instructions are stored in the computer's memory. In this section, you will learn how the processor executes instructions and the different types of memory a computer has.

Reading Sequence:

2.1.1 Processor Basics . Learning Goal: Obtain general knowledge of how a microprocessor works in a computer and become familiar with different types of microprocessors. Gain more knowledge about microprocessor performance and about tools called "benchmarks" that are used to compare the performance of different microprocessors.

Parsons/Oja, Chapter 2-Section B. Learning Goal: Knowledge of the central processing unit (also "CPU" or just "processor") and different types of computer memory. The CPU runs your programs by performing numerical and logical operations. The CPU also controls the operation of the computer's memory and peripheral devices.

Caution: In Parsons/Oja, Chapter 2-Section B under READ-ONLY MEMORY, the text reads, "The instructions in ROM are permanent, and the only way to change them is to replace the ROM chip." This statement is no longer completely valid because modern ROM chips are EEPROM (Electrically Erasable Programmable Read Only Memory). EEPROM allows the user to upgrade the information contained on the chip via an electrical process, while still maintaining its nonvolatile status.

2.1.2 Types of Memory . Learning Goal: Knowledge of different types of memory used in a computer.

2.1.3 Lab: Benchmarking (Optional) . Learning Goal: To gain a practical understanding of benchmarking software and tests.

 

Parsons/Oja, Chapter 2-Computers in Context: "Military".

2.1.1 Processor Basics Processor Instruction Execution with the CPU

Performance: Factors and Measures

Types of Processors

Processor

A computer's processor is usually referred to as the microprocessor due to its size, which is about the size of your fingernail.

Page 45: iCarnecie SSD2 Book

Figure 1 Microprocessor chip

A microprocessor processes all the instructions given to the computer (for example, add two numbers, execute program instructions, or print documents). Physically, the microprocessor is a single chip known as an integrated circuit (IC). Each chip is made out of silicon and it contains millions of transistors packed onto a chip.

The Intel Pentium M Processor, introduced on March 12, 2003, has 77 million transistors, and the width of the smallest wire on the chip is 0.13 micron, or 0.00000013 meter. As a reference, 0.13 micron is about 1/800 of the width of a human hair.

The microprocessor is referred to as the Central Processing Unit (CPU). The job of a microprocessor is to execute a series of machine instructions. These instructions are procedures to carry out a task written in a form that the computer can understand.

Instruction Execution with the CPU

Instructions are stored in the computer's memory, RAM (random access memory), which will be covered in section 2.1.2 Types of Memory.

There are two main components of the CPU. One is the control unit, which accesses instructions stored in RAM, interprets what they mean, and then dispatches them. The other is the Arithmetic/Logic Unit (ALU) that performs arithmetic (i.e. addition, subtraction, multiplication, division) and logic (i.e. greater than, less than, equal to) operations needed to process the instructions.

There are four steps that the CPU performs when executing an instruction; they are called the fetch-execute cycle. The four steps are as follows:

1. Fetch - The control unit gets the instruction from memory.

2. Interpret - The control unit decodes what the instruction means and directs the necessary data to be moved from memory to the ALU.

3. Execute - The control unit directs the ALU to perform the necessary arithmetic or logic operations.

4. Store - The result of the computation is stored in memory.

The diagram below illustrates the steps taken by the CPU to execute an instruction that adds two numbers. The instruction is: Let R = X + Y.

Page 46: iCarnecie SSD2 Book

Figure 2 Fetch-Execute cycle

Another component of the microprocessor is the cache, a special high-speed memory that stores most recently used data in order to speed up the process of instruction execution. A cache can speed up data retrieval because recently used data is likely to be used again by the computer.

Level 1 (L1) cache memory or primary cache memory is located on the CPU to provide the CPU with the fastest access to data. There is also a slower cache, the Level 2 (L2) cache memory or secondary cache, located between the RAM and the CPU (sometimes on the CPU). If data cannot be found on either cache, it will be retrieved from RAM. Relative to the physical distance between the CPU and storage areas for data and instructions, data is retrieved more quickly from the L1 cache, then the L2 cache, and then the RAM.

The figure below illustrates how parts of a microprocessor fit within the other components in a computer.

Page 47: iCarnecie SSD2 Book

Figure 3 Microprocessor view

Performance: Factors and Measures

The rate at which instructions are processed is controlled by an internal clock, also known as the system clock. The internal clock sends pulses at a fixed rate to synchronize all computer operations. The unit of measure for cycles per second is the hertz (Hz). One Hz means one cycle per second, one kHz (kilohertz) means one thousand cycles per second, and one MHz means one million cycles per second. Computer clock cycles are closely related to the execution of instructions. So, a 3 GHz Pentium 4 machine can execute more instructions per second than a 2 GHz Pentium IV machine. The greater the hertz, the faster the execution speed.

As processors have become faster and storage capacity increased, it has become feasible to perform more tasks than before. For example, near-instantaneous spellchecking can be done as the user types out a word, whereas years ago, this was not practical. Due to limited processing resources, older processors could not enable a user to type while verifying spelling.

A fetch-execute cycle does not necessarily correspond rigidly to the execution of a fixed number of instructions. Sometimes it takes two or more cycles to execute an instruction. And, today's computers sometimes execute multiple instructions in a single cycle.  Thus, the number of instructions completed is independent of the number of cycles used. Sometimes machines are compared on the number of instructions per second (IPS) rather than on raw clock speed; this measure depends on both the number of cycles per second and what kind of instruction mix (set of instructions) is executed. A machine that is fast at financial calculations may not perform as well on a graphics application, since the instruction mix is different.

Page 48: iCarnecie SSD2 Book

Instructions can differ a great deal. Some complex instructions require a lot of cycles and take a comparatively long time to execute. Other instructions may be very simple and execute in very little time. For example, a division operation takes longer than an addition operation. Although the IPS rating is not the best method of comparison, it can be useful when comparing similar chips.

Another measure of computer performance is its bandwidth, the volume of data that can be transmitted within a fixed amount of time between components in a computer system (such as the transfer speed from the disk to the motherboard) or through connections to other computers. Bandwidth is expressed in bits per second (bps), or sometimes bytes per second (Bps) (recall that 8 bits equals 1 byte).

Different machines, however, should be compared by executing a standard suite of instructions with execution times carefully measured and recorded. This is a more careful way to measure machine performance, and it is known as benchmarking– comparing disparate systems or components via a standardized set of instructions or series of tasks. Benchmarking can test anything from just the processor to executing office applications. The comparison is measured by the time it takes to execute these instructions. For example, Intel benchmarks its Pentium III processors based on the processors' performance of a variety of tasks, and so does Advanced Micro Devices with its processors. You can view various benchmark results comparing AMD and Intel processors.

In general, it is good practice to ask which benchmarks are used in performance claims. For example, a benchmark that tests graphics speed may be irrelevant if the types of graphical applications you use are different from those used in the test. It is important to assure that comparisons or claims are based on the same benchmarks. Benchmarking results by unbiased, independent organizations are especially useful.

Types of Processors

Intel is a well-known microprocessor vendor. Microprocessors produced by Intel became popular with the highly successful IBM Personal Computer (PC), introduced in 1981.  The IBM PC used the early members of the Intel x86-microprocessor family and the Microsoft Disk Operating System (MS-DOS), giving Intel and Microsoft early market share and increased product recognition.  The progression of Intel PC processors, with a few variations, has gone from the 8086, through the 80286 (or just 286, as the 80 is often dropped), the 386, and the 486.  The 586 was renamed the Pentium for legal and marketing reasons.  Among the Pentium family are the Pentium Pro, the Celeron, and the Pentium II, III, IV, M, and Xeon. Read about the history of Intel microprocessors. Find out about the latest processors developed by Intel.

Companies such as Advanced Micro Devices (AMD) now market processor chips that are compatible with the Pentium family. These chips, called "Pentium clones," are typically less expensive and sometimes even faster than Intel's products. There is an ongoing battle among chip manufacturers to provide the fastest processors at the lowest cost. Although Intel retains the majority of the market share for Pentium-type processors, chips from other vendors are finding increasing acceptance, especially in less expensive systems designed for home use. Read about AMD's processors.

Another widely-used processor architecture is the PowerPC used in the Macintosh family of computers. The PowerPC was based on IBM's architecture and then modified by Motorola and Apple. Database servers storing large amounts of data are sometimes built around the SPARC family of processors developed by Sun Microsystems. On the smaller side, there are many specialized processor chip families created for embedded applications, such as automobiles or cellular phones. A cell phone is actually a moderately powerful computer with a radio transmitter as its main peripheral device. If you are interested, you can find out about how a cell phone works.

There are also some Web sites that compare CPU specifications and CPU prices. If you come across unfamiliar terms, there are reference resources on the Web such as Geek.com or Webopedia. When

Page 49: iCarnecie SSD2 Book

comparing processors, keep in mind that some processors with a "mobile" or a "-M" label in its name indicate that they can be used for laptops. For example, AMD Mobile Duron and Mobile Athlon XP are for laptops. Processors for laptop computers generally have slower processing speeds, in exchange for lower power consumption and longer battery life. Intel's "mobile" or "-M" processors are for laptops, and Transmeta processors are mostly for laptops.

2.1.2 Types of Memory RAM ROM

CMOS Memory

Summary

Memory components include the main memory, also known as RAM, and the memory components needed to boot or start a computer, ROM and CMOS. Each of these memory components will be discussed in the following pages.

The figure below shows a top-level view of the different types of memory.

Figure 1 RAM, ROM, and CMOS

RAM

RAM (random access memory) is a temporary holding area for both data and instructions. It is also referred to as main memory. RAM stores data and instructions needed to execute programs. The data in RAM is lost

Page 50: iCarnecie SSD2 Book

when the computer is turned off. In contrast to accessing data serially, searching sequentially for the data to be retrieved, data in RAM can be accessed directly via its address. Therefore, RAM stands for "random access memory." Random access is similar to accessing a song on a CD directly via its track number, as opposed to finding a song serially on tape.

RAM is measured by its memory capacity and latency.

Capacity is the maximum number of bits or bytes that can be stored. The capacity of RAM is typically measured in megabytes (MB). Many computers have RAM capacity of 128MB or more.

Latency is the delay between the time when the memory device receives an address and the time when the first bit of data is available from the memory device. This delay is also referred to as access time. Latency is typically measured in nanoseconds (ns), billionth of a second (10-9 sec). Latency measures the speed of RAM.

Two major categories of RAM called DRAM and SRAM are discussed below.

DRAM - Dynamic RAM is a common type of RAM. It is made of an integrated circuit (IC), composed of millions of transistors and capacitors. A capacitor can hold electrons, just as a cup can hold water. An empty capacitor represents a zero, and a non-empty capacitor represents a one. Each capacitor can register either a zero or a one for a memory cell, storing one bit of data. The transistor is like a switch that controls whether the capacitor's state (charged or not charged, 1 or 0) is to be read or changed. Changing the state of a capacitor is like writing new data to a memory cell. However, a capacitor is like a cup that leaks, in order to keep its charge, the memory control needs to be recharged or refreshed periodically. Therefore, it is called the dynamic RAM because its state is not constant. Refreshing capacitors also takes time and slows down memory.

There are several types of DRAM, one is SDRAM (Synchronous Dynamic RAM) used in many personal computers. It is fast and relatively inexpensive. It is synchronized to the clock so that data can be sent to the CPU at each tick of the clock, increasing the number of instructions the processor can execute within a given time. Below is a picture of SDRAM configured as a series of DIPs (dual in-line packages), which has two rows of pins that connect the IC circuitry to a circuit board. The entire circuit board shown is called a DIMM (dual in-line memory module).

Figure 2 SDRAM circuit board

A faster version of SDRAM is DDR SDRAM (Double Data Rate SDRAM), which transfers twice the amount of data per clock cycle compared to SDRAM. Its capacity is up to 2 GB.

Page 51: iCarnecie SSD2 Book

Another type of DRAM is RDRAM (Rambus Dynamic RAM), which has a higher bandwidth than SDRAM, but it is more expensive compared to SDRAM. The high bandwidth enhances the performance of applications that access large amounts of data through memory, i.e. real-time video and video editing. You can learn more about RDRAM.

SRAM - Static RAM is a type of RAM that uses transistors to store data. Because SRAM does not use capacitors, reading data from SRAM does not require recharging the capacitors. Therefore, it is faster than DRAM. But, because it consists of more electronic parts, it holds fewer bits and costs more compared to DRAM of the same size. SRAM is appropriate for use in the cache because it is fast and cache does not require a large memory capacity.

The following chart lists the relative capacity and price of the types of RAM mentioned above.

Type of RAM Capacity Price

SDRAM @@ $

DDR SDRAM @@@ $

RDRAM @@@ $$

SRAM @ $$$

Table 1 Comparing different types of RAM

You can learn more about RAM in the white paper, "A Basic Overview of Commonly Encountered Types of Random Access Memory (RAM)." A table comparing different types of RAM can be found on page 20 of the PDF document.

ROM

Read-only memory (ROM) is programmed with data hard-wired when it is manufactured. Data and instructions on a ROM are permanent, or nonvolatile, which means they are not lost when power is turned off. Why is ROM needed when RAM enables all the memory operations necessary for a computer? Because data in RAM is lost when the computer is turned off, some instructions are needed for the CPU to start or boot the computer when the computer is first turned on. Therefore, ROM contains a set of instructions that is needed to start the computer. These instructions tell the computer how to access the hard disk, find the operating system, and load it into RAM. Then RAM stores all subsequent instructions to be executed by the CPU.

Typically, ROM is hardwired with start-up instructions for the computer. At one time, changing the boot instructions (for example, to integrate a new video card and disable the old one) on a ROM required replacing the entire ROM chip. Currently, a type of ROM, electrically erasable programmable read-only memory (EEPROM), can be updated by applying an electrical field changing instructions stored on the chip one byte at a time. This could slow down the update process.

An alternative to EEPROM is flash memory. Flash memory is a type of EEPROM that rewrites data in chunks, usually 512 bytes in size, instead of 1 bit at a time.

CMOS Memory

Page 52: iCarnecie SSD2 Book

Configuration settings of a computer such as storage capacity, memory capacity (RAM), and display configurations also need to be stored permanently. This information is stored in CMOS (complementary metal oxide semiconductor) memory. The CMOS chip requires very little electrical power to hold data. It can be powered by a small battery on the motherboard, or packaged with the chip. The battery maintains the data on the CMOS when the computer is turned off.

More about the role of BIOS and CMOS in booting a computer will be discussed later in unit 4: Operating System Software.

Summary

The decision diagram below indicates under what circumstances each memory device is needed.

Figure 3 Memory decision tree

The chart below shows the different memory devices including the register, which stores the results of CPU operations. The chart also lists the relative price, memory capacity, latency, and location of each device.

Memory Cost Capacity Latency Location

Register $$$$ 8-128 bitsalmost

instantaneousOn CPU close to the ALU

L1 Cache $$$ 1-100 KB ~1 ns On the CPU

L2 Cache $$ 100-1000 KB ~1 ns Between the L1 cache and

Page 53: iCarnecie SSD2 Book

the RAM

DRAM $ 1-1000 MB ~10 nsOutside the CPU on the motherboard

Table 2 Comparing memory devices

2.1.3 Lab: Benchmarking (Optional)

Benchmarking, which is the process of running standardized tests upon differing configurations to determine the speed of components or software was briefly mentioned in 2.1.1 Processor Basics. This lab will give you a greater understanding of benchmarks by having you download Fresh Diagnose, an application that allows you to analyze and benchmark your computer system. You will use the software to compare the benchmarking results of your processor with those of your classmates.

Note: This lab is to be performed on Intel-based computers running Windows 95/98/NT4/2000/XP/ME.

Learning Exercise:

Download Fresh Diagnose and install it. (1102 kb download) Run the application.

Click on Benchmarks on the left-hand side menu.

Pick Processor Benchmark and click on Start on the upper-right corner of the application screen.

Compare your results with those of your classmates.

Try another benchmark and compare your results with those of your classmates.

You can also explore your system's properties through the other options on the left-hand side menu.

2.2 Peripherals

In addition to the microprocessor and the memory, a computer also has other devices such as the monitor, printer, keyboard, and speakers. These peripheral devices are connected via ports to the computer. Buses inside the system unit transport data among components in a computer and connect all peripheral devices to the CPU and memory. In this section, you will learn about the various types of ports and buses. You will also become familiar with some important peripheral devices of a computer.

Page 54: iCarnecie SSD2 Book

Reading Sequence:

2.2.1 Connecting Peripherals . Learning Goal: Knowledge of how components such as expansion slots, expansion cards, and types of connectors and ports used to transfer data between peripherals and the computer system.

Parsons/Oja, Chapter 2-Section D . Learning Goal: More in-depth knowledge of expansion slots, cards, and ports in a computer system.

2.2.2 Buses . Learning Goal: Familiarity with types of bus standards used to transfer data within a computer.

2.2.3 Input/Output Devices . Learning Goal: Knowledge of various types of input and output devices. Some input devices discussed are digital cameras and webcams. Some output devices discussed are monitors and printers.

Parsons/Oja, Subsections "Installing Peripheral Devices," "Display Devices," and "Printers" in Section 2D. Learning Goal: Knowledge of the different types of printers and monitors available.

Parsons/Oja, Chapter 8-Sections A-D. Learning Goal: Knowledge of how visual and audio digital equipments work.

2.2.1 Connecting Peripherals Expansion Slots and Cards Ports

USB and FireWire

Comparing Different Ports

An expansion slot is a slit-like socket on the motherboard into which a circuit board can be inserted. The circuit board is called the expansion card; it is used to extend the capability of a computer. Examples of an expansion card include the sound card and the video card. An expansion card also provides port(s), which are connector(s) between the expansion card and the peripheral device. A port can also be built into the system unit case of a computer, such as a mouse port.

A number of different ports were needed to connect different peripheral devices, until the advent of standardized universal ports, such as Universal Serial Bus (USB) port and FireWire port. Because these universal ports are being widely used, they are replacing the need for other ports.

See the diagram below for how peripheral devices and their connectors attach to other components in a computer.

Page 55: iCarnecie SSD2 Book

Figure 1 Peripheral devices and their connectors

Expansion Slots and Cards

An expansion slot is a socket on the motherboard where expansion cards can be plugged into. An expansion card, also referred to as "expansion boards," "controller cards," or "adapters," is a small circuit board that enhances the functionality of a computer by enabling a computer to control storage devices, input devices, or output devices. Examples of expansion cards include graphics cards (or video cards) and sound cards.

The image below shows an expansion card being inserted into an expansion slot.

Page 56: iCarnecie SSD2 Book

Figure 2 Inserting an expansion card into an expansion slot

The two most common types of expansion slots are Peripheral Component Interconnect (PCI) and Accelerated Graphics Port (AGP). A PCI slot can hold a variety of expansion cards such as a sound card or an Ethernet card (discussed later in this section).An AGP slot is primarily used for graphics cards (see discussion on graphics cards below).

In laptops, a PCMCIA (personal computer memory card international association) slot, which is relatively smaller than a PCI slot, fulfills the role of a PCI slot. Typically, a notebook computer is equipped with PCMCIA slots for expansion cards also called CardBus cards or PC cards.

Some commonly used expansion cards are:

Graphics card- transforms images into analog data that we perceive as light when displayed on the computer monitor. A graphics card is also known as the video card. A graphical image on the monitor is composed of many colored dots, or pixels. In order to display an image on the screen, image data is represented as colored pixels. Each color is indicated by an RGB value, a mix of red, green, and blue colors.

A graphics card has its own memory and processor that handles computations necessary to convert image data to be displayed into pixels on the monitor. More specifically, to display a 3-D image, the graphics card first rasterizes the image, or convert the 3-D image into a 2-D representation of the image using geometric conversion algorithms. Each pixel in the 2-D representation has an RGB (red, green, and blue) value to indicate its color. The graphics card then converts the RGB value of each pixel into analog data to enable the monitor to project the colored pixels that we recognize as the 3-D image.

Sound card- allows a computer to play sounds such as music from CDs, sound files, games, or DVDs. It can also record sounds from a microphone, cassette player, or CD player. The sound card is usually plugged into the Peripheral Component Interconnect (PCI) slot, or its functionality may be integrated as part of the chipset on the motherboard.

In order for the computer to record sounds, which are analog waveform signals, the analog signals are converted into digital signals. For instance, to record a sound input through a microphone onto a .wav file and save it on hard disk, sounds in analog waveform are converted into digital data. The data is then sent

Page 57: iCarnecie SSD2 Book

through the bus to the processor, which routes the data to the hard-disk controller, and the hard-disk controller sends the data to the hard-disk drive to be saved there as a .wav file.

Modem- one type of modem is the dial-up modem, which enables a computer to exchange information with a remote computer through ordinary telephone lines. Generally, data in binary form is sent out through a modem, which converts the binary data into analog data before transmitting it through a phone line or a cable line. A modem at the receiving end converts the analog data back into digital data to be used by the computer at the receiving end. A dial-up modem can transfer data at a rate up to 56 kilobits per second (Kbps) from the Internet to the computer.

Ethernet card- serves as the interface to a Local Area Network (LAN), a common network technology allowing users access to network resources such as the Internet, email, shared printers, etc. at a rate of 10 Mbps (more about LAN will be discussed in Unit 6). Newer versions of Ethernet called "Fast Ethernet" and "Gigabit Ethernet" support data rates of 100 Mbps and 1 Gbps (1000 Mbps).

Below are images of Ethernet cards. The one on the left is an Ethernet card used to plug into the PCMCIA slot of a laptop computer. The one on the right is an Ethernet card for a PCI slot in a desktop.

Figure 3 Ethernet cards for PCMCIA slot and PCI slot, respectively

Ports

An expansion card usually includes ports, which are connectors that enable signals to be passed in and out of a computer or peripheral device to exploit the functionality of the expansion card. For example, a video

Page 58: iCarnecie SSD2 Book

card provides a monitor port. Ports can also be built into the motherboard of a desktop or a notebook computer. Similar ports can be used to plug in peripheral devices such as the mouse and the keyboard.

The image below shows the ports on the back of a computer.

Figure 4 Ports on the back of a computer

A PS/2 port is also known as a serial port. A serial port transfers data one bit at a time. It uses a 6-pin, mini-DIN configuration, which looks like a small, round port. The first appearance of this port was on the IBM PS/2 system, and since then it has become the de facto standard for keyboard and mouse connections. However, the PS/2 ports are gradually being replaced by USB ports.

Another type of serial port is the DB-9 port. It is also becoming obsolete. PDA devices used to connect to DB-9 ports before the advent of USB ports. Other devices that can be connected to a DB-9 port are the external modem and the barcode scanner, in general, older electronic devices.

In contrast, a parallel port transfers one byte at a time. The port connection on the system is DB-25F, requiring a 25-pin male connector (DB-25M) on the cable. A DB-25F port can be used for printers or external drives. A parallel port is typically used to connect a computer to a printer, which uses a different kind of connector than does the computer.

USB and FireWire

Universal Serial Bus (USB) ports now appear on desktop systems and laptops. Up to 127 devices can be connected to the system unit via a USB hub, which provides multiple USB ports. These devices include mouse, keyboard, scanner, printer, digital camera, and hard disk drive. One of the most convenient features of a USB port is its support for "hot connectivity," which allows peripherals to be connected to the system, configured, and used without restarting the machine. Due to USB's ease of connectivity and its ability to standardize many different devices into one cabling specification, USB has become the replacement for serial and parallel ports.

Page 59: iCarnecie SSD2 Book

Compared to USB 1.1, FireWire has a faster data transfer rate, and it supports up to 63 devices. FireWire is intended for data-intensive devices such as DVD players and digital camcorders. Peripheral devices can be connected via chaining. It also supports "hot connectivity." However, it is relatively more expensive than USB.

The peak data transfer rate for USB 1.1 was 12 Mbps, and the peak data transfer rate for FireWire 400 (1394a) is 400 Mbps. In response to Firewire's fast data transfer rate, USB 2.0 was developed with a peak data transfer rate of 480 Mbps. To compete with USB 2.0, FireWire 800 (1394b) was developed with a peak data transfer rate of 800 Mbps.

Parsons/Oja, Chapter 2-Section D, Figure 2-49 of the course textbook lists some of the cable connectors that peripheral devices use to connect to system ports.

Comparing Different Ports

Below is a chart listing the relative price, usage, and status of ports. The ports are listed from fastest to slowest data transfer rate.

Port Usage Status

FireWireCamcorder and external mass storage (e.g. CD-ROM, hard drive, etc.)

Becoming the standard for digital video devices

USB Most devicesBecoming the standard for most peripheral devices

Parallel Printer Becoming obsolete

Serial Modem Becoming obsolete

PS/2 Keyboard, mouse Becoming obsolete

Table 1 Comparison of ports

2.2.2 Buses

Your textbook highlights several ways to transfer information to and from the CPU. While some information transfers are completely internal to the CPU, all others, such as those between the CPU and RAM or between the CPU and peripheral devices, go through some type of bus.

The illustration below indicates how the physical bus lines are connected to components inside a system unit.

Page 60: iCarnecie SSD2 Book

Figure 1 Buses labeled on component overview diagram

A bus is a pathway through which data is transferred from one part of a computer to another. It consists of the data bus and the address bus. The data bus transfers the data itself, while the address bus transfers information about where the data is to go. Every bus has a width, a speed, and a transfer rate. The width, also called the word size, of a bus is measured in bits. An 8-bit bus has eight transfer pathways that are one bit wide, meaning eight bits of data may be transferred simultaneously. The larger the word size, the more data a bus can transfer at one time. A bus with a 64-bit word size can transfer eight times more data a second than can an 8-bit bus operating at the same speed.

The speed of a bus is measured in hertz (Hz), or cycles per second.

Transfer rate is the measure of how much data may be moved from one device to another in one second. Data traveling through the bus can pass through expansion slots, cards, ports, and cables. For buses that may be X-pumped and/or Y-channeled, the peak transfer rate is the word size (in bytes) * speed * X * Y.

One way to enhance data transfer rate is to transfer data multiple times during a cycle. In the chart below, X-pumped indicates that data can be transmitted X times in a cycle. Another way to increase the amount of data transferred is to increase the number of channels used to transfer data. Y-channeled indicates that Y data channels are used to transfer data. Also, the closer a component is to the chipset, the faster the data can be transferred to the chipset.

Page 61: iCarnecie SSD2 Book

The tables below lists various buses named according to the device that the data passes through.

Bus Type Front side RDRAM DRAM PCI AGP IDE USB FireWire

Width (in bits) 64 16 64 32-64 32 8 1 1

Speed (MHz) 66-200 533 66-200 33-66 66-528 33-133 variable variable

X-pumped 1-4 2 1-2 N/A N/A N/A N/A N/A

Y-channeled N/A 1-2 N/A N/A 1-2 N/A N/A

Distance from chipset

<0.1m <0.1m <1m <1m<1m <10m

<10m

Peak transfer rate

528MBps-6.4GBps

2.1-4.3 GBps

528MBps-6.4 GBps)

132-528 MBps

264MBps-2.1GBps

33-266 MBps

12-480 Mbps

400-800 Mbps

Table 1 Comparison of buses

The following sections give more information on the various buses listed above.

The front side bus, listed first in the above table, is the bus on the motherboard that transfers data between the CPU and the chipset. While there are many older system buses, the chart lists information for Pentium-class processors. In modern computers, there is a great mismatch between the speed of the system bus and the internal speed of the much-faster CPU. This means that one of the major obstacles to faster processing is system bus transfer rate.

RDRAM bus and DRAM bus are examples of memory buses. Because the CPU fetches instructions and data from RAM, the smaller the difference between bus speeds of CPU and RAM, the more efficient the processing. Therefore, memory buses are often X-pumped or Y-channeled in order to increase its data transfer rate to match that of the CPU.

The next two buses in the table above are associated with the two common types of expansion slots found on motherboards, Peripheral Component Interconnect (PCI) and Accelerated Graphics Port (AGP). An expansion slot that used to be common was the Industry Standard Architecture (ISA). ISA was the original bus standard for data transfers from expansion cards to the system bus. The word size or width of the data path on the ISA bus is 16 bits, running at a mere 8 MHz. It is now replaced by the speedier PCI (PCI Express), developed by Intel. For additional reading, the following web site has more information: Intel's PCI Express Architecture.

The major impetus for this advancement was graphics and networking cards. Previously, the capabilities of graphics and networking cards were limited by ISA's slow speed. The word size for a PCI bus is 32 bits (standard), running at 33 MHz—giving PCI up to 133MBps of bandwidth. PCI is now the predominant bus for newer systems, most of which no longer offer any ISA slots. However, ISA slots still remain in many machines to allow for the migration of older expansion cards (such as, for example, a specialized sound-synthesizer card) into current systems.

The Accelerated Graphics Port (AGP) is a bus architecture like PCI, but it provides a video card with rapid access to the system memory. To date, AGP has been used only for graphics cards, especially those that

Page 62: iCarnecie SSD2 Book

perform texture-mapping onto three-dimensional renderings. AGP is a very speedy port, running at 66 MHz with a 32-bit word size, and transferring 266 MBps. Newer machines are advertised with 2x/4x/8x AGP ports. This means the overall throughput is increased by a factor of two to 533 MBps, by a factor of four to 1.07 GBps, and by a factor eight to 2.14 GBps. Such speeds allow video card designers to access data from the main memory of the computer and require less video RAM to support the card's operations.

The IDE bus is the interface that transfers data between storage devices and the chipset. More about IDE will be discussed later in this unit.

While most buses listed in the table and in other course materials are specified in terms of word size, speed, and transfer rate, the USB (Universal Serial Bus) and FireWire (IEEE 1394) buses are specified in different terms. They transfer data one bit at a time at a variable pace; they are not rated with a MHz speed. The only rating factor for these serial buses is peak transfer rate.

USB 1.1 is faster than standard serial connections, with a peak transfer rate of 12 Mbps. While USB is considered a low-speed bus and is designed to handle low to medium-speed peripherals, FireWire's extremely high transfer rate is designed for high-speed external peripherals such as DVD-ROM and hard disk drives.

An extension to USB 1.1 is USB 2.0, which supports data rates up to 480 Mbps versus the 12 Mbps in USB 1.1. USB 2.0 is fully compatible with USB 1.1; the same cables and connectors can be used for both USB specifications. To stay competitive, FireWire 800 (IEEE 1394b) emerged with data rates up to 800 Mbps, double that of FireWire 400 (IEEE 1394a).

2.2.3 Input/Output Devices Input Devices

o Cameras

o Digital Camcorders

o Scanners

Output Devices: Monitors and Projectors

o CRT Monitors

o LCD Monitors

o Projectors

Output Devices: Printers

o Ink Printers

o Dye-Sublimation Printers

o Laser Printers

o Comparing Printers

Input Devices

The most common input devices are the mouse and the keyboard. With increased available bandwidth and speed, and decreased cost, other types of input devices are becoming more widely used. Some of them are briefly discussed below:

Page 63: iCarnecie SSD2 Book

CamerasDigital Camera

Enables photos taken to be stored in digital form, which can uploaded onto a computer.

Web Camera (webcam)

Captures live video and sends the compressed image stream to the computer or to other computers via the Internet. Compressing an image reduces the size of the image data, as well as the quality of the image. The more compression used, the poorer the image quality. It is often used to send images in real time as in a video teleconference. As a consequence of sending real-time video over low bandwidth connection, the image will not be as clear.

Digital Camcorders

Record video in digital form with slight compression (with a small loss in image quality), which can be uploaded onto a computer without further loss in image quality. Recorded video can also be edited using movie-editing software. Images recorded by a digital camcorder are more clearer than those captured by a webcam. However, recording using a camcorder requires more bandwidth than recording via a webcam. Today, many camcorders have a FireWire jack/interface to enable the host computer to provide enough bandwidth for the camcorder to send moderately compressed video in real-time to the computer.

Scanners

Convert a 2-D physical image (for example, a photograph or a paper copy of an image) into a digital image that can be viewed and edited on your computer. For example, you can use a scanner to convert a physical photo into a digital photo, and send the digital photo to a friend over the Internet.

Output Devices: Monitors and Projectors

Monitors and projectors are typical devices to view outputs on a screen.

CRT Monitors

Cathode ray tube (CRT) monitors used to be the most common type of computer monitors until LCD monitors (discussed below) began to gain popularity. CRT monitors use three electron beams to create colors, red, green, and blue. To generate the color white, all three beams are fired simultaneously. To create the color black, all three beams are turned off. Other colors are created using different mixtures of these three color beams. They are inexpensive and dependable for displaying images on screen. Cathode ray tubes are also found in conventional TV sets.

LCD Monitors

Liquid crystal display (LCD) monitors produce images by manipulating light within a layer of liquid crystal cells. They are also known as flat-panel screens. Compared to CRT monitors, they are compact, lightweight, and easy-to-read. They also emit less radiation than the CRT monitors. LCD monitors are used in notebook computers and desktop computers. Although mostly considered an output device, LCD monitors can also serve as input devices, called touch-screen monitors.

Page 64: iCarnecie SSD2 Book

Projectors

Enable images on the computer screen to be magnified and projected onto a bigger screen. Modern projectors use two types of technologies, the LCD system (also used in monitors as discussed above) and the digital light processing (DLP) system. Using the LCD system, images are projected as light shines through a layer of liquid crystal cells. On the other hand, DLP system uses tiny mirrors that reside on a special microchip called the Digital Micromirror Device (DMD). Images created using DLP are smoother and have better contrast than those created using LCD.

Output Devices: Printers

There are a number of types of printers that perform a variety of functions. This section compares and contrasts the four major types of printers.

Ink Printers

A wide variety of ink printers is available today. They use ink-jet, bubble-jet, and other technologies, but in the end, they all perform the same function: spraying and dyeing the page with color. Originally, ink printers came in black only; now they are hard to find. Color dyes have become cheaper and easier to produce, and "photo-quality" has become a major selling point with ink printers. These printers are rated according to their resolution and color depth. Color depth is the range of colors that any given drop may represent. Unlike monitor resolution, which is a measurement of pixels across and down the screen, printer resolution is measured in dpi, the number of dots per inch (horizontally or vertically) that a printer can place on a page. Sometimes the dpi is the same both horizontally and vertically, such as 1200 dpi. Other times, the horizontal and vertical dpi differ—as in1440x720 dpi.

Printers usually use a four-color process, CMYK (cyan, magenta, yellow, and black), to produce various colors. Sometimes a three-color process is used, excluding the color black because it can be produced by mixing the other three colors. In a typical printer, each dot is composed of one or two drops of ink, giving about 15 colors.

Multiple drops of colors can also be placed on a single dot to produce more colors. Hewlett-Packard attempts to achieve better quality by increasing the color depth in its printers by layering multiple color drops within a single dot to create better image quality. Read the article on HP's color layering technology.

Dye-Sublimation Printers

Dye-sublimation printers are used mainly to print high-quality images like those at a photo lab. Solid dyes consisting of the four colors, cyan, magenta, yellow, and black are used. However, in contrast to ink printers, instead of using multiple drops of CMYK colors to create a specific color, continuous-tone imaging is possible. This means that varying mixtures of CMYK color dyes can be used to represent different colors, achieving photo-like quality. The print head heats and vaporizes the dyes to allow them to permeate the glossy surface of the printing paper before they solidify. In dye-sublimation, printing colors are infused with the paper.

Laser Printers

Laser printers use toner cartridges that contain toner, a colored powder. The laser printer uses a laser beam to charge the image of the page onto a photoelectric drum. When the paper runs through the printer in between the drum and the toner cartridge, the electro-magnetic charge of the drum picks up the toner and then transfers it to the paper. A heat and pressure system then fuses the powder to the page.

Page 65: iCarnecie SSD2 Book

Comparing Printers

Below is a chart comparing printer types. The cost and quality measures are relative to each other.

Printer Technology

Price of Machine

Price of Supplies (for example, ink

and paper)

Quality of Text

Printouts

Quality of Image

PrintoutsSpeed Typical Usage

Ink (black/white) $ ## ** * medium Home

Ink (color) $ ### *** *** slow Home

Dye-Sublimation $$$$$ #### ** **** slow-medium Photo labs

Laser (black/white)

$$-$$$$ # **** * fast-very fast Small Office/Home Office

Laser (color)$$$-$$$

$$## *** ** - *** medium-fast

Office (for example, marketing department)

Table 1 Comparison of printers

In general, you should select a printer based on your usage. For a home office, a laser printer will offer the lowest cost per page (cpp) of all printers, making them economical in the long run, but with a large up front cost for the equipment. But, if you will not be printing many pages at home, you might want to consider getting an ink-jet printer.

2.3 Storage Devices

Why does a computer need to store files on a hard disk drive? Why not keep everything in RAM memory? There are two reasons. The first reason is that RAM memory is volatile: the data is represented by electric charges and is lost when the power is turned off. A hard disk drive stores information as magnetized patches on the disk surface, so the data persists even when power is removed. The second reason hard disk drives are useful is that they have a much larger capacity than RAM. A typical personal computer today will have at least 128 megabytes of RAM memory and 40 gigabytes of disk storage. That disk capacity is more than 300 times what can fit in RAM! So, even though hard disk drives are slow as compared to RAM, they are an important component of your computer system.

Reading Sequence:

Parsons/Oja, Chapter 2-Section C. Learning Goal: Knowledge of the variety of storage media, magnetic and optical, used by modern computers.

2.3.1 Disk Controller Interfaces . Learning Goal: Knowledge of the IDE (Integrated Drive Electronics) interface used for connecting disks to PC-based computer systems. (The disk controller is responsible for the physical

Page 66: iCarnecie SSD2 Book

operation of the drive mechanism and the transfer of bytes between the drive and main memory.)

2.3.2 Mass Storage . Learning Goal: Knowledge of basic differences among types of mass storage, comparing each storage type with the others.

2.3.1 Disk Controller Interfaces IDE Interface EIDE Master/Slave

There are many common interfaces to connect a storage device to a computer. We have discussed Universal Serial Bus (USB) and FireWire in section 2.2.1 Connecting Peripherals. Another common interface not yet discussed is Integrated Drive Electronics (IDE). An IDE (Integrated Drive Electronics) is the interface that enables data to transfer between storage devices and the chipset. IDE is designed specifically as disk interface whereas USB and FireWire can interface with other devices besides storage devices such as digital cameras and printers.

Below is a diagram illustrating the disk controller, the IDE interface, and the storage devices with respect to other components in a computer system. Note that the functionality of the disk controller is often integrated into the chipset.

Figure 1 Disk controller interface and storage devices

IDE Interface

An IDE interface provides a standard way for storage devices to connect to a computer. The controller for the IDE is usually integrated into the disk or CD/DVD drive, and the controller directs how the hard drive stores and accesses data. Before IDE was developed, controllers and hard drives were separate and were not

Page 67: iCarnecie SSD2 Book

standardized. This meant a controller from one manufacturer might not work with a hard drive from another manufacturer. Having separate controllers and hard drives also resulted in poor signal quality and decreased performance. Therefore, IDE was created as a way to standardize the use of hard drives in computers by combining the controller and the hard drive.

In 1984, IBM introduced the AT computer with a hard drive had a combined drive and controller. A ribbon cable from the drive/controller combination is used to connect to the system unit, creating the AT Attachment (ATA) interface.

Soon, other vendors started offering IDE drives based on the ATA standard developed by IBM. Thus, IDE became the term that covered the entire range of integrated drive/controller devices. Because almost all IDE drives are ATA-based, the two terms are used interchangeably.

EIDE Master/Slave

EIDE is Enhanced IDE, a newer version of the IDE mass storage device interface standard. It evolved into the ATA/33 specification, then to ATA/66, ATA/100, and the recent revision is Ultra ATA/133. The number associated with the ATA specification indicates the peak data transfer rate. The Ultra ATA/133 can transfer data at a maximum rate of 133 MB/s. The next generation ATA is the Serial ATA. Its features include a peak data transfer rate of 150MB/s, thin cables for easy routing, improved cooling inside a system unit, and hot-pluggable connectors.

The EIDE interface provides a set of two IDE (Integrated Device Electronics) ports.  One is referred to as the primary port, the other as the secondary.  Each port attaches to a cable containing two plugs, and each plug can connect to a device. Thus, a total of four devices can be accommodated: two on the primary, and two on the secondary.  To distinguish between devices on the same IDE port, one device is considered the master, the other the slave, resulting in the following designations:  primary master, primary slave, secondary master, and secondary slave. 

When only one device appears on a port cable, it is not usually necessary to specify it as a master or a slave.  When two devices appear on a port cable, one needs to be assigned as the master, the other as the slave.  These assignments are usually made by setting a switch (also called a jumper) on the drive or using cable select. In older systems, the device must then be added to the machine's configuration information through a dialog with the machine's setup program.  The user may need to consult the machine's documentation to learn how to enter its setup program. Usually pressing F2, ESC, or DELETE (for Pentium machines running Windows) at the start of a reboot will cause a machine to enter its setup program instead of loading the operating system. However, most of the newer systems can automatically detect the added device and configure it accordingly.

EIDE devices usually expect a particular master/slave designation and come ready to assume that role.  Consult the documentation for each device to discover where it expects to reside.  If it must be connected to a location different than it expects, the device itself may have to be reconfigured.   Again, consult the device's documentation to learn how to do this.

2.3.2 Mass Storage How Mass Storage Devices Differ from RAM Disk Drive Reliability

Optical Media: CDs versus DVDs

Magnetic Media

Optical versus Magnetic

Page 68: iCarnecie SSD2 Book

Solid State

Comparing Storages

How Mass Storage Devices Differ from RAM

Mass storage devices (magnetic disks, optical disks, and magnetic tape) have slow access times and low transfer rates. They are also located far from the processor. These mass storage devices are not even on the motherboard. (Sometimes they are not even in the same box as the motherboard!) But, mass storage technologies also have several important advantages:

They are nonvolatile—meaning that information is not lost when power is turned off. They have huge capacities, measured in billions or even trillions of bytes.

Their cost per bit stored is far lower than RAM.

In some cases, they use removable media that can be popped into a drive, used as needed, and then taken out of the drive, or mailed to a friend. Several newer removable disk technologies have appeared since the 3.5-inch floppy (1.44 MB). The Iomega Zip drive uses removable disks with capacities of 100 to 750 MB, and the CD Read/Write drive uses writable optical disks with 650 MB or 700 MB of storage capacity. These days, the compact flash drives (also called thumb drives) which plug into USB ports have taken over the duties of the floppy or Zip drives. The memory capacity of these flash drives range from 128 MB to 4 GB. On the higher end, we now have external hard drives with 600 GB storage capacity. These types of drives are currently popular for making backups of a system's main hard drive, or for transferring large data files from one site to another. On the optical side, we now have dual layer writable DVD disks which have a storage capacity as high as 8.5 GB. As hard drive capacity increases and optical disk technology matures, creating backups on external hard drives and re-writable optical disks has become a popular alternative.

Disk Drive Reliability

The disk drive marketplace is highly competitive because there is a huge consumer demand for disks with high capacities, fast transfer rates, and low costs. In order to meet these goals, disk manufacturers are continually advancing the state of the art for magnetic coatings, high-strength magnets (used in the motors that drive disk drive arms), and ultra-clean manufacturing technology.

In order to achieve high data transfer rates, a hard disk drive has to spin very fast: from 4,000 to 15,000 rpm (revolutions per minute). Also, magnetic patches that store data bits on the hard disk tend to be small and packed closely together. Therefore, in order to read these tiny little bits spinning at such high speed accurately, the read/write head has to be very, very close to the disk surface. The head rides on a cushion of air, and the distance between it and the disk surface is far less than the width of a human hair—less than the size of a single dust particle. In fact, if a head encounters a dust particle sitting on the surface of a disk while the disk is spinning at several thousand rpm, the head will crash into the disk, damaging itself and the magnetic coating on the disk. It is important to back up all data onto tape or another disk regularly.

A common specification for disk drive reliability is mean time between failures (MTBF), the average time (in hours) a device is expected to function before failing. Typically, disk drives for PCs have MTBF ratings of about 500,000 hours, 57 years. However, MTBF is a theoretical estimate because drives have not existed long enough for their life expectancy to be verified. The MTBF rating should be used in conjunction with service life. Service life is the amount of time before failures occur due to increased wear and tear of the component devices. It is how long the manufacturer predicts the disk would last. When shopping for disks, use the service life as a more accurate estimate for how long the disk will last before failures occur.

Optical Media: CDs versus DVDs

Page 69: iCarnecie SSD2 Book

Data in an optical media is read and written using laser beams. Compact discs (CDs) and digital video discs (DVDs) are optical disks. A DVD is an enhanced form of a CD. The two types of disks are physically the same size, but they differ in format. DVDs offer much greater capacity, which they achieve in two ways. First, DVDs have narrower tracks, so they can squeeze more tracks onto the same size disk. Both CDs and DVDs are read using light from a laser. But, the CD laser is red, while the DVD laser is blue. Red light has a longer wavelength than a blue light. The blue laser is thus able to produce a smaller beam, allowing it to focus on the tinier tracks of the DVD. The second way that DVDs achieve increased capacity over CDs is by using multiple layers of tracks. The blue laser is not only narrower, but also more powerful. Its beams can penetrate the plastic and focus at different depths. DVDs that are dual-layered actually have two sets of tracks on one side of the disk, one beneath the other. The laser beam can be focused on either the upper or lower layer. This doubles the capacity of one side of a DVD disk. It is also possible to put tracks on both sides of a DVD. A double layer double side (DLDS) DVD drive uses double layers and can read double-sided disks, giving it four times the capacity of a single layer single side (SLSS) drive.

CDs have two recordable formats, CD-R and CD-RW. While the Parsons and Oja textbook lists recordable DVDs, there are multiple standard formats for this. So, while CD-Rs and CD-RWs are readable on most CD or DVD drives, recordable DVDs may not be readable on some types of DVD drives. For this reason, users who record data on optical media for widespread distribution (for example, for releasing a new software package) may wish to limit themselves to CDs for now even though it has lower capacity than DVDs. DVDs are usually used as a medium for multimedia presentations that combine sound with graphics, such as movies.

Magnetic Media

Magnetic media range from some of the smallest capacity storage devices, floppy disks, to the largest capacity devices, hard disk drives. The floppy disk is no longer used to distribute operating systems, though, because of the increasingly large size of current operating systems. The last major distribution of Windows using floppy disks was Windows 95, which occupied 30 diskettes.

Zip disks, removable storage drives produced by Iomega, allow users to store much larger amounts of data than a floppy disk can hold—although Zip disks are physically not much bigger than floppy disks. These drives were once very popular, and many machines came with a Zip drive as standard equipment. But, their use declined with the wide availability of CD-RW and DVD-RW drives and the reduced cost of blank CD-R and DVD-R disks.

Smaller portable drives are being manufactured with larger capacities. For example, Mini USB storage device offers 512MB, 1GB, or 8GB of storage capacity on a storage device the size of a car key. Another portable storage device offered by Iomega is the pocket-size HDD Desktop external hard drive. It is available from 40GB all the way to 1TB of storage capacity. These devices can be connected to a USB or FireWire port.

Fixed (non-removable) hard disk drives are still the main storage medium for computers today. They can hold more data than any of the removable media types, optical or magnetic. On most personal machines, the operating system, application programs, and user data all reside on one hard drive. The smallest hard drives today, which are typically found in laptops, hold about 20 GB. When purchased separately, hard drives run from 20 GB up to around 750 GB, with the limit continuing steadily upward each year. Another important characteristic when comparing hard disk drives is the speed at which a disk drive rotates, since this limits the rate at which bits can be transferred between the drive and the computer. Slower drives spin at 4200 rpm (i.e. laptop computers); faster ones, at 15,000 rpm. If a hard drive is to be used in a performance-critical application, such as a database server, the data transfer rate is an important consideration. This rate will be affected by several other factors besides the rotation speed of the disk and latency (time it takes to access the first bit of data)—such as the type of disk controller selected and the type of memory architecture the

Page 70: iCarnecie SSD2 Book

computer uses. Refer to the sections on benchmarking in 2.1.1 Processor Basics and 2.5.2 Bottlenecks to find more information on this subject.

Optical versus Magnetic

Let us briefly compare optical and magnetic storage technologies. Optical media are more durable. They are not ruined by dust or moisture, nor are they vulnerable to electrical damage (however, they can be damaged by physical damages such as scratches). Optical media's MTBF rating (average life expectancy) ranges between 30 and 300 years, while magnetic media utilize magnetic properties that have a MTBF of about 3–7 years. Optical media are also less expensive per MB than magnetic disks. A box of blank CD-Rs is twice as expensive as a box of ten floppy disks. On the other hand, magnetic disks, with the exception of floppy disks, can be written and read faster than optical disks. It takes at about 8 minutes to fill up a 700 MB recordable CD. A hard disk drive can store the same amount of data in less than a minute. Finally, most hard disk drives offer greater capacity than any currently available optical device.

Solid State

A popular type of portable storage for small devices such as digital cameras and Personal Digital Assistants (PDAs) is flash memory. Flash memory uses solid-state technology, using no moving parts inside the chip. Data is recorded using electronic charges. To rewrite data, flash memory applies electric fields using in-circuit wiring to erase predetermined sections of the chip so those areas can be rewritten.

Examples of flash-memory storage devices are CompactFlash and SecureDigital cards. CompactFlash card uses a controller chip, which can increase performance on devices with slow processors, and flash-memory chips. Its storage capacity is between 4MB and 4GB (however, the ones with larger capacities being more expensive). A SecureDigital card is smaller and thinner than a matchbox. Its storage capacity is between 4 MB and 2 GB, with capacities increasing every year.

Comparing Storages

There are many ways to store data. For example, there are presently three types of CD drives available, and five kinds of DVD drives. The chart below lists the most common types of storage available today. Magnetic storage media can be read and written many times, but some optical media are read-only, and some are write-once (but they can be read many times).

Name Type Capacity Writability

High-density floppy disk Magnetic 1.44 MB Unlimited

SecureDigital card Solid state 128 MB - 32 GB Many

CompactFlash card Solid state 128 MB - 64 GB Many

Super floppy Magnetic 120 or 240 MB Unlimited

USB storage device (thumb drive) Solid state 64, 128, 256 MB, or more Many

CompactFlash form factor—Microdrive Magnetic 340 MB to 8 GB Unlimited

Page 71: iCarnecie SSD2 Book

Iomega Zip disk Magnetic 100, 250, or 750 MB Unlimited

CD-ROM Optical 650 or 700 MB Read only

CD-R Optical 650 or 700 MB Write once

CD-RW Optical 650 or 700 MB Many

Iomega Jaz disk Magnetic 1 or 2 GB Unlimited

DVD+/-R Optical 4.7 GB Write once

DVD+/-RW Optical 4.7 GB Many

DVD+R DL (dual layer) Optical 8.5 GB Write once

DVD-ROM (SLSS) Optical 4.7 GB Read only

DVD-ROM (DLSS or SLDS) Optical 8.5 GB Read only

DVD-ROM (DLDS) Optical 18.8 GB Read only

Internal hard disk drive Magnetic 20 GB or more Unlimited

External hard disk drive Magnetic 20 GB or more Unlimited

Table 1 Comparison of storages

2.4 Putting Together the Hardware Components

This section will help you understand how all the components work together and provide you with the tools to compare the price and performance of different computer models. You will also examine the specifications for various computer components (processor, memory, monitor, hard disk drive, etc.) and see how to make intelligent purchasing decisions.

Reading Sequence:

2.4.1 How Components Work Together . Learning Goal: Knowledge of how components introduced in this unit work with one another to enable a computer to function.

2.4.2 Lab: Researching a Computer System . Learning Goal: Knowledge of how to use the Web to research a specific type of computer system by searching for product reviews.

2.4.3 Lab: Online Configuration . Learning Goal: Knowledge of how to use the Web to research and price the computer configurations you are considering purchasing.

2.4.1 How Components Work Together

Page 72: iCarnecie SSD2 Book

The diagram below summarizes how components introduced in this unit work together.

Figure 1 Overview of hardware components

The CPU executes instructions stored in memory devices. When the computer is being booted, the CPU fetches instructions from the permanent memory devices, ROM and CMOS. ROM is read-only memory that stores instructions needed to start up the computer. CMOS contains system configuration data. Once the computer is booted, RAM is used to load the rest of the instructions to be executed by the CPU. Data in RAM is temporary and will be lost when the computer is turned off.

Data from storage devices such as the CD-ROM drive and the hard drive are passed through the disk controller. Data can also be stored on hard disk or CD.

Data in the hardware system passes through buses. The buses are the communication channels among components in the system unit.

Peripheral devices such as the keyboard, mouse, joystick, printer, speakers, microphone, etc. are connected to the computer via ports typically in the back of a system unit. Graphics cards or sound cards are also examples of expansion cards that can be plugged into the expansion slot of the computer to extend or enhance the functionality of a computer.

Page 73: iCarnecie SSD2 Book

When a computer processes requests from the user, the CPU directs the other components to carry out specific tasks, and data is passed among components through buses and the chipset. Use the diagram above as you follow through how data is transferred from component to component in the sample scenarios provided below:

To save a file to hard disk, the CPU would pass the data to be saved through the front bus to the chipset. The chipset sends the file data via the PCI bus to the disk controller, which would then send the data to the hard disk storage device.

To open and display an image file, the CPU would signal the disk controller to fetch the image file on the storage device and store it in RAM. The graphics card would then access the image data and display the image as pixels on the computer monitor.

These are generalizations for how components interact. When trying to understand a hardware system, keep in mind the general concepts of how components work together, and investigate the specifications of components to gain more precise understanding of how a given hardware system works. The exact nature of how each component works and interacts with other components is beyond the scope of this course.

2.4.2 Lab: Researching a Computer System

You can research a computer system using the Web by retrieving product reviews and price comparisons. Suppose you are interested in a particular line of notebook computers, such as the Dell Inspiron or the Sony VAIO. The following activity will lead you through a sample comparison.

Learning Exercise:

Go to the Reviews section of Ziff Davis Web site (www.zdnet.com), and select a notebook machine that looks interesting.

Read the detailed review of the product and check the latest price information.

Ziff-Davis also publishes the magazine Computer Shopper and its companion Web site www.zdnet.com/computershopper.

You can also find product reviews and pricing info at the CNET Web site www.cnet.com.

2.4.3 Lab: Online Configuration

Some computer-vendor Web sites allow you to specify a system configuration by selecting from various menus listing available options. Then, when you click the "update price" button, you can see the exact price for the system you selected. Two such Web sites are Dell (www.dell.com) and Gateway, Inc. (www.gateway.com).

Learning Exercise:

Visit the site of a computer vendor. Assume that you have a budget of $1,200 and put together the specification for a computer that is appropriate for a college student studying Computer Science.

Now assume you're buying a notebook computer for a businessperson who is a frequent airline traveler and is concerned about weight and battery life. What can you get for $2,500?

Page 74: iCarnecie SSD2 Book

2.5 Improving Computer Performance

How do you measure computer performance? And, how is computer performance being improved? These are some of the topics covered in this section.

Reading Sequence:

2.5.1 Moore's Law . Learning Goal: Knowledge of the basis for the exponential growth in the computer's memory storage and computational abilities.

2.5.2 Bottlenecks . Learning Goal: An understanding of performance bottlenecks and how to correct them.

2.5.3 Throughput and Latency . Learning Goal: Definition of throughput and latency with respect to computer performance.

Parsons/Oja, Chapter 8-Section B: "Image Compression". Learning Goal: An understanding of how data compression can be used 1) to reduce the amount of space required to store files and 2) to improve throughput by reducing the number of bytes that must be transmitted.

2.5.1 Moore's Law

A transistor is an electronic switch that can alternate between two states, "on" and "off," representing one bit of information. Modern microchips contain millions of transistors, each so small that it cannot be seen with the naked eye. Gordon Moore, one of the founders of Intel, observed that in 1965, microchip capacity (the number of transistors contained within a silicon wafer) had doubled every year. This trend in computing, which has become known as Moore's Law, continues on into the present—although the rate of change has slowed recently so that chip capacity now doubles every 12-18 months, not every year. Moore's Law, an example of exponential growth, refers specifically to the capacity of microchips, and the law might be stated this way: the number of transistors that can be put on a microchip will double every 12-18 months, until physical limitations are reached.

To illustrate the power of exponential growth, consider the parable of the inventor of chess and his emperor. The emperor wanted to reward the inventor with anything he wanted for creating the game of chess. The inventor requested that he be given one grain of rice for the first square of the chessboard and that each additional square would double the previous square's amount of rice. The emperor immediately granted his wish. There are 64 squares on a chessboard. By the 32nd square, 4 billion grains of rice would have been given, that is about one large field's worth of rice. And, the next square would need about 2 million grains of rice, the next square about 4 million, the next square about 8 million, and so on. The 64th square would need 9*1018 grains of rice, more than the amount of rice that could be produced even if the entire earth's surface is used to grow rice.

The number of transistors on a single chip increased at such exponential rate, doubling every 12-18 months. Below is a graph illustrating the exponential increase in the number of transistors on processors introduced over the years.

Page 75: iCarnecie SSD2 Book

Figure 1 Illustration of Moore's Law applied to Intel Processors

Below is the log scaled graph to provide you with a different perspective of the exponential growth of transistors on a microchip.

Figure 2 Illustration of Moore's Law applied to Intel Processors in log scale

Page 76: iCarnecie SSD2 Book

For more recent data, see the press kit from Intel

With the exponential growth of transistor density on microchips, many inferences can be made that allow analysts to predict other developments in the computer industry. Extending the scope of Moore's Law, the following predictions can be made:

1. Processing power (speed) doubles every 12-18 months.2. Storage capacity of RAM doubles every 12-18 months.

Other observations are that storage capacity of hard disk drives is also increasing exponentially, and the cost for consumers to purchase computer parts is decreasing over time.

The reason Moore's Law continues to hold true is that circuitry is becoming ever smaller. Circuits that used to require hundreds of square microns of silicon (a micron is a millionth of a meter) now fit into just a few square microns. This trend has enabled more and more circuits to be packed into the same area. Processors, memory chips, and special-purpose chips for controlling peripheral devices are all becoming denser. Although Moore's Law only predicts the increase in circuit density, this increase in density reduces the time required for inter-component communications, which also means that chips can process data faster.

Improvements in microchip technology are being matched by improvements in several other technologies found in computer systems. Disk capacity is increasing for a variety of reasons. Improvements in magnetic media (the iron oxide coating on the surface of a disk, flatter platters, etc.) and read/write electronics are increasing the capacity of hard disk drives. Introduction of new optical disk technologies is another source of increased storage capacity for personal computers. Corresponding increases in processor speed and bus bandwidth enable computers to take full advantage of the growth in storage capabilities.

Despite the growth in processing speed and storage capacity, the cost per byte of data processed or stored decreases as lower-capacity memory chips become out-dated. For instance, the cost of a 64MB RAM a couple of years ago is now about the same as the cost of a 128MB RAM.

An interesting counter to improvements in capacity and throughput is known as Parkinson's Law of Data, which says that data expands to fill the space available. In other words, as more memory or disk space becomes available, the demand for more memory or disk space increases accordingly. For example, when computers had only a few kilobytes (KB) of memory, their simple operating systems fit in as little as 4 KB. Today's microcomputers typically have 128 MB or more of memory and, as Parkinson's Law would predict, today's operating systems are much more elaborate and require tens of megabytes of memory for their own use. Similarly, as disk drive capacity increases, people begin using them in new ways. Early computers with

Page 77: iCarnecie SSD2 Book

360 KB floppy disks mainly stored small text files. Today, when computers routinely come with multi-gigabyte hard drives, people store musical recordings, short video clips (each file several megabytes in length), and even collections of feature-length films on DVD (typically about 5 gigabytes).

Parkinson's Law drives the entire computing industry, through the knowledge that applications will always keep pace with Moore's Law. As capacity increases, users would ask for even more performance in order to accomplish more ambitious tasks. Thanks to Moore's Law, we can expect to see continued technological improvements to meet consumer demand for greater performance at affordable prices. (But, note that Moore's Law doesn't cover all aspects of computer technology. It says nothing about increases in system reliability, or about the quality of the software programs used in computer systems.)

Without fundamental changes in chip technology, the laws of physics suggest that there are limits to how far we will be able to improve computing performance. For example, the circuit pathways have to be wide enough for electrons to pass through. Another limitation is the wavelength of light. Light is used to etch circuits into silicon, and the width of the pathways etched is related directly to the wavelength of the light used to do the etching—the shorter the wavelength, the narrower the pathway. Ultraviolet light has a shorter wavelength than visible light, and X-rays are shorter still. But, there are technical problems with using wavelengths that short. What happens when the limit is reached? We don't know, but experience suggests that progress will continue, possibly in unanticipated directions. At some point, the cost of producing ultra-dense chips may restrict their use to the most expensive supercomputers.

2.5.2 Bottlenecks

Bottlenecks—Slowing a Process Typical Bottlenecks

Eliminating Bottlenecks

Bottlenecks—Slowing a Process

Wide-mouthed glasses empty their contents more rapidly than bottles with long thin necks. To do any task, many steps are involved. A bottleneck is a step that takes a long time to complete, and thus reduces overall performance. Just as in the adage "A chain is only as strong as its weakest link," it is true that a process's speed, or throughput, is limited by its slowest step.

One implication of this is that it does not pay to get a tremendously fast processor, if the memory is slow in letting information flow in and out. In just the same way, a slow disk will impede overall system performance. If other parts of your computer are too slow, buying a faster processor may not speed things up at all!

For example, suppose you are executing a program. It is taking forever. What is the right thing to do to fix this problem? Since the system is an old Pentium II machine, not Ethernet Pentium 4, you are tempted to replace it on the spot. But there are other explanations. You might be running low on RAM, or your bus is not transferring data fast enough.

Similarly, the time required to perform a task that consists of several steps may be dominated by the step that takes the longest time. If this is the case, speeding up the other steps may have little effect. Suppose that making your favorite dinner involves 10 minutes of chopping ingredients, 2 hours of roasting, and 15 minutes of stirring gravy. If buying a food processor allows you to do all the chopping in just one minute, a factor-of-ten speedup, your overall time in the kitchen will be cut by only 6%. On the other hand, if you were to buy a convection oven that cuts your roasting time in half, the 100% increase in speed will save an hour and cut your overall time by 41%.

Page 78: iCarnecie SSD2 Book

Typical Bottlenecks

The following are some areas of the hardware system that may contain a bottleneck:

Cache RAM

I/O

Video card (particularly for 3-D gaming)

The cache slows the system down when there is not enough cache. Faster processors requiring more data input to run optimally may not receive enough data from small caches.

RAM loads instructions from programs on disk. Therefore if there is not enough RAM memory, instructions will need to be loaded frequently from disk slowing down the execution of program instructions.

I/O covers information transfer. Are the buses fast enough? Is the hard drive fast enough? The components may be able to send the data quickly enough, but if the system cannot transfer the data just as quickly, the system slows down.

Most business users will not suffer from a slow video card. Gamers, graphics designers, and some engineers need high-speed video cards in order to keep pace with the requirements of the software. The average user does not need one of these video cards; however, the slow 3-D rendering frame-rates produced by slower cards may hamper the performance of some applications.

Eliminating Bottlenecks

Can we speed up a computer? Actually it isn't usually the computer that you want to speed up, but the tasks it performs. This is an important distinction. Speeding up the computer suggests buying a faster processor, installing faster memory, getting a faster bus, or installing faster disk drives and video controllers. Improving your hardware for the purpose of speeding up your system will work, if you keep the system uniformly balanced. (Remember, a single bottleneck will slow the performance of the entire system.) The lab you performed in section 2.1.3 Lab: Benchmarking might help you identify the bottlenecks, or slow spots, in your system.

The key to making effective improvements is to understand why certain tasks take so long. Often, you can do some simple experiments to see whether or not a certain item is the bottleneck. This idea is applied in a very straightforward way by software developers, who use profiling tools to measure how long various sections of their programs take. That way they can identify the bottlenecks and most time-consuming steps, and focus their attention on improving those portions of the code.

2.5.3 Throughput and Latency

Throughput and Latency are two key terms used in discussing computer performance. Throughput refers to the rate at which data flows through the system. For example, a computer might execute 500 million instructions per second. Latency refers to the time required to complete an individual operation. For example, it might take five seconds to launch an application, or two minutes to reboot the entire system.

These measures are clearly related. For example, suppose you want your Web server to display a large graphic on a user's computer when they press a button. Latency is how much time passes from the button press until the image is displayed. If the image is a 1 MB file, then with a throughput of ten megabits per

Page 79: iCarnecie SSD2 Book

second, the latency to display the image will be at least 0.8 seconds. Whether latency or throughput is most appropriate to report depends on the setting.

If you are selecting a provider for your Web server's network connection, you will be more concerned with having enough throughput, or bandwidth, to serve your needs. If you are a user of the same web server, you will certainly be concerned with the latency for your request. It does not matter to you how many other requests the server processes per second (i.e., throughput). You are mainly concerned with your request.

As a server administrator, you might hear complaints from people whose latency was exceedingly high, even though your throughput was acceptable. Let us say your server handles two different kinds of requests: a request for a small file that can be sent quickly and a request for a large file that takes a long time to send. If the vast majority of requests are for small files, your throughput (the bits sent per second) and latency for small files may be fine, while the latency for large files may be unacceptable.

A simple way to think about latency is to model the time it takes to do a task as being equal to some constant startup time, plus a time that scales with the size of the task.

Unit 1 and Unit 2 Review Materials

Note: The questions on the exam will be based on variations of the following pool of questions and exercises in Unit 1 and Unit 2.

1. Benchmarks a. With regard to computing, define the term benchmark.

b. What tasks does benchmarking software perform in order to measure the system being tested?

c. How can consumers use benchmarks to help them purchase a computer system?

d. How do benchmarks help identify slow points (bottlenecks) in the system?

2. Binary

a. Define bit.

b. Define byte.

c. Fill in the following chart, listing the prefixes used for the amount of bytes shown:

Amount Prefix

220

230

240

d.

e. Fill in the following chart, converting binary numbers to decimal and decimal numbers to binary:(Note: The numbers that appear in the table below will differ on an exam from the numbers that appear on the exam's review sheet.)

Page 80: iCarnecie SSD2 Book

Binary Decimal

10

23

78

189

1 1011

1111 1100

11 0011

1010 0101

f.

g. Although in sales literature 1000 bytes and 1024 bytes are both commonly referred to as a kilobyte, in computing the only correct number of bytes in a kilobyte is1024. Explain why 1024 is correct.

h. How can the difference in measuring bytes presented in part e impact a consumer when they are purchasing a hard disk drive?

3. Component Identification

Page 81: iCarnecie SSD2 Book

Choose among the following components to label the image:

MotherboardPower supplyBIOS ROM ChipCooling fanExpansion slotRAM chipExpansion cardDisk drivesChipsetIDE cableEthernet cablePCI bus

a. Label A is _____. b. Label B is _____.

c. Label C is _____.

d. Label D is _____.

e. Label E is _____.

f. Label F is _____.

g. Label G is _____.

Describe the functionality of each of the following components (in 2 sentences or less):

h. Microprocessor:i. RAM:

j. Bus:

k. Expansion card:

l. Disk drive:

m. IDE cable:

4. Compression

a. What is compression?

b. Describe a benefit of compression.

c. Describe dictionary-based compression.

d. Describe run-length encoding.

e. Describe a benefit of lossy compression.

f. Name a file type that incorporates lossy compression.

5. Computer Speed

a. One Hz is one _____ per _____.

Page 82: iCarnecie SSD2 Book

b. Define IPS.

c. Answer the following questions on the relationship of Hz to IPS.

i. Which is a better determiner of speed: MHz or IPS?

ii. Does a high Hz equal a high IPS, and can they be inversely proportional? Explain.

iii. How is it possible for a machine with a lower clock speed (Hz) to have a higher IPS than a machine with a higher clock speed?

d. What is the relationship between the system clock and Hz?

6. Hexadecimal

a. Define hexadecimal notation.

b. What advantages does hexadecimal have over binary?

c. Which number system, binary or hexadecimal, is used when referencing memory addresses and why?

d. Fill in the following chart, converting hexadecimal notation to decimal or decimal to hexadecimal notation:(Note: The numbers that appear in the table below will differ on an exam from the numbers that appear on the exam's review sheet.)

Decimal Hexadecimal

15

99

191

238

10

6B

A3

DD

7. Images

a. How are bitmapped images rendered?

b. How are vectored images rendered?

c. Which image type tends to be more photo-like in quality, bitmapped or vectored?

d. Which image type maintains a high image quality, regardless of how it is resized?

Page 83: iCarnecie SSD2 Book

e. List three image editors.

8. I/O

a. Define I/O device.

b. Consider that a computer requires I/O devices to be able to interact with its environment. Explain why it is necessary for computers to have these devices.

c. Give four examples of I/O devices.

d. For each I/O device in your answer to part c, explain the device's function from the perspective of a user.

9. Magnetic Media

a. List two advantages of magnetic media over optical media.

b. Fill in the following chart matching the type of media with its storage capacity. The types of media to choose from are Jaz disk, Zip disk, hard disk drive, high-density floppy disk, and double density floppy disk.

Type of Media Storage Capacity

720 KB

1.44 MB

100 MB or 250 MB

1 GB or 2 GB

20-80 GB

c.

d. Consider that magnetic media is read by an electromagnet. How does the read/write head discern and transfer data from the magnetic media to the system?

10. Moore's Law

a. Define Moore's Law.

b. List two extrapolations of Moore's Law that are discussed in the course materials.

c. How can Moore's Law and the extrapolations from Moore's Law assist a consumer in purchasing a computer?

d. Define Parkinson's Law of Data.

e. Using Parkinson's Law, what projection can be made regarding memory and hard disk usage?

f. How can Parkinson's Law assist a consumer in purchasing software or components for a computer?

11. Optical Media

Page 84: iCarnecie SSD2 Book

a. List two advantages of optical media over magnetic media.

b. Fill in the following chart. The types of media to choose from are CD-R, CD-RW, CD-ROM, and DVD-ROM.

Type of Media Storage Capacity Number of Times It Can Be Written To

650-700 MB 0

CD-R 650-700 MB

650-700 MB

4.7 GB

c.

d. Consider that optical media is read by a laser. How does the laser discern and transfer data from the optical media to the system?

e. Consider that a DVD and a CD are the same size. List two reasons a DVD holds more information than a CD.

12. Picture Quality

a. Explain resolution, with respect to a monitor.

b. List two typical monitor resolutions.

c. Explain color depth, with respect to a monitor.

d. List two typical monitor color depths.

e. Consider that the higher the resolution and the higher the color depth, the more system resources are required to display output on the monitor.

i. Use the resolutions from part b and the color depths from part d to calculate the amount of RAM required to display the image.

ii. Explain the calculation you made in part e.i in a way that confirms the statement made at the beginning of part e—that "the higher the resolution and the higher the color depth, the more system resources are required to display output on the monitor."

13. Port Identification

Consider the following devices:

MousePrinterKeyboardModemSpeaker Digital cameraEthernet jackMonitor

Page 85: iCarnecie SSD2 Book

For the following questions, indicate which device(s) should be plugged in which port(s) A-H shown in the diagram below.

a. What device(s) can be plugged into port A? i. What is the name of this port?

ii. Is this a serial port or parallel port?

b. What device(s) can be plugged into port B?

i. What is the name of this port?

ii. Is this a serial port or parallel port?

c. What device(s) can be plugged into port C?

i. What is the name of this port?

ii. Is this a serial port or parallel port?

d. What device(s) can be plugged into port D?

i. What is the name of this port?

Page 86: iCarnecie SSD2 Book

ii. Is this a serial port or parallel port?

e. What device(s) can be plugged into port E?

f. What device(s) can be plugged into port F?

g. What device(s) can be plugged into port G?

h. What device(s) can be plugged into port H?

14. RAM

a. Define RAM.

b. What is the unit of measurement typically used for the speed of RAM?

c. What is SDRAM and how does it work?

d. Data on hard disk drives is accessed indirectly via the file system.

i. How is data in RAM accessed?

ii. What are the benefits of accessing RAM in this way?

e. With regard to RAM, what is volatility?

Page 87: iCarnecie SSD2 Book

Unit 3. Operating System Software

An operating system performs a vital role in enabling users to interact with a computer system. In this unit, we will learn about the specific responsibilities of an operating system, such as device management, memory management, resource sharing, and process control. After learning about the operating system, you will understand some of the problems that can cause your computer to perform less than optimally and some of the solutions that can resolve those problems. You will also learn how to customize your computing environment to your personal taste.

Readings:

3.1 Structure 3.2 Device Management and Configuration

3.3 Resource Sharing

3.4 File Systems

3.1 Structure

Just as we previously discussed with respect to hardware, a computer system's software has its own structure. The operating system is not a single entity but is composed of multiple layers, each with its own area of responsibility. The operating system's layers and the applications the user runs are considered unique "tasks" or "processes," competing for access to the CPU and other hardware resources. The management of this competition through the proper scheduling of processes is a major responsibility of an operating system and can have a significant impact on system performance.

Reading Sequence:

Parsons/Oja, Chapter 4-Section A. Remark: Learn about the importance of the operating system to a computer system. It might surprise you to see how many different operating systems exist in addition to Windows. Windows itself comes in several different versions that have evolved over the years. Details of operating system functions will be covered in a later unit.

3.1.1 Layers of Software . Learning Goal: Knowing why layers are an important design concept, and what the layers of software are that make up a computer system.

3.1.2 The BIOS: Life at the Bottom . Learning Goal: An understanding of what the BIOS is and how it provides a bridge between higher layers of the operating system and the PC's physical hardware.

Parsons/Oja, Chapter 3-Section D: Learning Goal: Knowledge of installing software and software upgrades.

3.1.3 Process Control . Learning Goal: An understanding of the operating system kernel and how it performs one of its most vital functions, task scheduling. This function determines which application or operating system process should next have use of the CPU.

3.1.4 Lab: Task Manager . Remark: To view the list of currently executing processes on a computer running Windows, perform the Task Manager lab.

Page 88: iCarnecie SSD2 Book

3.1.1 Layers of Software Layers and Process Management Encapsulation and Abstraction

Layers of Software

Layers and Process Management

Software systems are composed of multiple layers, but the same can be said of many other features of everyday culture. In U.S. culture, to take just one example, when you sign a credit card slip to pay for dinner at a restaurant, as far as the credit card company is concerned, it is just "a meal." No more detail is required. But, the meal was actually composed of several courses. That is a layer of detail the waiter needs to keep track of in order to know what dishes to bring, and in what order. Let us say the first course was salad. The details of salad preparation were handled by another layer, the kitchen, where a chef tossed together lettuce, tomatoes, and some croutons—which came out of a box, at least as far as the chef was concerned. 1

But, where do croutons actually come from? They were bought from a bakery, which made them from flour, yeast, and seasoning. The flour came from a flourmill, which purchased wheat and ground it up. The wheat came from a farmer who planted seeds and eventually harvested the mature wheat plants. When you pay for your dinner, you are paying (indirectly) about one thousandth of a cent (assuming you are paying in U.S. currency) to that farmer for the wheat in your croutons. And, you are paying several thousand other people who contributed to your meal in various ways. Fortunately, you do not have to pay all those people directly! You make one payment for "a meal," and the details are sorted out in the layers below.

By organizing the production process into layers that are relatively independent, the entire system can be kept manageable, and great efficiencies can be achieved. In computer science, the principles underlying these benefits are called encapsulation and abstraction.

Encapsulation and Abstraction

Encapsulation means that each layer needs only a limited amount of knowledge to do its job, and none of the other layers has access to that information. The farmer does not know what the wheat will be used for. The bakery does not know how the wheat was harvested. And, you do not even need to know that croutons contain wheat! In the software world, encapsulation means that your word processing program does not need to know how to control disk drives in order to be able to open and save files; there are layers of software below it that handle those details.

However, if a layer were fully encapsulated it would be unable to communicate with the layers above and below. In order for there to be some exchange of information, but not too much, the designer of a layer specifies an abstraction that the layer promises to support. The bakery supports an abstraction called a "crouton order," whereby a customer can submit an order for X pounds of croutons and the bakery will respond by producing the croutons and delivering them. Inside the bakery, all sorts of things are going on that the customer does not see. For example, the bakery may have a big oven and a little oven, and the manager must decide which one to use to fill each order. Sometimes it might make sense to bake two small batches of croutons instead of one big batch. Sometimes one or the other oven is down for maintenance. These details are hidden from the customer; in computer science terminology we say the information is encapsulated. Furthermore, even if a customer somehow knew that there were two ovens, they could not specify which oven they wanted to be used to produce their order, because there is no place on the order form to indicate that. In computer science terms, we say that the crouton ordering abstraction does not support oven choice.

Page 89: iCarnecie SSD2 Book

The existence of well-defined abstractions at each layer means that one implementation can be replaced by another with no effect on the layers above and below. Lots of bakeries sell croutons. If they all accept the same order form, it is possible to switch suppliers at will. On your computer, it is possible to have multiple implementations of a software component and switch from one to another. For example, your Web browser calls on a helper program when it needs to play a sound file or video clip. There are several programs that can perform this function. All you have to do is tell your browser which player to use. This isolation of functionality means that if a new, improved player becomes available, you can switch to that one; you do not have to get a completely new browser.

Layers of Software

Let us now consider the layers of software that make up a computer system:

User-Written Scripts or Macros

User Interface

Application

Run-time Library

Application Program Interface

Operating System

Kernel

Device Drivers

BIOS

(Hardware)

Table 1 Layers of software

We will go through these levels from the bottom up:

Hardware, for our purposes, is the lowest level of the computer: the physical components from which it is constructed. Actually, there are several levels of hardware, since a computer is composed of circuit boards, a board contains multiple chips, chips are composed of circuits, and circuits are built from transistors. But, this unit is supposed to be about software, so we will ignore those details.

Page 90: iCarnecie SSD2 Book

The BIOS, or Basic Input/Output System, is the most fundamental level of software. It deals directly with the signals that control each hardware component. Much of its work is performed when the computer is first turned on.

Device drivers are the helper programs the operating system uses to communicate with a specific model of device. To add new hardware to a system, the appropriate device drivers must be installed. (Peripheral components are often shipped with a floppy disk containing the necessary drivers.) The device driver for a hard drive, for example, knows how many tracks are on the drive and what commands to send to the drive to move the arm to a specific track and then read or write data. The advantage of this arrangement is that the operating system vendor does not have to be responsible for supporting every device ever invented, or that might be invented in the future. The device manufacturer supplies the driver, and as long as the driver follows the established conventions for communicating with the operating system, the device should be usable.

The kernel is the heart of the operating system and performs the functions that are most crucial for keeping everything running. It manages memory, decides which task to run next, and handles the various types of interrupts that can occur. The kernel must stay resident in RAM at all times, and because of its special nature, it must run without some of the protection mechanisms that guard against faulty instructions or illegal memory accesses. Therefore, it is kept as small as possible.

The remaining layer of the operating system is much larger than the kernel. It implements all the other functions the operating system is expected to perform. For example, it includes a file system for managing the folders and files on a disk. Refer to 3.4 File Systems for a more detailed discussion of this material. It communicates with the kernel when it needs to perform basic actions, such as initiating a data transfer operation to a peripheral.

The application program interface, or API, is the layer where user programs (applications) communicate with the operating system. For example, suppose a Web browser application decides it needs more memory in order to display a large image file. The operating system is responsible for keeping track of which programs are using which chunks of memory at any given time. This information is encapsulated within the operating system; the application does not know anything about how the information is organized. It does not have to. The operating system defines an abstraction for managing memory known as an API call. All the application developer has to know is which API call to use to ask for more. If a new version of the operating system comes along that uses a different way to keep track of memory, the application program will continue to work just fine as long as the API call stays the same.

Run-time libraries are collections of software routines that application programs rely on. For example, if you write an application in the C language to open a file and read some data from it, you will use two built-in functions called fopen and fscanf. These functions are fetched from a library of I/O routines called stdio that can be used by any C program. They will make the appropriate API calls to get the operating system to do what you need. The nice thing about the stdio abstraction is that your program is not dependent on a specific set of API calls, so you can run it on any machine that has a C compiler and an implementation of the C runtime library. Most programs draw on routines from several libraries.

The application layer is where you will find the routines that do the actual work the application was created for.

The user interface layer is responsible for communication between the application and the user. It is typically a GUI (graphical user interface) composed of buttons and pull-down menus. Suppose the user wants the application to open a file. This requires a bit of dialog that is handled by the GUI. First, on the File menu, the user clicks Open.... The Open dialog box appears and prompts the user to select a file. Once the user has selected a file, the GUI passes the request and the file name to the application, which opens and processes the file.

Scripts or macros are routines that many applications allow users to create from the application's set of built-in commands. Scripts and macros allow users to automate sequences of actions they perform

Page 91: iCarnecie SSD2 Book

frequently. For example, a Microsoft Excel macro might open a file, copy a bunch of numbers from the file to a spreadsheet, perform some calculation on them, and write the results to another file. If these calculations update the values of a user's stock portfolio, he or she will want to perform the calculations every day—so it might be worthwhile for them to collect the calculations into a script that can be executed with just a few keystrokes. That way the user can forget about the details. Scripts are located above the application layer in the software hierarchy because they are built from application-level commands.

The computer industry today relies on specialists in each of the levels listed above. Some people make their living writing BIOS software, while others concentrate on improving GUI technology. But, the greatest number of programmers is found at the application level, because people want to use computers for so many different tasks.

1 Croutons are small toasted cubes of bread that are popular in salads in the U.S.—where a salad will typically be leaves of lettuce, slices of tomato (or the tiny cherry tomatoes), and sometimes slices of other vegetables like cucumber or green pepper. The croutons go on top!

3.1.2 The BIOS: Life at the Bottom The Role of the BIOS Changing BIOS Settings

The Role of the BIOS

Most of this course is concerned with the higher levels of the software hierarchy: file systems, operating systems, and applications. But, in this section, we will look at the lowest level of software on the machine—the BIOS, or Basic Input/Output System. The BIOS performs three major functions: it initializes the hardware when the computer is first turned on, it loads the operating system, and it provides basic support for devices such as the keyboard, mouse, and serial ports. The BIOS is always present, but, it is only visible when you first power on the computer, before the operating system takes control.

When a computer is first turned on, there is no operating system present in memory. RAM is empty. (Remember that RAM is volatile memory; it loses the data stored in it when the power is turned off.) The BIOS must reside in a different kind of memory in order to perform its function. It resides in a ROM (Read-Only Memory) chip on the motherboard. ROM is permanent memory; it retains the data stored in it when the power is turned off. During the power-on sequence, the processor automatically starts executing instructions from the ROM. Since ROM is slower than RAM, the BIOS on most systems immediately copies itself from ROM into RAM. Then it tells the processor to fetch all further instructions from the RAM version.

Another special type of memory used by the BIOS is CMOS memory. CMOS (Complementary Metal Oxide Semiconductor) is a chip technology that uses very little power. A small amount of CMOS memory, often as little as 64 bytes, is included on the motherboard to store BIOS parameter settings that control the operation of the hardware. Another parameter controls the timing of main memory operations. If you purchase faster DRAM chips for your main memory, you can change the BIOS settings to tell the memory bus controller to take advantage of the higher DRAM speed. The CMOS memory is volatile, but, its contents are preserved by a tiny battery on the motherboard when the computer is turned off. Because the battery is recharged by the motherboard, it can last for years; however, if it were disconnected or drained of energy, the BIOS would revert to default parameter settings. Therefore, it is important that CMOS has low power consumption. The major drawback of CMOS technology is that it is slower than regular DRAM, but, that does not matter if the memory is only used for BIOS parameter settings, since the contents are only needed during startup.

Page 92: iCarnecie SSD2 Book

When power is applied to the system and the BIOS begins to execute, the BIOS initiates the POST (Power-On Self Test) sequence. First, it enables the video card (you will see the screen flash) and displays some basic information like the type of video card installed, the name of the BIOS manufacturer, and the BIOS version number. It then determines the amount of DRAM installed in the system, and it may perform a memory test. Whether or not it does, the test is controlled by yet another BIOS parameter setting. (On systems with a lot of memory, disabling the memory test will allow the computer to boot up more quickly.) The memory configuration and test results are displayed on the monitor. Then, after determining what expansion cards and adapters are present, the BIOS initializes those cards and adapters. At the conclusion of the POST sequence, the BIOS displays system configuration information, such as the type of processor installed, cache memory information, the types of each of the disk drives it found, the addresses of any serial and parallel ports, and a list of other expansion cards it detected.

Once the POST sequence is completed, the next job of the BIOS is to load in a program that will in turn load the operating system. In order to do this, the BIOS has to know just enough about disk drives to be able to read in one chunk of data, called the Master Boot Record, or MBR. By convention, this is the first sector of the first track of the disk. The MBR program then loads in the operating system and starts it running.

On a system with multiple disk drives, which one should be used to load the operating system? The BIOS follows a search order to find an operating system to load. It begins by looking in drive A, which is normally a floppy drive. If there is no disk in that drive, or if the disk does not contain a master boot record, then it looks in the drive B (second floppy drive), if one exists. If unsuccessful there, it moves to the drive C, which is normally the main hard disk drive, and looks for a master boot record there. And so on.

Checking the floppy drive first turns out to be very useful, because unlike the hard drive, the floppy is a removable medium. So, if you do not want to load the version of the operating system that is stored on the hard drive, all you have to do is insert a boot disk in drive A and the computer will boot from there. A boot disk is a floppy that contains a bootable copy of some operating system. If the version of the operating system on the hard drive ever becomes corrupted, perhaps due to a system crash, the only way to get the computer running again is to use a boot disk. Then you can get to work repairing the damaged data on the hard drive.

A computer that can be booted from a floppy drive is not fully secure. Your private files are normally protected by the operating system's refusal to allow other users access to them. But, if someone slips a boot disk into drive A, they can boot their own version of the operating system that ignores file protections and permits access to everything on the hard drive. The only guaranteed defense against this type of attack is to encrypt the disk. Another risk associated with bootable floppy drives is MBR viruses. These viruses live in the master boot record of a floppy disk. If someone leaves an infected floppy in drive A, the next time the system boots, the virus can infect the hard drive.

Some BIOSs will allow you to change the search order used for booting. This is useful if you want the system to boot by default from a CD-ROM drive, or from a server on the local network, rather than from the hard drive. You can also disable booting from the floppy drive if security is a concern.

Changing BIOS Settings

To change BIOS settings, you must enter the BIOS setup program during the boot sequence, by pressing a specified key or key combination, such as F2 or ALT+CTRL+ESC. The initial message the BIOS displays will tell you what keys to press. The setup program shows you the current BIOS settings and allows you to change them. It stores the new settings in CMOS memory so they will be available the next time the machine is turned on. Care should be taken when modifying BIOS settings, because the wrong settings can make the computer unusable.

Page 93: iCarnecie SSD2 Book

You can learn more about BIOS from the BIOS entry in the PC Guide. If you are planning to change your BIOS settings, read the BIOS Survival Guide first.

3.1.3 Process Control

Another job of the operating system is to keep track of all the processes that are currently trying to execute, assuring that each gets a chance to execute reasonably often. A process is an instance of a running program. It includes a set of memory pages, a set of open file descriptors (if the process does any I/O), a process ID, and several other things. The kernel maintains a list of every process in the system. This includes whatever programs the user is running, plus various programs that implement parts of the operating system outside the kernel, such as printing and network support. Each process can be in one of several states: running, runnable, or blocked. Only one process per CPU can actually be running at a time, although any number can be runnable. A blocked process is one that is waiting for some event to occur. For example, the print spooler is blocked most of the time; it only becomes runnable when the user selects the Print command that activates the process.

On a Windows machine, you can see a list of current tasks and processes by invoking the Task Manager. (In Windows, a task is an application the user is running; it appears on the task bar. A task is implemented by one or more processes.) 3.1.4 Lab: The Task Manager lists the steps needed for you to use the Task Manager. On a UNIX machine, the ps and top commands display process information.

The kernel maintains a queue (also called the run queue), or waiting list of runnable processes. In order to give the illusion that all these processes are running at once, it uses a trick called preemptive multitasking. While there are other types of multitasking, preemptive multitasking creates a better illusion than the rest. This trick depends on having a real-time clock that can generate interrupts at a regular rate. The clock interrupts give the kernel a chance to look at the run queue and see if some other process should be given a chance to run now. If the answer is yes, the currently running process is preempted. Its state is demoted from running to runnable, its execution progress is noted, and its register contents are saved so the process can be resumed later. Processes that become blocked also generate these types of interrupts, but the answer to the preceding question is always yes. Then another process in the run queue is selected to run. If the kernel switches processes frequently enough, it appears to the human user as if all the processes are executing at the same time. Now you know the secret of the illusion!

If preemptive multitasking is a good idea, why not switch processes as frequently as possible, say, after every instruction? The reason the kernel does not do this is that switching from one process to another requires a context switch, which takes a bit of time. To perform a context switch the processor must flush its pipeline of executing instructions, save all the register contents, load a new page table, etc. This imposes a certain amount of overhead on each preemption. So, the optimal strategy is to do context switches only as often as needed to ensure fair service to all processes.

Some applications require multiple processes to perform their function. For example, in order for a Web browser to support multiple windows open simultaneously (each downloading a different page or running a different Java applet) the browser needs to create a process for each window. But, having lots of processes is expensive, because each requires its own address space, page table, file descriptors, etc. And, many applications that implement multitasking do not require this degree of separation between their processes. Therefore, newer operating systems provide for lightweight processes, called threads, which all live in the same address space and share their file descriptors.

Page 94: iCarnecie SSD2 Book

3.1.4 Lab: The Task Manager

Using the Windows NT or Windows 2000 Task Manager, you can examine processes that are running, the number of threads a process has, system performance, and page faults. Windows 9x/Me has a simpler task manager, but it can still show running processes.

Learning Exercise:

If you are using Windows 9x/Me, follow these steps:

Bring up the Task Manager (Close Program in Windows Me) window by pressing ALT+CTRL+DELETE. You should see a list of application and operating system processes currently running. Some of these names may appear cryptic; these typically make up a list of processes that are part of the operating system or automated environment.

Start some application and you will see it added to the list of processes. You can also use the Task Manager to kill a process. This might be necessary if the process becomes "hung" or stalled, and will not respond when you try to close the application window. A stalled program is indicated by a "Not Responding" message after the process name in the Task Manager. Be careful, though: if you kill one of the operating system's processes, your computer may no longer function properly, although rebooting should correct the problem.

If you are using Windows NT/2000/XP, follow these steps:

Bring up the Task Manager window by pressing ALT+CTRL+DELETE and clicking the Task Manager button.

Select the Applications tab. You should see a list of all applications currently running.

Now select the Processes Tab. Then, on the View menu, click Select Columns, and check the Page Faults and Thread Count boxes. You can uncheck some of the other boxes if you wish. Then click OK.

While keeping the Task Manager window visible (you may want to scroll down to the bottom if there is a long list of active processes), start up a new process, or make active a process that is already running. You should see the number of page faults and the CPU usage figures increase. Now click the Performance tab, and you will see graphs of processor and memory usage.

Start some applications and you will see the processor and memory resource demands that they place on the system. You can also use the Task Manager to kill a process. This might be necessary if the process becomes "hung" or stalled, and will not respond when you try to close the application window. Be careful, though: if you kill one of the operating system's processes, your computer may no longer function properly, although rebooting should correct the problem.

3.2 Device Management and Configuration

Another one of the operating system's functions is to manage the various I/O devices installed on the computer. Control of the hardware at this level requires interaction between the kernel, the device drivers, and the BIOS. Users can sometimes fine-tune the performance of their computer systems by modifying parameters that determine how the operating system or device drivers treat a peripheral.

Reading Sequence:

3.2.1 Interrupt Handling . Learning Goal: An understanding of how the operating system responds to interrupts. An interrupt is a signal to the processor that an important event has occurred.

Page 95: iCarnecie SSD2 Book

3.2.2 Hardware Attributes . Learning Goal: An understanding of how a driver can be replaced with a more recent version and where the data that customizes the operating system's actions for a particular hardware device or user environment is kept.

3.2.3 Configuration . Learning Goal: Knowledge of how a user can customize the functionality of a Windows system via the Control Panel and other facilities.

3.2.4 Lab: Device Management . Learning Goal: Experience viewing and modifying your operating system environment to meet your specific needs.

3.2.1 Interrupt Handling Interrupts Interrupt Priority and Nested Interrupts

Traps and Faults

Interrupts

One of the important jobs of the kernel is to handle interrupts. An interrupt is a signal to the processor that some event has occurred that requires immediate attention. Often these events are associated with an input/output operation, but there are other kinds of interrupts as well. The kernel figures out what caused the interrupt and makes an appropriate response. It must act very quickly. In order to avoid losing information when the next interrupt arrives, it must handle each interrupt in less than a thousandth of a second.

To see how interrupts are handled, let us look at how people do it. Suppose you are sitting at your desk at work, reading a manual. Maybe it is the documentation for some new software you have purchased. After you have read a few pages, a courier walks in, apologizes for interrupting you, and asks you to sign for a package. To respond to this interruption, you first place a bookmark in the manual to mark your place and then lay the manual down. Now that your hands are free, you sign for the package and place it off to the side of your desk where you will deal with it later. Then you pick up the manual again, open it to the bookmark, and resume reading.

The kernel handles interrupts in pretty much the same way. Here are the steps involved in responding to a keyboard interrupt, which occurs every time you press a key. Before you press the key, the processor is busy running some program or other. Let us assume you are using the computer to edit a Web page, and the processor is busy figuring out how to display some image file you have just loaded. While it is doing this, you reach forward to type the letters "http" on the keyboard. As soon as you hit the "h" key, the keyboard transmits a byte of data to the PS/2 keyboard interface on the motherboard. The interface then needs to interrupt the processor and hand off this byte of data to the keyboard driver. It must do this very quickly—before you hit the "t" key—otherwise there is a danger that the next keystroke will be lost.

The keyboard interface sends to the processor a signal called an IRQ (interrupt request). When the processor receives this signal, it stops executing the application program (a Web page editor in our example), making note of the address of the last instruction executed. Then, it jumps to the address of the keyboard interrupt handler, and starts executing the instructions it finds there. Because the processor's registers contain whatever data the user program was manipulating at the time, the interrupt handler must save the contents of these registers before it can use a register for its own purposes. After saving the registers, it is free to examine the state of the keyboard interface and accept the byte of incoming data. It places this byte in a storage area that will be checked by the keyboard driver the next time it runs, perhaps a millisecond from now. Then the keyboard interrupt handler restores the contents of the saved registers and transfers control back to whatever task was executing previously (the Web page editing application), resuming execution at the exact spot where the interrupt occurred. Everything is over in a few hundred microseconds; the application program has no idea that it was interrupted.

Page 96: iCarnecie SSD2 Book

Interrupt Priority and Nested Interrupts

Two additional concepts will complete our discussion of interrupts. First is the notion of interrupt priority. Suppose two people walk into your office at the same time. (Or, one person walks in, and before you can even look up from your desk, another one walks in.) If one of these persons is your company's biggest and most impatient customer and the other is a traveling sales person, you would handle the impatient customer's needs first and have the sales person wait. The customer has higher priority. The processor also assigns priorities to different types of interrupts. Low-speed devices like the keyboard have low priority. High-speed devices like a SCSI disk have high priority because they need a rapid response in order to function optimally.

Next, there is the notion of nested interrupts. Suppose you are reading your manual when someone walks in to ask you a question. You put down the manual, listen to the question, and then get out a reference book to try to look up the answer. As you are doing this, the phone rings—another interruption! So, you mark your place in the reference book, put it down, and answer the phone. The person standing by your desk is going to have to wait a little while. When your phone conversation is finished, you pick up the reference book again and finish answering the person's question. Once that is done and they have gone away happy, you can pick up your manual and resume reading. Think of the second interruption as being nested inside the first.

Interrupts cannot be nested infinitely deep because in general an interrupt handler can only be interrupted by a higher priority interrupt. So, if you were already on the phone when someone else tried to call you, the second caller would have to wait until you hung up from the first call. Likewise, I/O devices may be prevented from interrupting the processor right away if it is already handling a higher priority interrupt.

Traps and Faults

A trap is an event similar to an interrupt, except that instead of being triggered by an external signal, traps are triggered by the execution of processor instructions. An example is a division-by-zero operation. If a user program attempts to divide a number by zero, the execution cannot safely continue. The processor "traps," which is very much like handling an interrupt but without the time pressure. The trap handler might print an error message and terminate the user program, or it may respond in some other way, such as forcing the result of the division instruction to be zero and allowing the program to continue. Another common use of traps is when application programs make requests of the operating system. The application loads information about what it wants into a register and then uses a special trap instruction to catch the operating system's attention.

A third type of event you should know about is called a fault. A fault occurs when the hardware is asked to do something it cannot do, such as access a nonexistent memory location. (C programmers who use pointers are likely to encounter this type of "nonexistent memory" fault until their code is debugged.) Faults can also occur if the memory's error correction circuitry detects an uncorrectable error, attempts to divide a number by zero, or if the program contains an illegal machine instruction. Faults and traps are handled similarly.

3.2.2 Hardware Attributes Installing Drivers Changing a Driver's Configuration

Installing Drivers

As previously discussed, each device must have a corresponding driver in the operating system to manage the commands, the transfer of data, and the error conditions that occur. Each operating system specifies an interface that a device driver must utilize. This means that for any particular device, it must have a

Page 97: iCarnecie SSD2 Book

corresponding driver for the operating system where it is intended to be used in order to be functional. Even versions of the same operating system (such as Windows 3.1, Windows 98, and Windows NT) may use an interface requiring a different driver. Also, a similar but different product from the same company will most likely require its own driver, because of some minor or major changes in how the device interacts with the software.

Drivers are supplied either with the operating system's distribution files, or individually from the manufacturer of the hardware device. At the time of a release of an operating system such as Windows, many of the most popular and well-known devices (printers, modems, scanners) will be tested and included with the release. However, less well-known brands or hardware products released later than the operating system will not be included. That is why each hardware device usually has an accompanying floppy or CD containing drivers for most of the operating systems available in the marketplace. If provided, a driver that comes packaged with a hardware device is always better to use than one that came with the operating system, since the driver packaged with the device is probably a more recent update containing better functionality, while correcting known errors.

The driver that accompanies a hardware device should allow you to use the device adequately. However, since products are shipped many months in advance of your purchase, there is high likelihood that more reported problems are corrected in the latest version of the driver on the company's Web site. Always check the company's Web site to see if a more recent version exists.

When you are installing a new hardware device under Windows, it most likely will be detected after a boot by the Plug and Play (PnP) control mechanism. If the device supports PnP, Windows should inform you that it found a new device and should ask you for the location of the driver. The driver can either be part of the Windows distribution itself (requiring you to use the Windows CD), a floppy, a CD, or a folder on the hard disk where you previously downloaded the driver from the Internet. If an appropriate driver is not found, Windows will be unable to use the device.

If you install a device and Windows does not recognize it, you must use the Add New Hardware wizard to install the device driver and have it recognized under Windows. This wizard allows you to have Windows search again for the device or for you to specify the device. There are a number of steps involved with manual installation, and the wizard attempts to lead you through entering the appropriate information. If you update a device driver, there is an "update button" associated with each device for you to perform this function manually. The process is similar to installing a driver for the first time, and the appropriate files must be on a disk to complete the update.

Changing a Driver's Configuration

A driver is designed to operate in a particular fashion, but it may also include a number of operations to customize its functions for a particular user or system environment. Features to be modified include those that match some particular hardware or system requirement (such as the transfer speed of a modem, how much data to buffer, what protocols should be used, etc.), and those that are user-oriented (what is your screen's resolution, what wallpaper to display, whether the mouse should function as a left-handed mouse, etc.).

Most devices and software modules in the operating system that manage resources have an applet installed in the Control Panel window to present a user interface for changing some of these options. (The Control Panel is listed under Settings, which is on the Start menu.) This is the most convenient method of changing the parameters that affect a driver's or resource manager's operation. Depending on the change, it may take effect immediately or require the operating system to be rebooted to take effect.

Page 98: iCarnecie SSD2 Book

Another means for changing a driver's configuration on Windows 95 or 98 is the Device Manager function. (Right-click the My Computer icon, click Properties, and then click the Device Manager tab.) Device Manager presents information either about your computer as a whole or about an individual hardware component. By selecting a specific device and selecting to view its properties, you can change various functions. If you are using Windows NT, you can view (but not modify) much of the same information using Windows NT Diagnostics, which you can get to by clicking Programs on the Start menu and then clicking Administrative Tools.

Since you as the user of a home computer are also its administrator, all of the environment and user settings are under your control. However, you should take a great deal of caution before making any changes, as it may make the device or even the entire computer unusable unless a reinstallation is performed. Because of the possible problems that can occur with these changes, most computers in a business or school environment prevent all users except the "system administrator" from making these changes.

When you make a change to the operation of the system, the related data needs to be saved so it can be referenced the next time the system is rebooted. Operating systems such as UNIX keep all configuration information in text files that an administrator can change through a simple text editor. Windows started out similar to UNIX in keeping configuration information in text files (such as WINDOWS.INI, SYSTEM.INI, CONFIG.SYS), but later versions consolidate all configuration information (including application information) that is installed into several binary files, which are collectively called the Registry. The registry has its own editor (either REGEDIT or REGEDT32) for viewing and modifying the information. Due to the cryptic nature of this information, novice users should rely on facilities such as Control Panel to modify its contents. However, some drivers and resource managers have options that cannot be accessed through Control Panel and can only be modified directly in the registry.

Utilities exist for backing up or restoring the registry on a regular basis, or before making any major changes to hardware or installing new applications on the computer system. If the system should become unusable after installing a new program or making a change through Control Panel, the registry can be restored to its prior settings to make the system functional again, performing as it did at the time the registry was backed up.

3.2.3 Configuration

The operating system, like the lower level BIOS, is configurable. Each user works in a different way, with different demands and usage styles. The right configuration of the operating system can improve aesthetics, convenience, and performance. The configuration options described here are from the Windows NT 4.0 operating system, but similar features can be found in other Windows systems.

The most conspicuous operating system configurations are the aesthetic ones. In Windows, users can set preferences for the "look and feel" of the desktop and file system. It seems that no two desktops are alike. Views can be set to adjust how icons appear and what information appears within file listings, such as file sizes and types (under the View menu of My Computer or of Explorer, click Folder Options...). The desktop itself can use a variety of color schemes and can even contain graphics in various layouts. To adjust the size of the viewing space, the monitor resolution can be set by right-clicking an empty spot of the desktop and then clicking Properties on the shortcut menu.

Toolbars appear at various places and are themselves customizable. Most toolbars contain buttons representing shortcuts, and some contain text fields in which Web addresses or even file system paths can be typed in order to navigate to those items quickly (right-click an empty spot on the taskbar and then click either Toolbars or Properties). Even the way numbers, time, and monetary values are represented can be customized (open the Control Panel and click Regional Settings).

Page 99: iCarnecie SSD2 Book

Other elements like font styles and sizes can be changed to something more comfortable or pleasing. Some users set fonts large for easy viewing, while others enjoy strange fonts (right-click an empty spot on the desktop, then click Properties, and then click the Appearance tab). There is an array of sound themes to choose from, like jungle sounds and sounds from musical instruments (open the Control Panel and select Sounds).

For convenience, users can take advantage of the User Startup Folder, which is the first Startup folder that appears under Programs on the Start menu. Program icons, usually shortcuts, which appear in this folder, will be started automatically each time the user logs on. For example, users who read their mail first thing after logging on can place a shortcut to the email client in the Startup folder and have it start automatically after log on. Shortcuts themselves are a form of customization, allowing the user to invoke programs and represent files from a variety of places in the file system (right-click an icon and then click Create Shortcut). Things like mouse tracking properties (open the Control Panel and click Mouse) and keyboard repeat rates (open the Control Panel and click Keyboard) can also be set. Some users have a difficult time double-clicking quickly, and, therefore, these users adjust the speed at which double-clicking is accepted to be adjusted. Some mice and keyboards go further by allowing the user to attach functions to certain mouse buttons or keyboard keys. This functionality will be provided with the keyboard or mouse via accompanying software.

Performance can even be tweaked a little from within the operating system. By clicking System from the Control Panel, you can adjust the default search path, virtual memory parameters, and similar items. The search path tells the system what directories to look in to find an application. Rearranging the order of directories on the search path can speed up the time it takes to locate executables. Decreasing the amount of virtual memory provided will mean less memory is available to hold open files and running programs, but it also may increase system performance on those that remain. Such adjustments are usually left to advanced users, as the default settings are usually close to optimal for most configurations. Even reducing the number of displayable colors and the resolution may speed processes up, although this is not generally noticeable except in graphics-intensive games and applications.

3.2.4 Lab: Device Management

This activity provides a user with an overview of how to access some of the Windows device management capabilities.

NOTE #1: Use caution when performing this lab. None of the steps involves actual changing of your computer system's configuration. However, you could inadvertently click on an option in one of the windows that specifies a change. If this occurs, use the Cancel button that should appear for each dialog box, which will discard any changes that you selected.

NOTE #2: It may not be possible to perform this lab on some Windows computers. Viewing and/or changing of configuration information may be prohibited by the system administrator of your company or school to avoid problems such as that described in NOTE #1.

Learning Exercise:

If you are using a Windows 95/98 computer, use the following procedure to view device hardware configuration settings:

Examine device properties through the Device Manager. Right-click the My Computer icon on your desktop, click Properties, and then click Device Manager tab. This window shows a hierarchical view of the system resources starting with "Computer." Each device category can be expanded to show the specific types of

Page 100: iCarnecie SSD2 Book

devices that Windows recognizes on your system.

With "Computer" highlighted, you could click the Print... button to get a complete listing of all of the hardware and system resource settings, along with the version number of the driver being used. This printout may take from three to ten pages depending on your print settings and actual hardware configuration, so you may not want to do this.

Select "Computer" and then click the Properties button. The resulting window will allow you to select the proper radio button and see all devices using certain IRQ values and other resource information.

Expand some of the device categories by clicking the plus sign ( + ) appearing before the device category name. If a specific device has a problem as far as Windows is concerned, there will be a yellow circle with an exclamation point ( ! ) (indicating a warning for a possible problem) or a red circle with an "X" (indicating that the device is not functioning). Determine what, if any, devices may have problems on your system.

Clicking a device icon brings up a window with a set of tabs. Depending on the type of device, the window will differ in both the title and the number of tabs. Try this on several devices; modems and network adapters are some of the more interesting ones.

Look for a Driver tab and click it if it exists. This window should show the file name and version of the driver currently installed, as well as an Update Driver button for upgrading the driver to a newer version.

Look for a Resources tab and click it if it exists. This window shows which IRQs and Input/Output range of addresses are used by this device, and whether a device conflict exists with respect to another device in using these settings.

Click Cancel to close Device Manager.

If you are using Windows NT, use the following procedure to view device hardware configuration settings:

Examine device properties through Windows NT Diagnostics. Click the Start button, then Programs, then Administration Tools (Common), and then Windows NT Diagnostics.

Click the Resources tab, and click the buttons at the bottom of the window to view how IRQs, Input/Output addresses, and other resources are assigned to devices on your system.

Click the Devices button to view a list of hardware devices that are considered part of your computer system.

Click OK to close Windows NT Diagnostics.

On any version of Windows, use the following procedure to view the tools available in Control Panel that can be used to change both system settings and customize their operation for a particular user.

On the Start menu, click Settings and then click Control Panel. Note the devices and services that appear in the window.

Examine the keyboard attributes using the Keyboard Properties window. Using its various tabs, note how you can indicate to the driver what type of keyboard is being used, what language-key layout is used, repeat key (continue pressing the same key) characteristics, and the cursor blink rate. You can try changing the repeat key and cursor blink characteristics and see their impact. Click Cancel to close the Keyboard Properties window.

Examine the mouse attributes using the Mouse Properties window. Using its various tabs, note how you can indicate to the driver what type of mouse is being used, how the pointer should move on the display, how

Page 101: iCarnecie SSD2 Book

responsive it should be to a double-click, and if the functions of the buttons should be reversed for a left-handed person. You can try changing the functionality of the left-hand button and the double-click speed and see their impact. Click Cancel to close the Mouse Properties window.

Examine the display attributes using the Display Properties window. Using its various tabs, note how you change the screen saver, wallpaper, text appearance, number of colors, and the resolution. Do not make any changes to these settings. Click Cancel to close the Display Properties window.

Use the Sound Properties window to examine which sounds are used by Windows to alert a user to various events. You can add sounds or remove them. You can preview a sound or change to an entirely different sound scheme to customize sounds on a per-user basis.

To experiment with sound assignments, first select an event type, such as "Windows: Asterisk". Click the Preview play button to hear the sound currently assigned to that event. Then use the Name drop-down list to select another sound for that event. You can use the Preview play button to listen to your selection. Do not make any permanent changes to these settings. Click Cancel to close the Sound Properties window.

Close the Control Panel window.

3.3 Resource Sharing

In this module, we are going to look at the operating system as a mechanism for resource sharing. We will see that many aspects of operating system function can be explained in those terms. In the course of explaining how sharing works, this module covers most of the components of the computer system. The computer system not only shares many of its internal resources, such as the processor, but also its external resources, such as the hard disk drive.

Reading Sequence:

Review 3.1.3 Process Control. Learning Goal: Multitasking is a way of sharing the processor so that several tasks can appear to execute simultaneously even though there may be only a single CPU. The operating system includes a component called a scheduler to ensure that no task uses so many processor cycles that the other tasks can't run. The scheduler manages the shared resources of the system, giving limited time to each process before reevaluating priority.

3.3.1 Virtual Memory . Learning Goal: Processes must share the available memory on a computer. If there is not enough RAM to meet all requests, the operating system can juggle memory pages between RAM and disk as needed, so that all tasks can continue to run. This scheme is known as virtual memory.

Parsons/Oja, Chapter 5-Section D. Learning Goal: Networking allows multiple users to share drives, files, and printers. There are advantages to sharing these resources, such as the possibility of having several people work on one central project, and disadvantages, such as the difficulty of providing adequate security.

3.3.2 File and Printer Sharing . Learning Goal: Apply the information learned in the previous reading to understand more about file and printer sharing security and functionality.

Review 3.2.1 Interrupt Handling. Learning Goal: When multiple tasks are running at the same time, they must share the monitor, keyboard, and mouse. This is a function of the part of the operating system known as the window system. A task does not display data directly on the monitor or read data directly from the keyboard. Instead, each task has one or more windows associated with it, and it reads and writes data through these windows, which function as a virtual screen and keyboard. Understand how the operating system processes data for these resources.

Page 102: iCarnecie SSD2 Book

3.3.1 Virtual Memory Managing Memory Relocation

Virtual Memory

Managing Memory

Managing the system's memory is an important job of the kernel. A typical personal computer today will have 64 MB or more of main memory (DRAM). Some of that is reserved for the operating system, but most of it is available for user programs. Let us say a user is running a Web browser, an editor, and a computer game. Each of these programs needs a certain amount of memory, but none of them needs access to all the memory. The kernel allocates some memory to each program and keeps track of what program is using what.

Modern operating systems such as Linux and Windows provide virtual memory, to increase program flexibility. (We will say more about exactly what virtual memory is, later.) To understand why virtual memory is useful, let us start by looking at how older operating systems like MS-DOS worked. In those systems, all programs ran in the same real address space, since there was no virtual address space.

Executable programs, written in binary machine code, contain instructions and data. Both instructions and data contain memory addresses. So when you write a program in machine code (or a compiler translates your high-level language into machine code for you), you (or the compiler) must calculate the address for every instruction and every piece of data. Let us say you start at zero and lay out all your instructions and data in sequence, so your entire program occupies memory addresses 0 through 8,462. Now, suppose everyone else writes their programs the same way, starting at address 0. Obviously, you cannot run two programs that occupy the same memory addresses at the same time with this scheme—since as soon as you load the second one, it will overwrite the first.

Relocation

A solution that was invented before virtual memory was to write programs in a special way. Any memory location that contained an address was specially marked in the binary file. When the user tried to run the program, the operating system would allocate memory for it somewhere and load the program into that memory area. As it did so, it would "fix up" all the specially marked address references so that they pointed to the correct locations. For example, let us say the original program contained a table of information starting at memory location 700. Another part of the program—say, at location 210—contained the address of the table (i.e., the value 700) and was specially marked as containing an address. The operating system loads this program into memory, beginning at location 30,000. As it does so, it changes the value in location 30,210 from 700 to 30,700, and so on. This process is called relocation.

This scheme allows the computer to load multiple programs in memory at once, in whatever portion of memory is available at the time. Its advantages are that it is simple to implement and does not require any changes to the hardware. But, it also has some serious shortcomings. First of all, because of the way relocation works, the memory allocated to the program must be contiguous. Suppose the user is running a half a dozen small programs at the same time. After some of these programs have exited, programs 1, 3, and 6 are left running. Now the user wants to run a big application, but unfortunately, there may now be nowhere to put it. If the application cannot squeeze into the space that was used by program 2 or by programs 4 and 5 together, then it cannot fit into memory, even though the total number of noncontiguous free blocks of memory may be more than adequate.

Page 103: iCarnecie SSD2 Book

Another drawback of this approach is that the size of a running program is limited to the amount of physical memory installed on the machine, minus whatever the operating system has reserved for itself. But, large programs do not normally use all their memory at once. A program with a large address space may only need to access a few thousand instructions and a few thousand bytes of data at a time. It would be more efficient to allocate only a little bit of RAM at a time to such a program and to keep the rest of its address space somewhere else, such as on disk. This is what virtual memory allows us to do.

Virtual Memory

In a virtual memory system, every program runs in its own private address space. Thus, there is no need for any relocation when the program is loaded into memory. A virtual address space can be larger or smaller than the processor's physical memory. In order for this scheme to work, though, virtual memory requires hardware support. First, memory is divided into chunks called pages. A page is the smallest piece of memory that can be allocated to a program. On Pentium platforms, a page is 4 KB. Second, the processor must have a way of turning virtual addresses into real ones.

Processors that support virtual memory, such as the Pentium, can run in two modes. In real mode, addresses refer to physical locations in RAM. Only the kernel is allowed to run in real mode. In virtual mode, every address is "translated" into a physical memory location by means of a page table. For each page in the virtual address space, the page table gives the real address in RAM where the page is located.

Let us see how this applies to the hypothetical program described earlier. This program will run in its own virtual address space, starting at location zero. When the processor loads the program into RAM starting at location 30,000, it sets the page table entry for page 0 to the value 30,000. Now, when an instruction loads the address at virtual location 210, the processor's address translation circuitry actually causes the data to be loaded from physical location 30,210. The value read from that location in memory will be 30,700 (remember, location 210 holds the address of the table, which is 700), the virtual address of the table. If another instruction then tries to access the table by using this 700 address, once again the address translation mechanism will intervene and convert the reference to location 30,700. The user program only deals with virtual addresses; it has no idea in what portion of physical memory it is running. When the processor is in virtual mode, address translation is happening all the time. Every single memory reference is translated. It happens very quickly because translation takes place on board the processor chip.

With a virtual memory scheme, every program has its own page table, maintained by the kernel. And, physical memory allocated to a program need not be contiguous. Our hypothetical program's page table could say, "Okay, page zero begins at real address 30,000; page one begins at 34,000; page two begins at 62,000; and so on." The user program has no idea that it is spread out across physical memory, because it is living in a virtual world and cannot see the real addresses.

With a little extra help from the hardware, we can carry this scheme one step further and completely divorce virtual memory from RAM. Let us say we do not want to load the entire program into RAM at once, so we only load a couple of pages. For those pages we choose not to load, we put a special marker in the page table that says, "This page is not in RAM." Now the user program starts running, and it makes a memory reference to page zero that is translated nicely. It makes a memory reference to page one, and the processor again looks at the page table and finds the corresponding physical address. Then, the program refers to a memory location that falls on page seven, which we did not load into RAM. The address translation circuitry checks the page table, finds the "not in RAM" marker, and generates a page fault. This is a kind of interrupt. The processor stops executing the user program and gives control to the kernel. The kernel looks at certain status registers to figure out where the page fault came from and says, "Oh, this process wants access to its virtual page seven. I will get some RAM here and load in page seven of the program. Now I will fix update the page table, and I will let the program the instruction again." So, control is returned to the user program, and the program continues as if nothing unusual had happened.

Page 104: iCarnecie SSD2 Book

With hardware paging support, user programs really do live in a virtual world. Not only do they not know which chunks of RAM they are using, they do not even know which of their pages are in RAM right now and which are sitting on disk! Every time the process tries to reference a page that is on disk, the page is moved to RAM. And, if the process has not touched a page in a while, it might be moved back to disk. By introducing virtual memory, we have provided user programs with a very clean memory abstraction. They need not worry about sharing the address space with the operating system or with other applications. They need not worry about how much physical memory is on the machine. They have an entire virtual address space to use as they like, and the kernel takes care of the implementation details.

One drawback of using the hard drive for virtual memory is that this can keep the hard drive so busy that access to other files is delayed. For systems that involve frequent file accesses but also require virtual memory, it may be advisable to put the swap file (the file containing all virtual memory pages) on a separate drive.

3.3.2 File and Printer Sharing Files Printers

Files and printers are resources of the computer that are shared in a networking environment, allowing many users to access one drive, file, or printer remotely.

Files

Files may be shared between applications, such as when a graph created in Excel is linked into a Word document. Files may also be shared between users over a network. But, some files will need to be kept private; other users should not be able to access them. To accomplish this, the operating system defines a set of permissions for a file or directory. These permissions, also called Access Control Lists (ACLs), determine who can read, write, or execute the file. Read access allows the user to read the file. Write access allows a user to modify or delete the file. Execute access allows the user to perform special system operations—such as viewing the contents of a directory or executing a program. In Windows NT, you can examine a file's permissions by right-clicking the file icon, clicking Properties on the shortcut menu that appears, and then clicking the Security tab.

Printers

Printers are shared between applications, between users, and even between machines. When a file is to be printed, it is handed off to a part of the operating system called a print server that maintains a queue of print requests. The server processes requests one at a time. As requests come in, they are stored on disk, in a process known as spooling. ("Spool" stands for Simultaneous Peripheral Operation Online). Spooling allows the process issuing the print request to go on to other things; it does not have to wait for the document to complete printing. If the print server can communicate over a network, then print requests can be accepted from other machines. A typical example is a computer lab where all the computers share a single print server. This is more efficient than installing a separate printer on each machine.

3.4 File Systems

A file system is an abstraction for organizing data on mass storage media such as hard drives, floppy disks, and optical disks. The file systems are managed by the operating system of a computer. In this section, you will learn about how files are organized on a Windows operating system, as well as how file systems work.

Reading Sequence:

Page 105: iCarnecie SSD2 Book

3.4.1 File Organization . Learning Goal: Understand the organization of a hierarchical file system.

Parsons/Oja, Chapter 4-Sections D and C. Learning Goal: Understand how files are organized into folders (also called directories), how users can browse through those folders using a file manager program of an application or the operating system, and how files and folders are physically stored.

Parsons/Oja, Chapter 4-Lab B: "Working with Windows Explorer". Learning Goal: Gain practical experience using file management tools.

3.4.2 File Allocation Table and NT File System . Learning Goal: Obtain knowledge of how file systems work.

3.4.1 File Organization Files Folders

Drives

Paths

Shortcuts

File Names and Types

One of the main things computers are used for is storing and retrieving information. The information is stored in one or more "files," which in turn are organized into "folders." The Microsoft Windows file system supports four kinds of entities: files, folders, drives, and shortcuts. The figure below illustrates how files are organized from the perspective of a Windows operating system user.

Page 106: iCarnecie SSD2 Book

Figure 1 File organization in a Windows operating system

Files

Each file contains some data. When a file is associated with a particular application, such as Microsoft Word, Excel, or Power Point, it is often called a document. Every file has a name. In Windows, file names can be up to 255 characters long and can contain letters, numbers, and certain special characters, including spaces. Although Windows allows use of both uppercase and lowercase letters in a file name, the distinction is ignored by the file system. Thus if you create a file named Friends, you can also access it as friends or FRIENDS or even fRiEnDs. Other operating systems, such as Unix/Linux, are sensitive to capitalization. In these operating systems, the files Friends.txt and friends.txt are different.

Every file also has a set of properties associated with it. The most important property is the file type, which indicates to the operating system what application to use to open the file. Other properties include the size of the file, the date and time the file was created, and the date and time the file was last modified. You can view a file's properties by clicking with the right mouse button the file icon and selecting Properties on the pop-up menu. If you have access to a Windows machine, try this now. Another way to see file types and sizes is to go to the View menu in the Folder window and click Details.

Folders

Files reside in folders, which are sometimes called directories. Folders have names and properties too. And, like files, every folder has a residency: it is located in another folder called its parent. This gives the file system a hierarchical structure, like a family tree. That is where the term "parent" comes from. Another good analogy is a company organization chart, where every employee has a boss above him, except for the president at the top. The top of the folder hierarchy is called the root.

Page 107: iCarnecie SSD2 Book

The file system will not permit two items in a folder to have the same name. You can verify this by creating two files in your working folder called file1 and file2. If you then try to change the name of file2 to file1, you will get an error message, and the change will not be completed. In the diagram above, there are two files named sales.xls, but they are in different folders.

Drives

Folders are housed in the computer drive. A computer can have many drives, drive A, drive C, drive D, drive E, etc. One way to access the drives is by double-clicking on the icon named "My Computer" on your Desktop. This icon is normally located in the upper-left corner of the Desktop. After you double-clicked on the My Computer icon, you will see that each drive is labeled by an icon that indicates the type of medium the drive uses. For example, the hard drive icon is a picture of a hard drive, and the optical drive icon is a picture of a CD-ROM. Clicking a drive's icon will take you to the root directory of that drive.

Paths

Since items in different folders can have the same name and folders can be nested within other folders, we need a way to instruct the operating system or an application exactly which object (that is, which file or folder) we are referring to. We can do this by specifying the complete path to the object, from the root directory. The first sales file in the diagram above can be reached via the path C:\Dave\1998\sales.xls. As you can see, a path contains a drive designator and a sequence of folder names separated by backslashes—and then, if we are referring to a file, the name of the file itself. The path to the root directory on this drive is written C:\ . You can get Windows to display the full path in the title bar of a folder window by going to the View menu and selecting Options. Then go to the View tab and select the check box labeled Display full paths in the title bar.

Shortcuts

A shortcut is an alternate way to reach a file. Shortcuts have names and live in folders just the way files do. But, a shortcut does not actually hold any data. Instead, it has a shortcut property that specifies the path to the file where the data can be found. This file is called the target of the shortcut. The target can be anywhere, even on a different drive. A shortcut only refers to its target; it is not a copy of the target. So, when you open a shortcut and edit what you find there, you are actually editing the target file.

In the folder hierarchy diagram above, Karen has established a shortcut to Dave's 1999 sales data. The target of this shortcut is C:\Dave\1999\sales.xls. Karen's shortcut is named 99sales. Thus, another way to reach Dave's file is via C:\Karen\99sales. If Karen deletes her shortcut, this does not delete the target; Dave's file is still there. Moving or renaming a shortcut also does not affect the target. But, if Dave moves or renames his sales file, Karen's shortcut may not be able to retrieve Dave's file.

Shortcuts can point to folders as well as to files. To create a shortcut, click with the right mouse button (right-click) the icon for the file or folder that is to be the target and select Create Shortcut from the shortcut menu that appears (coincidentally also known as a pop-up menu). Note that you cannot create a shortcut to another shortcut. If you try, what you get is a shortcut to the target of the first shortcut— same effect as copying the first shortcut. Try creating a shortcut of your own, and then look at its properties.

File Names and Types

In the original DOS file system, also used in early versions of Windows, file names were limited to eight uppercase characters plus a three-character extension, separated by a "dot" (a period). (These are sometimes referred to as 8.3 style file names.) The extension specified the type of the file. For example, a shopping list

Page 108: iCarnecie SSD2 Book

stored as a plain text file might be called SHOPPING.TXT, while a resume created as a Microsoft Word document might be RESUME.DOC. Here is a list of extensions for common file types:

.txt Plain text file

.doc Microsoft Word document

.htm HTML (Hypertext Markup Language) document

.xls Microsoft Excel spreadsheet

.gif GIF image (Graphic Interchange Format)

.jpg JPEG image (Joint Photographic Experts Group)

.wav Sound file

.exe Executable file (binary machine code)

.com MS-DOS executable ("command" file)

.drv Driver (for a peripheral device)

.bat Batch (script) file for the DOS command interpreter

Table 1 File extensions

In newer versions of Windows such as Windows 9x/2000/NT/XP, file type information is automatically determined from the extension. If you double-click a file with the extension .doc, it will be opened by Microsoft Word, while a file with extension .htm will be opened by your browser (for example, Internet Explorer or Netscape Navigator). Newer versions of Windows may actually hide extensions from the user. For example, if you create a Word document called Wedding_Invitation under Windows NT, the actual file name will be Wedding_Invitation.doc, but the icon for the file will be labeled Wedding_Invitation. However, you can tell Windows to show you file extensions. From the View pull-down menu, select Options, go to the View tab, and clear the check box labeled Hide extensions for known file types. Now the icon will say Wedding_Invitation.doc.

If you try to open a file whose extension Windows does not recognize, Windows will display a dialog box listing a number of applications and allow you to choose which one to open the file with. Not all of these applications will actually work; it is up to you to choose an application that is appropriate. If you have no idea what is in a file, opening it with a simple text editor like Notepad will let you see if the file is human-readable.

Page 109: iCarnecie SSD2 Book

3.4.2 File Allocation Table and NT File System Clusters and File Allocation Tables FAT16

FAT32

NT File System

Clusters and File Allocation Tables

Disks are divided into tracks and sectors. See the figure below.

Figure 1 Tracks and sectors on a disk

Sectors hold a fixed number of bytes, typically 512 bytes. One or more sectors are allocated to store a file. If the file contains only a line or two of text, it will fit into a fraction of one sector. In that case, the remainder of the sector is left unused. The unused portion is called slack space. If the file is large, perhaps tens of millions of bytes in length, it will not fit even on a single track. It will require thousands of sectors spread across multiple tracks (they need not be contiguous tracks). As there are likely to be hundreds or even thousands of files on the disk, and each needs one or more sectors, there is some bookkeeping to do. File systems differ in the details of how they solve the bookkeeping problem, but the basic principles are the same.

Because sectors are small, modern computer systems group them into clusters and read or write an entire cluster at a time. A cluster is the smallest amount of space any file can occupy on a disk. A cluster contains 4, 8, 16, 32, or 64 adjacent sectors (the number must be a power of 2). The choice of cluster size depends on the capacity of the drive—the bigger the drive, the bigger the cluster size. A small portion of the disk is reserved for the File Allocation Table (FAT). For each cluster that is part of a file, the FAT entry gives the number of the next cluster for that file. In this way, the clusters that make up a file are chained together, so if you know the address in the FAT of the first cluster of a file, you can find all the others by following the chain. The FAT entry for the last cluster in the chain contains a special marker to indicate that it is the end of the chain.

FAT16

Page 110: iCarnecie SSD2 Book

In early versions of the Windows operating system and in MS-DOS, which preceded Windows, the FAT used 16 bits (two bytes) per entry, which allowed for a total of 216 or 65,536 clusters. This scheme is now referred to as FAT16. As hard disk drives got larger, a problem developed— the FAT was too small to accommodate all the available clusters and only allowed for partitions up to 2GB. The following calculation shows how the partition limit of 2GB is derived: 512 (29) bytes per sector * 64 (26) sectors per cluster * 216 clusters in a FAT 16 partition = 231 bytes = 2GB). In addition, small files on a large-cluster file system contain more slack space, wasting space on the disk that could be used to store additional files. For example, there are many files that are 1000 bytes or less, but a 2GB FAT16 partition will reserve 32KB of disk space for each one of those files: 512 (29) bytes per sector * 64 (26) sectors in a cluster = 32768 (215) bytes = 32KB.

One solution to using FAT16 on hard disk drives that contain more than 2GB is to partition the drive into several logical drives—such as drive C, D, and E—each with its own FAT. This works, but it forces users to spread their files across several logical drives when they may not want to organize things that way. Also, if one logical drive completely fills up, no file on that logical drive can grow any larger, even if there is plenty of slack space elsewhere on the disk. Finally, some applications that require huge files, such as database systems, may find that even an entire FAT16 partition is not enough space for one file, although the disk as a whole has enough room.

FAT32

To address these problems, Windows 9x/2000/XP support a FAT32 file system. In this system, 32 bits (4 bytes) are used per entry, but the first 4 bits are reserved. Therefore, it has a total of 2(32-4) = 228 = 268435456 clusters. In a FAT32 file system, smaller clusters can be used instead of larger FAT16 clusters. This leads to more efficient space allocation on the FAT32 drive. The FAT32 can support drives up to two terabytes in size.

NT File System

An improvement to the FAT file systems is the New Technology File System (NTFS) used in Windows 2000/NT/XP. In NTFS, the cluster size is variable depending on the size of the logical drives. The cluster size is automatically determined by the NTFS Format utility, thereby, providing a level of flexibility. This flexibility is not available in FAT16 or FAT32. These features enable more efficient allocation of disk space.

One important feature of NTFS is recoverability. NTFS maintain the consistency of data using journaling, keeping a log of each I/O operation that modifies a system file within a logical drive. If the system fails, the file directory structure can be recovered based on the history of the I/O operations performed on the file system. Another feature of the NTFS on Windows 2000/XP is the Encrypted Files System (EFS). EFS enables data to be encrypted as it is saved to disk. NTFS also supports data access control and ownership privileges to restrict unauthorized access to data in a multi-user environment.

The chart below compares NTFS and FAT files systems.

 

NTFS versus FAT

  NTFS FAT32 FAT16

Operating System

Windows XP

Windows XP All versions of

Page 111: iCarnecie SSD2 Book

Windows 2000

Windows NT

Windows 2000

Windows 98

Windows ME

Windows 95 OEM Service Release 2 (OSR2)

Microsoft Windows

DOS

Max Volume Size*

2 TB 32 GB 2 GB

Files per Volume*

~ 4 billion ~ 4 million ~ 64,000

Max File Size*

2 TB 4 GB 2 GB

* Values pertain to size limitations during implementation.

Table 1 NTFS versus FAT

Unit 4. Application Software

This unit focuses on application software. One specific class of application software, databases, will be discussed in more detail. In addition, you will learn about software licenses and the process of developing software, which is called software engineering.

Readings:

4.1 Software Basics 4.2 Using Software Systems

4.3 Batch Script Files

4.4 Databases

4.5 Software Engineering

4.1 Software Basics

Because software is nothing more than information, users may not realize that it is property, with important legal protections. When you purchase a piece of software, you own the physical medium on which it is distributed, typically a diskette or CD. However, the software itself is owned by the author or copyright holder, and what you may legally do with it is determined by the license that was granted at the time of purchase. This section explores some of the types of software licenses that exist and the implications of the licensing agreement for a user.

Page 112: iCarnecie SSD2 Book

Reading Sequence:

Parsons/Oja, Chapter 3-Section A. Learning Goal: Knowledge of the various types of software that exist, how they are created, and in general, how they work.

Parsons/Oja, Chapter 3-Section D. Learning Goal: Knowledge of software licenses and installation procedures.

-When installing software, do you read the licensing agreement before clicking the I Accept button?-Do you know the restrictions that apply when making copies of software programs? -Do you know what legal options you have when software doesn't work as advertised? -Do you know at what point you become bound by a shrink-wrap license?

If your answer to any of these questions is "No", this is an important reading for you.

Parsons/Oja, Issue: "How serious is Software Piracy" in Chapter 3. Learning Goal: Knowledge of software copyright law and the problem of software piracy. Do computer programs have anything in common with books and magazine articles? Unlike books and articles, computer programs are sets of instructions in a particular sequence that perform actions; however, like books and articles, computer programs are products of a creative process—the results of which are subject to copyright protection.

4.2 Using Software Systems

Software systems usually provide input and control methods that can help users accomplish their tasks quickly and efficiently. The three labs included in this section will help you gain some hands-on experience using features of software tools to increase your productivity.

Reading Sequence:

Parsons/Oja, Chapter 3-Sections B and C. Remark: Application software is a broad term applied to any software that is oriented toward helping a user to solve a problem. Learn about the major categories of application software that are available for computer systems.

4.2.1. Lab: DOS Commands . Remark: DOS commands are an example of a command-line interface. Command-line interfaces are cryptic but powerful; computer experts often prefer them more than the GUI "point and click" interface preferred by novice users. This section of the course provides some additional information and practice related to the DOS command-line interface.

4.2.2 Lab: Macros . Remark: "Macros" are predefined sequences of user commands and inputs that can be used repeatedly. They provide a faster way for accomplishing some repetitive tasks, and they can reduce the chance of errors due to typos or mouse-related mistakes.

4.2.3 Lab: Embedding Application Objects . Remark: Importing data objects such as a graphic or spreadsheet from one application into another is an increasingly common operation. This facilitates the creation of complex documents that can easily be updated using whichever application created the imported object.

4.2.1 Lab: DOS Commands

In this section, you will learn about the DOS command-line user interface.

Learning Exercise:

Perform the "DOS User Interface" lab on the CD that accompanies Parsons/Oja to practice using the DOS

Page 113: iCarnecie SSD2 Book

command-line interface. Do some additional exploring by trying the following:

Note: The help command is not available on all versions of DOS. If it is not available, you can view the help information for any command by including a slash-question mark switch ( /? ) on the command line after the command—like so, dir /?—and pressing ENTER.

Type the help command on the DOS command line to see a list of all DOS commands. Then type help rmdir to see the Help entry for a particular command.

The command color e9 changes the background and foreground text colors of the command window. Its argument is a hexadecimal number. Try it. Then try color 5b. For a list of colors, type help color. How can you set the color back to white-on-black?

Some commands, such as dir, have Help entries that do not fit on a single screen. Type help dir | more to view the Help entry one screen at a time.

The vertical bar ( | ) is pronounced "pipe." It is used to direct the output of one command (such as help) to the input of another (more, for example). The more command displays output one screen at a time; you must press the SPACEBAR to proceed to the next screen. However, with DOS systems, once you proceed to the next screen, there is no way to return to a preceding screen. (Modern applications with a GUI interface use a text window with a scroll bar to solve this problem.)

If you are in the middle of a listing and you want to stop it, you can type CTRL+C. Example: type help; you will see the first screen of the Help entry. Then hold down the CTRL key and press the C key. Doing so will halt the display of the Help entry and will return you to the DOS command prompt.

The assoc command (available in Windows NT/2000 only) displays associations between file extensions and applications. Type assoc .doc and then assoc .txt. Be sure to include the period at the beginning of the extension.

The set command is used to set environment variables, which provide additional parameters to programs. Type set to see a list of the current variables and their values.

Type exit to close the DOS interface window.

4.2.2 Lab: Macros

If you have used applications such as word processors or spreadsheets, you may have noticed that there are certain operations that you do quite often when working with documents within these applications. For example, if you are creating reports using a word processor, you may need to create a header with your name and today's date and footer with the page number. This type of operation requires you to select certain functions or make choices within the word processor's menus, as well as typing some information from the keyboard. If you are using an application that supports macros, you can have the application "record" your actions with the keyboard and mouse, and refer to them later for "playback." The recorded sequence is called a macro. The application will use the macro to simulate your inputs and perform the desired actions when you ask it to.

The advantages of a macro are:

It can reduce the amount of time required to create a document. It can reduce the chance of entering erroneous data.

It can simplify a complicated set of interactions, so that other people can perform the operation without understanding all of the details involved with the application interface. You can even place the name of the

Page 114: iCarnecie SSD2 Book

macro on the application's menu or toolbar, as if you have created a function that was not provided by the application's developers.

Macros do not necessarily record your inputs directly into a data file. Instead, a brief computer program is created that interacts with the application to perform the desired actions. (Sometimes this is done in an application-specific macro language, but Microsoft applications use Visual Basic to implement macros.) When you "execute" a macro, you are in fact running this program from within the application. Unlike other programs that you run on your computer, a macro program only has meaning while running the application used to create it.

A consequence of macros actually being small programs is that documents that you typically think of as containing only data can actually contain both data and embedded programs. If someone gives you a document containing a macro, and you open the document and execute the macro, the macro could turn out to be a virus designed to harm the data on your computer. The topic of macro viruses is discussed in more detail in Unit 6.

The steps typically involved in creating a macro are:

Activate the "create macro" function of the application. Give the macro a name so that you can refer to it later.

A small window will appear on the application indicating the macro is recording. Start performing the keyboard and mouse interactions for the operation to be recorded.

Click on the macro window and stop the recording when you are done.

The only step required to execute a macro is that of invoking it. This is done either by selecting it via a menu using the mouse or via a key sequence known as a "shortcut." Shortcuts, if available, are normally established at the time the macro is created. If you are using the menu selection method, click the name of the macro that you want to execute.

What about actions you perform frequently through the operating system's user interface, such as copying all word processing and spreadsheet documents from different folders to a CD disk? Is there a way to automate these actions so that you do not have to repeatedly point and click with your mouse on various menus and dialog boxes? These actions can be simulated on the operating system by using something called a "batch file" or a "script." Unlike with macros, there is typically no way to record a series of actions into a batch file; instead, you must create the batch file with a text editor. Batch files are actually small programs that use the operating system's command-line interface. They will be discussed later in 4.3.2 Batch File Commands.

Learning Exercise:

Macro facilities are typically found in more sophisticated application software. For example, Microsoft Word supports macros, while the text editor Notepad does not. This learning exercise leads you through the steps involved in creating and executing a macro using Word. If you do not have Word on your computer, try to find some other application that supports macros and perform similar actions.

Start Microsoft Word. On the Tools menu, click Macro and then click Record New Macro.

The Record Macro dialogue box will appear. In its Macro name box, type "SSD2macro". However, do not type the quotation marks. (Note that the Record Macro dialog box allows you to assign a keystroke shortcut to the macro or to assign the macro to a menu. It also allows you to specify whether the macro is just for the document you are creating or for any document. If the macro is made to be shared by other documents, it would be placed in a library of macros available for use by other documents. However, we would not be using

Page 115: iCarnecie SSD2 Book

these features as part of this learning exercise.) Click OK. You will see the small Stop Recording window with buttons for pausing and stopping the recording process appear on the desktop or on the Word toolbar. If necessary, this window can be moved to a different location on the desktop.

Suppose we want to create a macro that consists of your name, the class name, and today's date. You might want to include this information at the beginning of each of your exercises. Type your name, press ENTER, type "SSD2 Exercise", and then press ENTER. On the Insert menu, click Date and Time..., and then select an appropriate format from the Available formats box.

Click the square button of the Stop Recording window to stop recording the macro. Create a new document by clicking New on the File menu or by using the New icon on the Word toolbar.

To execute the macro in this new document, on the Tools menu, click Macro and then click Macros.... Select "SSD2macro" from the list of macros; then click Run. You should see the result of the macro appear in the new document.

If you want to view the program (that is, the macro) just created during the recording process, on the Tools menu, click Macro, and then click Macros.... Select "SSD2macro" from the list and click Edit. The Microsoft Visual Basic window will then appear displaying a sequence of Visual Basic programming language statements, which is the macro you just created. You will have to close the Microsoft Visual Basic window to proceed.

To delete the macro you just created, on Tools menu, click Macro, and then click Macros.... Select "SSD2macro" from the list of macros, and then click Delete. Click Yes when Word queries you about deleting the macro, and then close the Macros box. Finally, close Word, and do not save any of the documents you have created as part of this exercise.

4.2.3 Lab: Embedding Application Objects

Object Linking and Embedding (OLE) is a facility provided by more sophisticated applications, and it requires operating system support. The OLE facility allows data (typically graphics or spreadsheets) that has been created by any of a number of different applications to be combined into a single document file.

The imported data is treated as a single object that can be moved or deleted from the document or even edited by using the original application that created the data. The act of embedding data within a document is much more powerful than the simple copy-and-paste operations that you are probably already familiar with. The copy-and-paste approach typically inserts the data in a format compatible with the application that the data is pasted into. But, some types of information may be lost in this process (spreadsheet formulas, for example), and the data imported in the manner cannot be updated later by the application that created it.

Embedding, however, is not supported by all applications. And, it has one other drawback: the application used to create the data must be installed on your computer if you wish to edit the data. For example, if somebody gives you a Word document with an embedded Excel spreadsheet, your computer must have Excel installed on it in order for you to edit the embedded spreadsheet. Embedding and a similar operation called linking are often found in integrated suites of applications, such as those provided by Microsoft Office or Coral's office applications.

Linking differs from embedding in that the linked object is just a pointer to the document containing the data to be imported, rather than the data itself. With an embedded object, any changes to the imported data are saved as part of the host document; they do not affect the original document that was the source of the data. But, with a linked object, a change to the original data will affect all documents that are linked to that data. People who are viewing a file containing a linked object can see the changes made by someone else.

Learning Exercise:

Page 116: iCarnecie SSD2 Book

If you have access to Microsoft's Word and Paint applications, you can create a bitmapped graphic using Paint, embed it as an object in a Word document, and modify the graphic while viewing the document in the Word application.

Start Microsoft Word. Edit an existing document or create a new one by typing a few lines of text.

Start Microsoft Paint. (On the taskbar, click the Start button, and then click Programs, then Accessories, and then Paint.) Now, draw something. You might try choosing a color from the color palette at the bottom of the window, then selecting the spray-can tool and using it to write your name.

Click the border tool (the icon that is a broken & endash; border rectangle) and click-and-drag to draw a border around your creation. Then, on Paint's Edit menu, click Copy. Now your selection has been copied to the Clipboard. Close Paint.

Go back to Word. Within your Word document, click where you want the embedded graphic to appear. On Word's Edit menu, click Paste Special.... Notice that the Paste Special dialog box provides you with some alternative formats for the data being inserted. Ignore these formats, and do not select the Display as Icon check box. Just click OK to accept the Bitmap Image Object setting (which is the default). Now, notice the impact these actions have on your document.

Double-click the graphic object now embedded in your Word document, and a version of Paint should be started, allowing you to edit the embedded graphic. Make some minor changes in your graphic (say, by clicking on the Paint Can icon and "spraying" part of the graphic). Click outside of the picture on some of the text in the document, which will cause you to quit Paint. Notice that the changes you made to your graphic now appear in your document.

Click and select the graphic object again (a border should form around the image). Delete the object by pressing the DELETE key.

Now place the cursor (the blinking vertical bar) at the bottom or top of your Word document. On the Edit menu, click Paste Special. This time, select the Display as Icon check box. Notice that an icon representing the object now appears in the document—rather than the graphic itself. The icon not only takes up less screen space but also takes up less disk space. An image embedded as an icon may use only half the space a fully-displayed embedded image uses.

Double-click the embedded object and the Paint program will start running once again to allow you to see it and edit it as well. Exit Paint.

What happens if you print a document with an embedded icon? The icon is printed, just as you see it on-screen. If you want to print it as a real, full graphic, right-click the graphic. Then click Bitmap Image Object and then click Convert. Unselect the Display as Icon check box. The actual graphic will appear, replacing the graphic's icon. Try this on your own, and when you are finished, delete the object as you did before.

Close Paint and Word without saving changes.

4.3 Batch Script Files

In 4.2.2 Lab: Macros, we discussed the macro facility that exists in many applications for ensuring that a user can define a shortcut for a set of actions that are used frequently. The same facility is often required when interacting with the operating system's user interface (often called the "command interpreter" or "shell"). For example, you may want to set up a daily routine that copies all word processing files to a removable disk and deletes all the files in the "Temp" folder on the hard drive. In addition, perhaps you want these actions to be performed in the middle of the night when there is nobody around to initiate them.

Page 117: iCarnecie SSD2 Book

If you are using an operating system with a GUI interface such as Windows, there is no facility to record the sequence of actions you perform using a mouse to be repeated later. The solution is to create a text file (called a "batch file" under DOS and Windows, and a "script" under UNIX) that uses the operating system's command line interface to achieve these actions.

Reading Sequence:

4.3.1 Advanced Command-Line Functions . Learning Goal: Knowledge of syntax, wildcards, redirection, piping, and frequently used file commands used within batch files.

4.3.2 Batch File Commands . Learning Goal: More knowledge about the use of batch files and of some DOS commands specific to batch files.

In Addition: Check out Rob van der Woude's Scripting Page. This page contains information on scripting languages in general and batch files in specific.

4.3.3 Lab: Creating a Batch File . Learning Goal: Practical experience in creating and running DOS batch files.

4.3.1 Advanced Command-Line Functions DOS Command Syntax Review of File System Commands

Wildcard Characters

Redirection and Piping

You have already been exposed to the DOS command line in 4.2.1 Lab: DOS Commands. It is probably more proper to call it the "Microsoft command line," as it is not limited to DOS. Virtually the same command-line interface is used in all versions of the Windows operating system.

With today's GUI environment, most computer users rarely need to use the command line. Initial installation of Windows, and recovery from problems that prevent the Windows GUI from executing, are two situations where a user would need to rely on the command line, but neither is a common occurrence. However, one common task where the command line is the preferred solution is the creation of scripts called "batch files". Batch files are text files containing DOS commands used to run programs and manipulate files.

In the remainder of this page, we will discuss some advanced features of the command line. Then, in the following two pages, we will see how batch files are constructed.

DOS Command Syntax

DOS commands have a specific syntax, which you have already had a glimpse of earlier in the course. Each line begins with a command name or program name. (Many DOS commands are actually programs.) After the command name may come one or more switches. A switch is written as a slash followed by a letter. For example, dir /w tells the directory command to use a "wide" list format. Switches can also take parameters, which are separated from the switch by a colon. dir /o:s tells the dir command to order the files by size, while dir /o:-g tells it to put directories at the end of the listing instead of at the beginning.

Commands can also take arguments, such as filenames or paths. Other types of arguments are possible; the exact form is determined by the syntax of the command. The command dir /w c:\ has the path c:\ as its argument; it prints a wide listing of the files in c:\.

Page 118: iCarnecie SSD2 Book

The /? switch tells a command to display its Help entry, which /includes the command's syntax, any switches it accepts, and what the command does. If you know the name of the command you want to use but do not remember the syntax or what switches are available, you can use the /? switch to get help. Typing del /? on the Windows Me command line causes the following to display:

C:\> del/?Deletes one or more files.

DEL [drive:][path]filename [/P]ERASE [drive:][path]filename [/P]

  [drive:][path]filename  Specifies the file(s) to delete. Specify multiple                         files by using wildcards.

  /P            Prompts for confirmation before deleting each file.

The above example illustrates some of the special conventions used by the DOS Help facility for precisely describing the syntax of a command:

Words appearing in uppercase—such as "DEL" and "ERASE"—should be typed in literally, as they are shown in the Help entry.

Words appearing in lowercase denote variable information to be supplied by the user. For example, "drive:" indicates that a disk drive letter (such as A: or C:) should be supplied, "path" indicates that a path should be supplied (such as \Windows\bin), and "filename" indicates that a file name should be supplied (such as program.exe).

Anything enclosed within square brackets ( "[" and "]" ) is optional. If the user does not specify a value for an optional item, the command processor uses a reasonable default value. For example, if the drive letter or the pathname is not supplied, the command processor assumes that the file is located in the current working directory, as indicated in the prompt. The dir command uses *.* as the default filename, meaning it will list all files in the working directory. But, for the del command, while a drive and path are optional, the file name must be supplied by the user.

An ellipsis ( ... ) indicates that the immediately preceding item can be repeated any number of times. This does not appear in the del example, but if it is stated filename ..., any number of files could be deleted at the same time. (In some versions of Windows, the del command does accept multiple file name arguments.)

With the exception of using multiple switches on a command line, all components must be typed in the exact order in which they appear in the Help entry's syntax description. Switches can appear in any order including in between other arguments.

The command processor prompts the user for keyboard input when it is waiting for a new command. The prompt often appears as a drive letter, a path, and a right angle bracket ( > ). For example, the prompt might be "C:\Windows>". The drive and path are referred to as the "working directory." If you specify a file path that does not start with the root folder indicator ( \ ), the command processor assumes that the path begins in the current working directory. It is best to provide a complete path when specifying a file, in order to avoid unintended consequences. What you type can be in uppercase or lowercase, as the command-line processor is not case sensitive.

Review of File System Commands

The following is a list of DOS commands commonly used to manage files. "Directory" is an older term for what Windows users now call "folders." If you need to know more about these commands with respect to syntax and options, type the command name followed by the /? switch.

Page 119: iCarnecie SSD2 Book

cd Change the working directory.

md Make a new directory.

rd Remove an existing empty directory.

deltree Remove an existing directory and its contents. (Use rd /s in Windows NT/2000.)

attrib Change a file's attributes (for example, read-only file, system file, hidden file)

copy Make a copy of a file.

xcopy Make a copy of files and sub-directories.

ren Rename a file within a directory.

move Move a file from one drive/directory to another.

del Delete files. Warning: Files that are deleted in DOS or from the Command Window cannot be restored.

dir List files in a directory.

type Display the contents of a text file.

Table 1 DOS commands

Wildcard Characters

Certain commands accept a list of file names. Rather than typing in an actual list, it is often easier to use an asterisk ( * ) within a file name specification to get the command processor to generate a list of file names for us. An asterisk ( * ) acts as a wildcard character that can match any number of characters in a file name. Here are some examples of an asterisk used as a wildcard character with the dir command:

List only those files and folders in the root folder whose names start with "n":

dir c:\n*

List only those files and folders in the root folder whose names end with "n":

dir c:\*n

List only those files and folders in the root folder whose names contain an "n" anywhere:

dir c:\*n *

Page 120: iCarnecie SSD2 Book

List only those files in the root folder that are of type DOC:

dir c:\*.doc

List all files and folders in the root folder.

dir c:\*

In this last example the wildcard character can be omitted; dir c:\ works just as well.

You must be very careful when using wildcard characters with the command-line interface. As long as you enter a command with the correct syntax, the command-line processor will attempt to carry out that action, even if it was not what you intended. Spaces are very important, as they separate different entities within a command just as they separate words in a sentence. Consider the following two commands:

del c:\w* and del c:\w *

The first command deletes all files in the root directory whose name begins with "w". In the second command, notice the space between the "w" and the "*". The second command deletes not only the file named C:\w but also every file in the working directory—because that is what the "*" in isolation will match!

There is another wildcard character that is more specific—the question mark ( ? ) wildcard. The question mark wildcard represents any one character. This means that a character must exist in the spot designated by a question mark wildcard. Consider the following two commands:

del c:\*.*

del c:\????????.???

The first command deletes all files in the root directory on the c: drive. The second command, which uses question mark wildcards, deletes only files with names consisting of exactly eight characters and extensions of exactly three characters. The question mark wildcard is especially useful when the name of a file is known but the exact spelling of the name is not, which is a common occurrence. Take for instance the following group of names, and see how a question mark wildcard might be helpful in cases where exact spelling is not known.

Variant One Variant Two With Wildcard

Andersen Anderson Anders?n

Tim Tom T?m

Table 2 Using the wildcard

Using the asterisk wildcard would give more unrelated responses than the question mark in these situations. The "?" is most often used when referring to a group of files with names that are similar—file1, file2, file3, file4, and so on—like so:

dir file?

Page 121: iCarnecie SSD2 Book

Redirection and Piping

The command-line processor provides some additional syntax that can be used to control where a program gets its input from (if not the keyboard), and where its output will go (if not to the display). This facility is called redirection. Most commands and programs are written to refer to the virtual devices known as Standard Input and Standard Output for I/O purposes. On a PC, the command processor coordinates with the operating system to redirect all data from the keyboard driver to the Standard Input virtual device and all data from the Standard Output virtual device to the display driver. Redirection allows the user to change this, by associating the virtual devices with some other location for data, such as a disk file. The left angle bracket ( < ) is used to redirect standard input, and the right angle bracket ( > ) is used to redirect standard output. For example, the command dir >files.txt causes the dir command to write its directory listing to the file FILES.TXT in the current directory.

Here are some more examples of the use of redirection:

List all files in the root folder to the printer instead of the display:

dir c:\*.* >lpt:

Create a new text file called "temp.txt" containing a list of files in the root folder. (Note: Nothing will appear on the display.):

dir c:\*.* >c:\temp.txt

Run "program.exe" and have it get data from the text file INPUT.DAT rather than the keyboard:

c:\program.exe <c:\input.dat

Run "program.exe", have it get data from the text file "input.dat" rather than the keyboard, and display the output on the printer:

c:\program.exe <c:\input.dat >lpt:

Another bit of syntax allows you to append output to the end of a file—or else create the file if it does not already exist. This is done using the >> redirection notation. For example, to append a listing of the root directory to the end of the file TEMP.TXT, do the following: dir c:\*.* >>c:\temp.txt. If you do this twice you will have two copies of the directory listing in the file, because the >> notation appends to the file rather than overwriting it.

Piping is a function of the command processor that links two commands together via redirection: the output of the first command becomes the input to the second. In order to accomplish this, Standard Output of the first command is redirected to a temporary file created by the command processor. The second command on the command line is then invoked by the command processor, which redirects its Standard Input to the temporary file that was just created. After the second command completes, the temporary file is deleted by the command processor.

To pipe data from one command to another as described above, the user separates the two commands on the command line with a vertical bar character ( | ). (The vertical bar character is sometimes pronounced, "pipe.") We have already seen an example of piping with the more command:

Display all the options of the dir command: dir /? | more

Page 122: iCarnecie SSD2 Book

Another command commonly used with piping is the findstr command, which finds lines in a file that match a certain string, or pattern.

To display current environment variables whose names contain the string "HOME", do this:

set | findstr /i home

The /i switch tells findstr to treat uppercase and lowercase letters as the same.

4.3.2 Batch File Commands Batch Files Commands

Like Macros, which were discussed in 4.2.2 Lab: Macros, batch files automate tasks. This section gives an overview of batch files and covers some commands that can be used in batch files.

Batch Files

The term batch file originally meant non-interactive. In early computer systems, users would submit programs on decks of punched cards, which would be collected into batches and run. The output was then printed and returned to the users. As operating systems developed further, batch processing came to include a scheduling function, whereby the system would choose which job to run next based on priority level and resources required. It was also possible to specify that a job should run at a particular time of day (for example, do disk backups at night), or repeatedly, such as a weekly inventory report or monthly payroll processing at a company. The central idea, though, was that batch programs were self-contained and did not rely on user interaction.

A batch file under Windows, or a "shell script" in UNIX, performs a similar function. It consists of a sequence of commands to run programs and manipulate files. It is possible to construct completely autonomous batch files that require no user interaction to run, but this is not strictly necessary. The DOS command-line processor, which executes batch files, does provide for some simple forms of user interaction, as you will see.

A batch file under Windows is a plain text file (not a Word file), with the extension .BAT. A batch file contains DOS commands and names of programs to execute. The file may also contain flow control commands that tell the command processor to loop (repeat certain instructions) or to handle error conditions in a particular way.

A common use of batch files is to write new commands. For example, here is a batch file SWAP.BAT that swaps two files by renaming them:

REM Here is the source to SWAP file1 file2@ECHO OFFREM Remember that / precedes a switch.REM Use HELP DEL or DEL /? to find out about /QDEL/Q TEMPMOVE %1 TEMPMOVE %2 %1

MOVE TEMP %2

The notation %1, %2, etc., refers to the arguments to the swap command. If the user types "SWAP A.TXT B.DOC" to the command line, then SWAP refers to a new command defined by our batch file, and while the

Page 123: iCarnecie SSD2 Book

batch file is executing, the %1 is equivalent to A.TXT, and the %2 is equivalent to B.DOC. It is also possible to introduce named variables in a batch file, such as %NAME%, by using assignment statements.

Creating a batch file is actually a type of programming—using a "language" that is very limited. One unusual feature of this language is that a syntax error in one line does not stop the execution of the file. If a syntax error is encountered, an error message is displayed and the batch file continues with the next command. This could have unintended consequences. Just as with other types of programs, it is important to test a batch file thoroughly before using it in any critical application.

Commands

The following is a list of command-line features commonly used in batch files:

rem remark This designates anything that follows the rem command on the line (remark in our example) as a comment.

echo message This command displays message to Standard Output. The echo command can also be used with output redirection to send a message to a file. For example, echo starting stage three.

echo. Notice the period ( . ) at the end of the echo command. This is a special variation of the echo command, which displays a blank line to Standard Output.

@echo off This stops commands in the batch file from being displayed to Standard Output. By default, each line of text in the batch file encountered by the command processor is displayed to Standard Output. While this default mode is useful for debugging purposes, the resulting display often confuses users, so most commands written as batch files begin with @ echo off.

pause This command interrupts the execution of the batch file and displays the message "Press any key to continue...." Execution resumes when a single keyboard key is pressed. This command is useful if you want to make a batch file stop and wait for the user to perform some action (such as inserting a floppy disk) before it continues executing.

: label Any line in the batch file that starts with a colon ( : ) is considered a label. Labels are used by certain flow control commands to repeat or skip over certain lines in the file. After the colon ( : ), provide some appropriate name as the label name. The name should not contain any embedded spaces.

goto label This command causes the command processor to execute the first command line after the label referenced by the command.

if exist filename command This command evaluates the current working directory for a file or subdirectory. In the example above, if the statement is true (that is, if a file named filename exists), then the command (command in our example) is executed. Therefore, a command that reads if exist index.html del index.html determines if a file named index.html exists and, if it does, deletes it.

The lab in the next section gives examples of using these commands in the context of a batch file.

Page 124: iCarnecie SSD2 Book

4.3.3 Lab: Creating a Batch File Example of a Batch File Example of a Batch File with Arguments

The following are examples of batch files using some of the commands and functions described in the preceding section. Try to follow each example and determine what actions are being performed by the commands in the batch file.

Example of a Batch File

The following is a simple batch file called COPYWP.BAT that copies all Microsoft Word and PowerPoint files from the C:\data\smith folder to one or more floppy disks. A batch file normally terminates after executing the last command in the file, but this example will not allow terminate, because of the goto command. Hence, we must employ another method for terminating a batch file: press CTRL+C on the keyboard (that is, hold down the CTRL key and press the "C" key). The command processor will then ask if you really want to terminate the batch job, just in case you pressed this key sequence by accident.

To run this batch file, a user would type COPYWP at the command prompt. Follow the execution of the DOS commands and batch file commands to determine what actions are being performed. If this was something you were doing frequently using Windows Explorer, imagine how many point and click operations that would involve overtime. Instead of all of those interactions, a user could accomplish the same goal by just typing the batch file name at the command prompt.

REM Batch file created by John Smith@ ECHO OFFECHO Copying Word and PowerPoint files to a floppy:LOOPECHO Please insert a floppy into drive A:PAUSECOPY C:\data\smith\*.doc a:\COPY C:\data\smith\*.ppt a:\

GOTO LOOP

Example of a Batch File with Arguments

The previous example always copied Word and PowerPoint files from the C:\Data\smith directory. What if Jane Jones wanted to use this batch file, but on her directory that is called C:\data\jones? Either another version of the batch file would have to be created under a different filename, or arguments could be used. In this example, the user must type on the command line not only the name of the batch file, but also the user's directory name. For example, type "COPYWP smith" to backup John Smith's files (which will cause all references to %1 in the batch file to be literally replaced by "smith"), and "COPYWP Jones" to backup Jane Jones' files (which will cause all references to %1 in the batch file to be literally replaced by "Jones").

REM Batch file created by John Smith@ ECHO OFFECHO Copying Word and PPT files:LOOPECHO Please insert floppy into drive A:PAUSECOPY C:\data\%1\*.doc a:\*COPY C:\data\%1\*.ppt a:\*

GOTO LOOP

Page 125: iCarnecie SSD2 Book

Batch files may take more than one argument. The first argument is %1, the second %2, the third %3, and so on. In this example, the user must type not only the previous information, the batch filename, and the user's directory, but also the extension of the file to be copied. This batch will be able to copy from any user's directory any group of files to the floppy drive.

REM Batch file created by John Smith@ ECHO OFFECHO Copying files:LOOPECHO Please insert floppy into drive A:PAUSECOPY C:\data\%1\*.%2 a:\*

GOTO LOOP

Learning Exercise:

This exercise will give you practice creating and executing batch files using the examples that appear in this page.

Use Microsoft Word to create files C:\data\smith\file1.doc and C:\data\smith\file2.doc. You can put whatever you like in these files. Note: if you are unable to create files with this specific path, then choose a path that works and modify the remaining steps appropriately.

Start the Windows Notepad text editor (located in the Accessories menu).

Type "REM " followed by your name. Be sure to include a space after "REM".

On the File menu, click Save As.... In the Save as Type drop-down list, choose "All Files". This is necessary to create a text file with an extension that is not ".txt". Save this file in the C: drive's root folder with the name "copywp.bat".

Copy the example batch file that appears in the first section of this page, "Example of a Batch File," and then paste it into your newly created copywp.bat. Check your spelling, syntax, and spaces, and then save your work.

Start the DOS Command Line program (typically found in the Programs menu). Run the batch file by typing copywp on the command line. Note that you do not actually have to insert a floppy disk in the A: drive. If you do not do this, the copy command will report an error; click on "Ignore" to proceed. Determine if you have any syntax or logic errors in your batch file.

Go to the Notepad window. Modify copywp.bat with the modifications shown in the first example in the section "Example of a Batch File with Arguments," and then save your work.

Go to the Command Prompt window. Run the batch file by typing "COPYWP smith". Determine if you have any syntax or logic errors.

Go to the Notepad window. Modify your copywp.bat with the modifications shown in the second example in the section "Example of a Batch File with Arguments" and save your work.

Go to the Command Prompt window. Run the batch file by typing "COPYWP smith doc". Determine if you have any syntax or logic errors. Try the various menu choices.

Close both the Notepad and Command Prompt windows.

Page 126: iCarnecie SSD2 Book

4.4 Databases

Databases are one of the most common business applications of computers. Every company has an employee database for keeping track of its personnel, and schools have databases to keep track of their students. There are also many specialized databases for particular applications. For example, libraries place their card catalogs online to make it easy to search for books by title, author, subject matter, or keywords. Also, the Web has telephone directory databases that allow people to look up phone numbers easily. A Web search engine is also a kind of database.

Reading Sequence:

Parsons/Oja, Chapter 11-Section A. Learning Goal: Knowledge of the components of a database: fields, records, and files.

In Addition: After completing this reading, go to the online phone directory people.yahoo.com and look up the phone number of someone you know. (Type in their last name, city, and state in the boxes provided. Then click the "Search" button.) Based on the listing you get back, what fields do you think are present in the database?

Parsons/Oja, Subsections "Data Management Software" and "Database Management Systems" in Chapter 11-Section B. Learning Goal: Knowledge of database management software.

Parsons/Oja, Subsection "Searching for Information" in Chapter 11-Section D. Learning Goal: Knowledge of Boolean operators.

4.4.1 Lab: Searching the Library of Congress . Learning Goal: Practical experience in searching a real-world online database.

4.4.1 Lab: Searching the Library of Congress

Charles Dickens' A Christmas Carol is one of his most popular works. Over the years, there have been many adaptations of this classic story. We can research this topic by querying the Library of Congress Online Catalog.

Learning Exercise:

Go to the Library of Congress Online Catalog (http://catalog.loc.gov/). Click the Guided Search link.

On the page that appears, enter "Charles Dickens" (without quotation marks) in the first Search box, and select as a phrase in the drop-down list to the right of the Search box. Now enter "Christmas Carol" (without quotation marks) in the second Search box, and select as a phrase in the drop-down list to the right of that Search box.

Click the Begin Search button, and you should be presented with over 150 items that match your criteria, the first 25 of which will be displayed on the first screen. These items will include books, films, and tapes of radio performances.

Now, let's narrow our search a bit. Walt Disney has produced adaptations of A Christmas Carol that feature Mickey Mouse. What is the summary of the book? Here's how to find out:

In the Resort results by drop-down box, select Full Title

Page 127: iCarnecie SSD2 Book

Look for title "Walt Disney Productions presents Mickey's Christmas carol" and click on the link

Click the Full Record tab

4.5 Software Engineering

Software engineering is a body of techniques for the disciplined creation and maintenance of large, complex software systems, usually by teams of programmers.

Reading Sequence:

Parsons/Oja, Chapter 12-Section A. Learning Goal: Knowledge of the basics of programming.

4.5.1 Issues in Large-Scale Software Development . Learning Goal: Knowledge of the software development process.

4.5.2 Open Source Model . Learning Goal: Understanding of "open source" software and development and knowledge of GPL, the Gnu Public License, a typical license for open source software.

Parsons/Oja, Chapter 12-Section B. Learning Goal: Understanding of various types of programming languages and programming techniques.

4.5.3 Tools for Software Creation and Management . Learning Goal: Knowledge of the tools that programmers use.

4.5.1 Issues in Large-Scale Software Development The Software Development Process Define or Redefine the Problem

Plan a Solution to the Problem

Code the Solution

Evaluate and Test Everything

The Software Development Process

When measured in human effort (total hours), writing code is actually a relatively small part of the overall software creation process. For nontrivial programs, especially large-scale commercial software, a programmer cannot just sit down and write the code for a program. Instead, everyone involved in the creation of the software must share an understanding of what the software is to do. The software creation process begins with perceived need for the software and proceeds through a series of development phases leading up to delivery and deployment. However, the details of how this process works is far from being perfectly understood and is often the topic of debate, as well as the subject of numerous international conferences. In practice, the development process is seldom stable and rarely well managed. Over half of all software projects are canceled before completion, and most of those that are completed fail to meet the user's specified requirements. In fact, "software process" is one of the fastest growing areas of professional interest within the software community. We introduced the development process in the first course of the Software Systems Development curriculum, SSD1 Introduction to Information Systems. The following programming process was presented:

1. Define or redefine the problem.2. Plan a solution to the problem.

Page 128: iCarnecie SSD2 Book

3. Code the solution.

4. Evaluate and test everything.

Here is a picture of the model:

Figure 1 Software development process

The overall model is actually circular instead of linear—that is why the numbers disappeared. Here we elaborate the model, showing how it works in the world of commercial software. As software becomes a mature industry, the problem definition process becomes more regularized and is further broken down into steps. Many people are involved in the creation of software and, in general, the people who articulate the need for software are different from the people who specify the system. And, in many cases, those who specify the requirements may not be the same people who design or later write the code for the desired system. In very large systems, such as the software that controls a major e-commerce Web site, there may be hundreds of people working together to create the desired software system. As the size of the development team increases, the need for a shared understanding of the goals for the system becomes increasingly important.

Define or Redefine the Problem

1. Recognition of need: This might be generally recognized; it might come from marketing or management; it might originate in the technical groups; or it might come as a contract.

2. Specification of requirements: This is a process of polling stakeholders as to what needs they have for a proposed software system. It is a good idea to make several iterations and to test assumptions with focus groups representing the actual users.

Plan a Solution to the Problem

1. Enumeration of alternatives: Once requirements for a problem are in hand, enumerate known solutions. There usually will be more than one, each with implications for cooperating with existing systems, for ease of implementation (creation cost) and for maintenance (ongoing costs).

2. System design, including tests: This is the actual technical design of a system once an alternative has been selected. It is critical to design tests of the system. It must be possible to recognize a working system unambiguously, and objectively.

Page 129: iCarnecie SSD2 Book

Code the Solution

1. Implementation of solution: Programmers code a system in the chosen language or languages. Decisions have been locked down at the design phase (for example, interfaces and performance) but details of how a piece of the system does what it must do are left to the programmer.

2. Programmer testing of solution: First, the programmer examines software to see that it appears correct. At the next level, software teams meet to read and comment on each other's work in code review sessions. Whole system testing is conducted by project leaders.

3. System acceptance: Another group of individuals operates the software for a period of time in simulated or real settings. System acceptance can be very formal or surprisingly informal.

Evaluate and Test Everything

1. Test in context: Working systems will soon exhibit bugs that slipped past earlier filters. Also, design decisions will reveal their flaws at this stage. Really good systems often spark more demands for changes than bad ones: once people actually get the feel of using good software they get ideas about additional features they would like to have. Finally, the context in which a system operates may change, requiring revisions to the software. For example, a system is working perfectly for a small business, but introduction of the Internet requires the system to be integrated into the Web.

2. Redesign: Now the redesign begins looping back to the first step of the process.

4.5.2 Open Source Model

Unless you work for Microsoft, you will not be allowed to read the source code for the Windows operating system. But, you can read the source code for the Linux operating system, make copies of it, even give it away for free. Linux is an example of an open source software project.

The open source approach is a convenient way for a large number of loosely organized programmers to contribute to the development of a piece of software. Usually they are unpaid volunteers who donate their time. They enjoy programming and have a need for that particular piece of software, so it is in their interest to help improve it by adding new features or fixing bugs. One person, or a small group, acts as the project coordinator and maintains the official version of the source. Other people suggest bug fixes, contribute new features, or improve the design of existing modules. The coordinators examine and test these contributions and decide how to integrate them into the current source.

Open source advocates argue that when code is available for anyone to read, "All bugs are shallow," meaning they will be tracked down quickly by somebody. In addition, some users place a greater degree of trust in open-source systems because it is harder to hide malicious features, such as built-in security holes or mechanisms that violate privacy. When you run a piece of software whose source code is not available for inspection, you must hope that the authors have not snuck in any undesirable behaviors. Sometimes they have.

Most software today is still produced using a closed-source model. Companies must invest substantial funds to create a successful software product. Giving the code away would rob them of the chance to recoup those costs through sales. The code may also contain what a company regards as proprietary technology, or trade secrets, such as tricks for improving the performance of a database system, that it does not want to reveal to competitors.

It is still possible to make money with open source software, by selling support services, printed manuals, or proprietary add-ons that enhance an open source product. Several companies now market Linux distributions this way. Another famous open source software system is the Netscape browser. Originally developed as a

Page 130: iCarnecie SSD2 Book

closed source product, Netscape decided to turn the browser into an open source system and give it away for free. The company makes money by selling server software and other services.

Free Software

The term free software was popularized by Richard M. Stallman, founder of the Free Software Foundation. Stallman wrote:

"Free software" is a matter of liberty, not price. To understand the concept, you should think of "free" as in "free speech," not as in "free beer."

The term "open source" was proposed because of the many misunderstandings that arose with use of the word "free." The open source and free software movements have a lot in common, but there are some philosophical differences.

Free software may be used for any purpose, copied, modified, and redistributed at will. In order to ensure that these freedoms are preserved in all copies and derivative versions, the software is protected by a license. A variety of free software licenses have been proposed. One is called copyleft, a pun on "copyright." Another is known as the GPL, for General Public License. The licenses differ on technical points, but basically, they state that people who make copies of the software must preserve the license. They must distribute the source along with the object code, and they must allow others to make copies of either. If they modify the software, they must make their modifications freely available under the same license terms. Thus, no one can take a piece of free software and turn it into a closed-source product, because the license prevents this.

4.5.3 Tools for Software Creation and Management Editors Compilers

Debuggers

Integrated Development Environments (IDEs)

Software is written by programmers who use special applications called programming tools. Because human programmers and machines are so very different, the programs that humans write must then be translated into a form that is suitable for machine execution. The tools used to support these activities are described next.

Editors

Programming languages are precise. If they were not precise, computers would not be able to execute instructions reliably. Part of the precision comes about through very precise language syntax: the syntax of a programming language specifies what constitutes a legal program.  The other important element of precision is a programming language's semantics, which determine the meaning of a program, the exact computations it specifies.  To write programs, people use text editors—Microsoft Word and Emacs are particularly common general-purpose editors that can be used for programming. Other editors, largely those found in Ides (see below), are tuned to support a specific programming language. Such editors have a degree of automation built into them, so they are able to keep track of open and closed parentheses and other delimiters to inform the programmer of syntax errors; in fact, such editors can often "fill in" syntactic constructs such as conditional or repeating statements automatically. Some editors do even more to assist the programmer by also keeping track of semantic elements of programs, ensuring a meaningful fit between program components (for example, that a variable assigned an integer value has in fact been declared to be of type integer.)

Page 131: iCarnecie SSD2 Book

Compilers

Compilers take program source code written by people as input and produce object code suitable for machine execution.  Along the way, they diagnose errors in syntax and semantics. Programs with these errors are returned to the programmer for correction.  Most compilers today offer fairly good error messages. Some compilers also optimize the source code by rearranging certain operations to produce equivalent, but faster object code.

Debuggers

In the very early days, computer components were a mixture of electronic and mechanical elements. Electromechanical relays were a part of the earliest computers. Legend has it that an early computer malfunction was traced to a moth that became lodged in an electromechanical relay. This was the first computer bug. Whether or not this ever happened, the term bug certainly has caught on. When programs fail to operate as hoped they must be "debugged." One of the best ways to do this is to read the code carefully and hand-simulate the program's behavior. Another good technique is to execute the program instruction-by-instruction while observing the results. To facilitate this process, tools that enable the programmer to inspect the state of the machine during execution have been developed. The most popular of these debugging tools are the visual debuggers, which provide a graphical representation of the program's execution.

Integrated Development Environments (IDEs)

IDEs have become increasingly popular.   IDEs like Microsoft Visual Studio, IBM Visual Age, and Symantec Cafe are software suites consisting of editors, compilers, debuggers, and software engineering tools for program documentation and maintenance.  Some IDEs check syntax as the programmer enters it.  Others enforce syntactic constraints by allowing only syntactically legal constructs to be entered. IDEs may even keep track of semantic information as the programmer is working.  A good IDE is especially nice because it makes moving from one stage of the development cycle to another transparent.  But, since time must be spent to learn an IDE, some programmers prefer to use more basic text editors and compilers that they already know.

Unit 3 and Unit 4 Review Materials

Note: The questions on the exam will be based on variations of the following pool of questions and exercises in Unit 3 and Unit 4.

1. Batch File Creation a. Name the file output.bat.

b. The file should receive as input two parameters-a command and a file name-and should redirect the output of the command to the specified file: output command filename

c. The output.bat batch file should error-check to determine if a file by the name of filename already exists.

d. If a file by the name of filename already exists, the batch file should not overwrite the existing file but return an error message that reads: filename already exists.

2. Batch Files and Macros

Page 132: iCarnecie SSD2 Book

a. What is a DOS batch file?

b. What is an Excel macro?

c. What types of tasks can a batch file or macro perform?

d. What are the benefits of using batch files and macros?

e. What are the drawbacks of using batch files and macros?

3. BIOS and CMOS

a. Explain the function of the BIOS ROM in the boot process.

b. Define flashing, with respect to BIOS ROM.

c. Explain the function of the CMOS in the boot process.

d. What is the advantage of having an unchangeable ROM and a changeable CMOS during the boot process?

e. Consider that the CMOS has lost power.

i. What happens to the data that was stored in the CMOS?

ii. How does the CMOS losing power affect the boot process?

f. List two ways to change the information in the CMOS.

4. Boot Process

a. What are two functions of the boot process?

b. Describe the steps involved in a POST (include the information BIOS displays at the end of POST).

c. Fill in the following chart by arranging the steps of the boot process below in order.

Copy BIOS to RAM

Execute BIOS program

Identify peripheral devices

Load device drivers

POST

Search for Master Boot Record and load the operating system

Steps in the Boot Process

Power On

Page 133: iCarnecie SSD2 Book

Operating System Operational

Explain what the term search order means in relation to the chart in part c.

Explain what the term bootstrap loader means in relation to the chart in part c.

Databases

What important, basic function do all databases serve?

Explain the use of records and fields within a database.

What is a primary key, and how is it used?

In relation to a database, what function does SQL serve?

List three examples of databases that you can interact with on the Internet.

Interrupts

Define hardware interrupt.

Given that the system is currently running a process, list the steps the system performs to process an interrupt and return to the original process.

What causes an interrupt?

What is interrupt priority?

Give an example of a device that has a high interrupt priority and of a device that has a low interrupt priority.

How are priorities assigned to devices?

Layers

List the layers of software in order from lowest to highest.

Describe encapsulation with respect to the layers of software.

Describe abstraction with respect to the layers of software.

What advantage do encapsulation and abstraction give to software developers?

Include an example of the advantage described in part d.

Multitasking

Define process.

What is the function of the process scheduler?

Page 134: iCarnecie SSD2 Book

Correctly label the state (running, runnable, blocked) each letter (A, B, C) represents:

Describe the steps taken by the system to perform a context switch.Describe the effects from a user standpoint of pre-emptive multitasking.

Operators

List three Boolean operators.

List three relational operators.

How do Boolean operators function? Use the operators you listed in part a to help you create examples, if necessary.

How do relational operators function? Use the operators you listed in part b to help you create examples, if necessary.

How do Boolean operators improve information searches?

Give an example of a query that uses at least two of the Boolean operators.

Software Development Life Cycle

Describe the Define stage.

Describe the Plan stage.

Describe the Code stage.

Describe the Test stage.

How do these stages of software development interact with one another?

What is pseudocode?

What life-cycle stage would pseudocode be used in?

Software Licenses

Define shrink-wrap license.

Define shareware license.

Define public-domain license.

Page 135: iCarnecie SSD2 Book

For each type of license listed in parts a, b, and c, give one example of a program distributed under that type of license.

Traps and Faults

What is a trap? How are traps triggered?

What is a fault? How are faults triggered?

How does the system handle traps and faults?

What is a page fault? How are page faults triggered?

List the steps the system takes to resolve a page fault.

User Interfaces

What is the difference between a command-line interface and a graphical user interface?

Describe two benefits that make a graphical user interface better for novices.

Answer questions i and ii below for each of the following operating systems:

– Windows 2000 Server– UNIX– Mac OS 8– DOS

i. What type(s) of user interface does it use?

ii. What type of computer is it designed to run on (workstation or server)?

Virtual Memory

What three advantages does the course mention, regarding virtual memory?

What is one disadvantage of virtual memory?

What data is contained in a swap file and where does the swap file reside?

How does virtual memory work using a page table?

Given pages 2, 3, and 5 are already in main memory (the memory is not yet full). What happens when a request for page 6 is made? What role does the kernel play in processing this request?

Page 136: iCarnecie SSD2 Book

Unit 5. Network Systems

This unit covers computer networks, data communications, and the architecture of the Internet.

Reading Sequence:

5.1 Internet Basics 5.2 Local and Wide Area Networks

5.3 Communication Strategies

5.4 Data Transfer Technologies

5.5 Internet Architecture

5.1 Internet Basics

In a short period of time, the Internet has become essential to how people and businesses communicate with each other around the world. Using a browser and email are important skills today. This section provides some general background on the Internet and helps you become more familiar with the features of your browser and email programs.

Reading Sequence:

Parsons/Oja, Chapter 7-Section A. Learning Goal: Knowledge of the Web and HTML, how they were formed and work.

Parsons/Oja, Chapter 7-Section B. Learning Goal: Knowledge of Search Engines and formulating searches on the Web.

Parsons/Oja, Chapter 7-Section D. Learning Goal: Knowledge of what email is, how it works, and how to use it.

Parsons/Oja, Chapter 7-Issue: "Who's reading your Email?"

5.1.1 MIME Types . Learning Goal: Knowledge of how different types of data (graphics, sound, formatted documents) are exchanged between people using Internet email.

Electronic Communications in The Net: Core Rules of Netiquette. Learning Goal: Knowledge of "netiquette" (short for "network etiquette"), the rules for good behavior on the Internet.

5.1.2 Internet Languages . Learning Goal: Sample common languages used on the Internet to facilitate data exchange.

Parsons/Oja, Chapter 11-Section B-subsection "XML". Learning Goal: More in-depth understanding of DHTML, XML, XSL, and Java languages.

Parsons/Oja, Chapter 7-Section C. Learning Goal: Knowledge of what e-commerce is, how online shopping works, privacy and security in e-commerce and how payments are made online.

Page 137: iCarnecie SSD2 Book

5.1.1 MIME Types

It is possible to attach images and other types of documents to an email message. This raises a problem: how is the mail client (that is, an application that reads email) supposed to know what to do with these documents? The solution is to give each attachment a label explaining what kind of document it is. The labels are called MIME types. Incidentally, MIME is the acronym for Multipurpose Internet Mail Extension.

MIME type designations have two components: a type and a subtype, which are separated by a slash (/). Some examples include text/plain, text/html, image/gif, image/jpeg, and application/msword. Users can control how their mail clients handle attachments of a given type through a configuration file called a MIME types file. For example, they may specify that GIF and JPEG images should be displayed using a particular viewer program, or that files associated with the application/msword type should be opened immediately using Microsoft Word. The MIME types file permits wildcard specifications, such as image/*, which matches any type of image file, or even */*, which a mail client can use to provide a default behavior for any file type. A common choice of default behavior for unfamiliar types is "save to disk." This allows the user to deal with the attachment manually at a later time.

MIME types are not just for email anymore. Web browsers use them as well. Web sites that contain sound or video clips, for example, may require the mail client to launch a player program in order to present those files to the user. The MIME types file tells the Web browser what kind of player to use. You can display and edit MIME types' settings using your Web browser by editing your preferences.

Microsoft Windows operating system also now uses this information. If you double-click a file icon, the file extension is looked up in the MIME types file to determine which application should be used to open the file. If you are using Windows Explorer to view your disk files, on the View menu, click Folder Options and then click the File Types tab. This window shows a list of all file extensions registered under Windows and displays the appropriate MIME type associated with each extension.

MIME extensions also specify the character encoding in email messages. Languages such as French or Spanish require accent characters that are not part of the regular character set, which is known as ASCII (American Standard Code for Information Interchange). Email messages in nonwestern languages, such as Japanese, require a different character set altogether. The MIME extensions provide a way to specify which encoding a message is using. It is then up to the mail client to translate that encoding into something that can be meaningfully displayed to the user.

5.1.2 Internet Languages HTML XML

JavaScript

Java

There are many Internet languages that are used to exchange data on the World Wide Web. In this section, we will focus our discussion on the ones that are commonly used today.

HTML

HTML stands for Hyper Text Markup Language. An HTML file is a text file containing a set of predefined tags that are used to specify how data should be displayed in a browser or another application program. For example, inserting the built-in tag "<i>" and "</i>" around a phrase would italicized the phrase displayed.

Page 138: iCarnecie SSD2 Book

Because HTML is composed of text, you can create an HTML file using a text editor. To enable the Web browser to interpret how you want the page to be displayed, you must save the file with an "htm" or "html" file extension. Note that "<" and ">" are indicates the beginning and end of a tag, respectively.

You can use the following steps to create a web page:

1. Open a text editor application such as Notepad.exe.

2. Copy the following text and paste it into the text editor program:

<html><head><title>Page title</title></head><body>This is an example of a Web page. <b>A tag is used to make this text appear bold.</b></body></html>

3. Save the file on Desktop as "sample.html".

4. Open a Web browser application.

5. Drag "sample.html" from Desktop to the Web browser. You should be able to see the web page.

HTML tags, which are used for marking up documents, are predefined. Therefore, the author of HTML documents can only use tags that are defined in the HTML standard to customize the look and feel of a web page. There are numerous resources on the Internet that you can use to learn how to create web pages with HTML. One way you can locate HTML resource pages is using an Internet search engine such as Google, and type in "HTML tutorial" in the search box.

XML

Another text document markup language is XML (eXtensible Markup Language). While HTML tags are primarily concerned with how text should be displayed, XML tags can be used to describe what a piece of text means. Another major difference between HTML and XML is that there are no predefined tags in XML. Users have the freedom to define their own tags.

For example, an XML programmer could create a tag called <phone> to indicate that the enclosed text is a telephone number. See the following example XML code:

<phone>4125551212</phone>

The programmer can also include other tags such as <address>, <name>, <occupation>, etc. To describe how tags are used to organize the data, a DTD (document type definition) is utilized. For example, in a DTD, the developer can specify that CUSTOMER tags can contain NAME tags, but NAME tags cannot contain CUSTOMER tags. A DTD ensures that all the documentation is formatted in the same way. Applications can use the DTD to read and display the content of the document. One advantage of using the DTD is that changing the document format would involve just modifying the DTD.

Since XML just organizes data by assigning them descriptive tags, Extensible Stylesheet Language (XSL) is used to specify how an XML document would be interpreted and displayed by the browser.

Page 139: iCarnecie SSD2 Book

The phone example above can be rendered by the browser as specified by the XSL as follows:

Phone: (412) 555-1212

You can view an XML phonebook with the phone entry shown above. Some browsers will use the XSL specified in the XML file to transform the data. You can view the source to the XML and the XSL.

XML allows the author to define his own tags and his own document structure. By using tags to encapsulate data, XML can represent complex data structures, such as records from a database. The formatting information associated with the tags is used to generate XSL sheets from an XML document, which can be viewed with a normal Web browser. Because XML is composed of text, it is software and hardware independent, meaning any computer system would be able to interpret an XML document. Due to XML's flexibility and interoperability, it is becoming the standard for exchanging data over the Internet.

You can learn more about XML from the World Wide Web Consortium (W3C) website.

JavaScript

JavaScript is a "scripting language," which means the instructions the programmer writes are not compiled in advance. Instead, they are interpreted by an application when the script is run by the computer. Both 4.2.2 Lab: Macros and 4.3 Batch Script Files contain examples of simple scripting languages. JavaScript is a more complex scripting language that uses much of the structure and syntax of Java. The scripts are included inside an HTML document, using the <SCRIPT> tag. JavaScript provides operations for manipulating the Web browser (for example, creating new pop-up windows), controlling interactions with the user, and generating Web page text "on-the-fly."

In the following JavaScript example, we build a page with a black background and use green letters to display the text "Hello World!" The Web page's title, "JavaScript Demonstration," is retrieved and inserted into the second line of text on the page. This second line is displayed in red.

<html>  <head>    <title>JavaScript Demonstration</title>    <script type="text/javascript" language="JavaScript1.2">      function display() {        document.body.bgColor = "black";

        var ln1 = "Hello World!";        var ln2 = "This is the " + document.title + " page.";        var str = ln1.fontcolor("lime") + "<br />" + ln2.fontcolor("red");

        document.writeln(str);      }    </script>  </head>  <body>    <script type="text/javascript" language="JavaScript1.2">      display();    </script>  </body>

</html>

Launch the JavaScript Demonstration page utilizing the above script in a new window. You can use the Web browser's "View Source" command to see the contents of the file. Note: Netscape converts all JavaScript to normal HTML tags, so using the View Source command in Netscape will display the HTML that results from the conversion. Using the View Source command in Internet Explorer will show the file as a script.

Page 140: iCarnecie SSD2 Book

Although the above example does not demonstrate the more advanced features of JavaScript, such as user interactivity, you can see how JavaScript allows developers to generate Web pages dynamically by having the user's browser execute the script when the page is to be displayed.

Java

Java is an object-oriented programming language. It is designed to be both highly portable and easy to use. While Java supports full-scale application development, the kind of Java programs typically encountered in Web pages are small routines called Java applets. An applet is a piece of code designed to run inside a Web browser or other applet viewer. Inside each Web browser is a Java virtual machine (JVM) that executes compiled Java code. Hence, Java programs do not have to be compiled for specific computer architectures—such as Pentiums, PowerPCs, and so on. They are compiled for the Java virtual machine and can then be executed on any computer that provides an implementation of the JVM.

In the example below, we build a Java applet to write the text "Hello World!" inside a rounded rectangle.

import java.applet.Applet;import java.awt.Graphics;

public class Demonstration extends Applet {  public void paint(Graphics g) {    g.drawRoundRect(5, 5, 100, 50, 10, 10);    g.drawString("Hello World!", 23, 35);  }

}

Here is the result of the applet:

Java is a more powerful language than JavaScript, allowing the developer to create applets with a wide range of functionality. There are Java email clients, FTP clients, Telnet clients, etc. Java can also easily parse XML documents and run database queries, providing a powerful front end for Web-based database access.

5.2 Local and Wide Area Networks

A network that provides communication among computers over a relatively short distance, such as one floor of a building, is called a Local Area Network (LAN). If the computers are located further away within a building, or across town, across the country, or across the world, then a Wide Area Network (WAN) is used. Fundamentally, a LAN and a WAN perform similar actions from a user's perspective. However, the types of hardware used, the time involved in transferring data, and other issues such as security may distinguish a LAN from a WAN. The Internet is an example of a WAN. This section describes some of the basic principles of networks, focusing on LANs, while WANs are discussed in a later section.

Reading Sequence:

Parsons/Oja, Chapter 5-Section A. Learning Goal: Knowledge of the basic network building blocks.

Parsons/Oja, Chapter 5-Section B. Learning Goal: Knowledge of wired networks.

Parsons/Oja, Chapter 5-Section C. Learning Goal: Knowledge of wireless networks.

Parsons/Oja, Chapter 5-Section D. Learning Goal: Knowledge of the system and application software used to support LANs.

Page 141: iCarnecie SSD2 Book

5.3 Communication Strategies

This module covers the various types of communications architectures available.

Reading:

5.3.1 Client-Server Framework . Learning Goal: Understanding thin and thick clients.

5.3.2 Peer-to-Peer Connectivity . Learning Goal: Understanding how each machine is both a client and a server, and what impact this has on computing.

5.3.1 Client-Server Framework

Many network applications are organized as client-server systems. The client and the server are both software programs. The client runs on the user's computer and interacts with both the user and the server. The server can accept requests from any number of clients. It performs some service for them and returns the results. The World Wide Web is an example of a client-server system. The client is the Web browser program, such as Netscape or Internet Explorer. For a machine to host a Web site, it must run a Web server program that clients can talk to. One widely used Web server is Apache. Email is another example of a client-server application. The mail-reading program, such as Microsoft Outlook, is the client. The server is a program that accepts and stores incoming mail for users, and delivers the mail to them when their client requests it. Servers can also forward mail to other servers if necessary.

Yet another client-server application is Usenet news, which is a kind of distributed bulletin board system. There are thousands of newsgroups covering all kinds of topics, like computers, sports, politics, science, and entertainment. News servers (with big disks!) store messages, called "postings," and exchange them with other servers. They also accept new postings from clients. When users want to read a newsgroup, their client sends a request to the server to download the most recent messages. There are many client programs specialized for reading news, but today many people use their Web browser, since Netscape and Internet Explorer both contain newsreaders. Modern Web browsers can communicate with many kinds of servers, including Web servers, news servers, and mail servers.

Two terms you may run into are thick clients and thin clients. The distinction between thick and thin clients is based on how much work is done on the client side: a thin client does relatively little work, typically providing little more than a user interface. A thick client, on the other hand, carries out a substantial portion of the overall work of the system. For example, in a typical Web surfing use, the browser acts as a thin client, while the work of searching a database and organizing the results is carried out by servers. However, a system might download a Java applet to the browser, and that applet might act as a thick client. How much work is assigned to the client in the design of the system depends on the logic of the system itself and the power of the client device. For example, a personal computer can support clients that do a great deal of work, while a handheld device or a television set-top box is more likely to be suited to support thin clients only.

5.3.2 Peer-to-Peer Connectivity

Peer-to-peer networks are an alternative to the client-server framework. Instead of having a central server that all clients communicate with, every member of a peer-to-peer network can communicate with any other member. One example is a multi-player network game, where each player's computer talks directly with all the others to transmit moves and update the state of the "world." Only some games are organized this way. Others rely on a server.

Page 142: iCarnecie SSD2 Book

Another example of a peer-to-peer network was Napster, the controversial system for sharing music over the web. (Napster was controversial because many of the songs people wished to share were copyrighted.) Each user running a Napster client could communicate directly with any other user to send or receive a particular song. However, in order for users to find each other, Napster relied on a central server to keep track of which songs each user was offering to share. Hence, Napster was a hybrid system. The central directory provided for efficient indexing and search functions so users could quickly find the material they wanted. But, the actual file sharing took place via the direct peer-to-peer network, eliminating the server as a potential communications bottleneck.

The use of a central server was viewed as a vulnerability of Napster, since if the server was attacked, or shut down by a court order, the service could not function. For this reason, newer file sharing programs such as Gnutella and FreeNet were developed that are purely peer-to-peer, and that hide the identities of machines sharing information over the network. These programs had uses other than violating copyrights on music: they provided a press that could not be censored, which was important for people in countries without strong protection of free speech.

5.4 Data Transfer Technologies

The process of transferring data between two computers is known as data communications. Two critical decisions must be made for computers to communicate through a network: the protocol (rules for interpreting the data stream), and the communications medium (cable, optical fiber, or wireless methods using radio signals.)

Reading Sequence:

Parsons/Oja, Chapter 6-Section A. Learning Goal: Knowledge of communication signals, topologies, and different protocols that are used to support data communications.

Parsons/Oja, Chapter 6-Sections B and C. Learning Goal: Knowledge of the various types of Internet access including methods of connecting.

5.5 Internet Architecture

In this section, we will cover some of the details of how the Internet works.

Reading Sequence:

5.5.1 Routers and TCP/IP . Learning Goal: Knowledge about the TCP/IP protocol used to route and exchange data between computers on the Internet.

5.5.2 Domain Name Service . Learning Goal: Knowledge of how domain names are resolved to IP addresses for routing messages on the Internet.

5.5.3 Connectivity . Learning Goal: Knowledge of the types of network connectivity available to consumers and business owners.

5.5.4 Internet Service Providers . Learning Goal: Knowledge of the types of Internet Service Providers (ISPs) that are available and their role in connecting a computer system to the Internet.

5.5.1 Routers and TCP/IP Internet Protocol Routers

Page 143: iCarnecie SSD2 Book

Transmission Control Protocol

Internet Protocol

The Internet functions as a somewhat clean virtual network at a layer above the messy physical networks of which it is made. It has its own protocol called IP (for Internet Protocol), and its own addressing scheme. Each machine on the Internet has a unique IP address, which is 4 bytes long. IP addresses are usually written as four numbers between 0 and 255, separated by periods, such as 128.2.35.186. The first two numbers are a "network ID"; 128.2 is the network ID for Carnegie Mellon University. The last two are a "host ID" within that network. (A host is any computer on a network.)

If a host wants to communicate with another Internet host that is on the same LAN, it can do so by translating the IP address into whatever address format the LAN is using. For Ethernet this would be a 48-bit Ethernet address. But, a host can also communicate with hosts on other networks. In that case, it would not know how to reach the destination host directly. Instead, it refers to the destination by its IP address and goes through an intermediate machine called a router.

Routers

A router is typically connected to two or more local networks. It keeps a list of IP addresses and corresponding LAN addresses for all the hosts on those networks. When a router receives a packet from one of them, one of two things can happen. If the destination IP address is in its host table, the router delivers the packet directly to that host, using the host's LAN address. If not, it must forward the packet to another router, hopefully one that is closer to the ultimate destination. Through this mechanism, a packet may make many hops from router to router before arriving at the host to which it was addressed. If your computer has the TRACEROUTE (or TRACERT) utility, you can use it to find all the hops a packet takes between it and another Internet host. Depending on the distance between the two hosts, some of these hops may travel via network backbones that employ very high capacity communication lines constructed from fiber optic cable. Some hops might even bounce the packet off a satellite!

Transmission Control Protocol

A common occurrence during these multi-hop transfers is that a packet may be lost, usually because a router does not have enough room to store it before retransmitting it. Obviously, many networked applications cannot tolerate random loss of data—imagine your email with large chunks missing. The most common solution to this problem is to use another layer of protocol on top of IP called TCP, or Transmission Control Protocol. Using TCP, the sender and receiver of a stream of data exchange information about which packets carrying the data have successfully arrived. Those that have not are retransmitted. TCP guarantees that packets will be received in the same order they were sent, and none will be lost.

Since TCP is so widely used along with IP, they are often mentioned in the same phrase, as in "TCP/IP networking." All the Internet application protocols we have discussed, such as HTTP for Web browsers, SMTP for mail servers, and NNTP for news servers, are built on top of TCP/IP, but some services use other protocols such as UDP (User Datagram Protocol) in place of TCP.

The Internet Engineering Task Force (www.ietf.org) coordinates the development of the technology that makes the Internet work. The Internet Society (www.isoc.org) promotes "the open development, evolution and use of the Internet for the benefit of all people throughout the world."

5.5.2 Domain Name Service Naming Domain Name Service

Page 144: iCarnecie SSD2 Book

Naming

Local area networking software such as Novell Netware or Microsoft Network allows every machine on a LAN to be assigned a symbolic name, typically a single word. This is for the convenience of human users; it is much easier to remember a word like GANDALF or BLUEBERRY than a 48-bit Ethernet address. Printers are also assigned names in this fashion. Since the names are valid only within the LAN, there is no need to worry about naming conflicts. The administrator of the LAN sees to it that names remain unique.

Because the Internet operates on a global scale (and there are even plans to accommodate off-planet hosts!), naming is a more complicated business. Internet names follow a hierarchical scheme, with the components separated by dots, for example, www.icarnegie.com. The first component is the host name; by convention, many organizations use the host name www for their "front door" Web servers. The remaining components constitute a domain. People also sometimes refer to the entire name as a domain name.

Domain names may include additional levels of structure. For example, cmu.edu is the top-level domain for Carnegie Mellon University, cs.cmu.edu is the domain for the Computer Science Department, and fac.cs.cmu.edu is the domain for the facilities maintenance group within the department. Notice that domain name components are ordered with the most specific level first and the most general (or "highest") level last.

The top level of the domain hierarchy contains two kinds of symbols: 1) two-letter codes for countries, such as uk for the United Kingdom or jp for Japan, and 2) "generic" codes for various types of organizations, such as com for companies, edu for colleges and universities, and gov for US government agencies.

The special status given to the US in the naming scheme is an artifact of the history of the Internet, which was created by the US government. The list of top-level domains and country codes is now maintained by GNSO, the Generic Names Supporting Organization (http://gnso.icann.org/), a division of the international body known as ICANN (www.icann.org), the Internet Corporation for Assigned Names and Numbers.

Domain Name Service

There are several million hosts on the Internet. Keeping all of their names and IP addresses in one big file is obviously impractical. Not only would the file be a nightmare to maintain, but also some service providers assign IP addresses to dialup networking clients dynamically, so the associations between names and IP addresses can change from one minute to the next! The solution is to use the network itself to look up names, via a mechanism called DNS, for Domain Name System (or Service).

In order for a computer to look up domain names, it must know the IP address of at least one DNS server. This information is entered into a configuration file when Internet service is first set up on the machine.

Here is how DNS service works. Suppose a Web browser tries to look up the host www.cs.cmu.edu. It asks its local DNS server for the IP address. If the DNS server knows the address, it sends it back immediately. If not, then it asks another DNS server to help it find the address. There are DNS servers for every level of the domain hierarchy, and every DNS server knows the IP addresses of servers for the top-level domains. So, to look up www.cs.cmu.edu, the first step is to ask the DNS server for the edu domain for the IP address of the DNS server for the cmu.edu domain, if we do not already know it. Then we ask that DNS server for the IP address of the DNS server for the cs.cmu.edu domain. Finally, we ask that DNS server for the IP address of the host we are trying to contact. Although this sounds like a complicated process, DNS lookups are usually very fast because servers cache the results of previous queries, so they rarely have to ask other servers for help. If you pick an obscure host name half way around the world, though, you may encounter a short delay during the initial lookup of that host.

Page 145: iCarnecie SSD2 Book

5.5.3 Connectivity Conventional Analog Phone Lines ISDN: Integrated Services Digital Network

Cable Modem

xDSL: Digital Subscriber Line

Dedicated High Speed Lines

The first link between you and the Internet is the link that connects your computer to an ISP. Home users have several choices of connection technology, depending on where they live. Most of these choices are provided by local telephone companies, although cable companies are now also competing for this business. The following discussion presents a list of options that may be available to you.

Conventional Analog Phone Lines

The word "modem" is a contraction of modulator/demodulator, referring to the modem's function of converting between binary bits and sounds transmitted as analog electrical signals over the telephone line. The fastest modems available for purely analog phone lines run at 56 kilobits per second. Many computers now come with built-in 56-kbs modems that can also be used to send and receive faxes. Internal or external add-on modems are an inexpensive way to connect to an ISP. The principal drawback of analog modems is their limited speed.

ISDN: Integrated Services Digital Network

ISDN is a digital connection carried by standard copper telephone wires, typically providing two channels of 64 kilobits per second each. This allows you to use 128 kilobits per second for data, or to use one channel for data and one for voice, so your ISDN line can be your home phone line. ISDN requires either that you have a special ISDN adapter card for your computer, or that you use your computer's Ethernet interface to attach to an ISDN device. ISDN service and equipment is typically two to three times more expensive than analog modems.

Cable Modem

Cable television companies have begun providing data connections to residential customers over their existing cable lines. Some of the television cable's bandwidth is allocated to data traffic, typically from a few to a few tens of megabits per second. Computers are usually connected to cable modems through Ethernet interfaces so this style of connection is extremely fast. The drawback is that the bandwidth, like the TV cable itself, is shared with your neighbors. If you are the only user, performance is excellent. But, if many subscribers are using the system at the same time, performance declines.

xDSL: Digital Subscriber Line

A variety of digital subscriber line technologies, such as ADSL, HDSL, and VDSL, are in use in limited areas. These services use standard copper telephone lines to carry digital signals. Perhaps the most commonly used is ADSL, or asymmetric digital subscriber line. It is called asymmetric because the speed of upstream and downstream transmissions are different. Upstream transmissions from the subscriber to the central office are done at low speeds from 16 kilobits per second up to around one megabit per second. Downstream transmissions, from the central office back to the subscriber, go from the megabit per second range up to nearly ten megabits per second. This asymmetry can work very well for individuals running Web browsers, where only a small amount of data travels upstream but large amounts of text and images (and

Page 146: iCarnecie SSD2 Book

maybe even streaming audio or video) are transferred downstream. Computers usually attach to ADSL modems through their Ethernet interface.

Dedicated High Speed Lines

Businesses whose need for connectivity exceeds that of residential users have a greater menu of options. They can purchase dedicated links from a local telephone company or from competing access providers. A common type of link is known as the T1 line; it offers speeds of 1.5 megabits per second. Also widely used, mostly by larger organizations, is the T3 line with a speed of 45 megabits per second. These kinds of links are very expensive, approximately several thousand dollars per month. Some providers offer fractions of a T1 line for customers who do not require the full bandwidth.

Another alternative is the even faster SONET (Synchronous Optical NETwork) link, which carries data over optical fiber. Its use is becoming widespread. You may encounter rates of OC-3 (155 megabits per second), OC-12 (622 megabits per second), or OC-48 (2.5 gigabits per second). OC stands for Optical Carrier. Note that an OC-3 link is about three times faster than a T3 line.

5.5.4 Internet Service Providers

The Internet has both a technical structure and a business structure. Internet Service Providers (ISPs) play a key part in this business structure; ISPs are companies that provide their customers with connections to the network. Some ISPs cater to individuals and families looking for net access from home; they provide dial-up service and a computer account to allow their customers to read email and browse the Web. Some ISPs cater to businesses. These ISPs may provide high-speed links to their customers' computer systems, or they may provide a "hosting" service whereby the customers' Web sites reside on the ISP's machine.

One group of service providers, companies such as AT&T, MCI, and Sprint, operates the network links and routers at the "center" of the Internet, called the backbone, through which long-distance Internet traffic travels. These services are provided largely to other providers. Many of the backbone service providers are also telephone companies, with networks that have international reach. Data may travel thousands of miles through routers and along copper or fiber optic cable belonging to a single company.

Service providers that focus on retail customers include America Online (AOL), Earthlink, and Mindspring, telephone companies such as AT&T Worldnet, Verizon, and many small providers who serve only their local area. The latter purchase high-speed connections wholesale from one of the larger ISPs in order to link their customers to the global Internet. Small local providers are frequently bought up by larger ISPs, but there are still many left.

In order to connect your home computer to the Internet, it must be assigned an IP address. Depending on the type of arrangement you have with your provider and the type of connection running to your computer, your system may have a permanent IP address, or it may be assigned a dynamic IP address every time you dial in. People or organizations needing their computer to be connected to the network all the time normally have permanent IP addresses.

Besides providing dial-up connectivity and IP addresses, service providers usually offer a package of services that includes email, access to Netnews, and some space on a Web server for users who want to create a personal home page, which everyone in the world will be able to see.

Some service providers also function as content providers, that is to say, their systems contain information that only their own customers can see. For example, AOL contains many pages about travel, sports, hobbies, health, and current events that are only accessible to AOL customers; they are not on the Web. Prodigy and CompuServe were two other ISPs that offered proprietary content. But, with the advent of the World Wide

Page 147: iCarnecie SSD2 Book

Web, the number of content providers has exploded, and much of their material is free and accessible to anyone. Web-based content providers make their money by selling advertising space rather than by charging for access to the content itself. In this new market, providing convenient email and Web access is at least as important for Internet service providers as proprietary content.

Unit 6. Computer Security

With the increased reliance on computer technologies to facilitate commerce and communications, more people are connecting their computers to the Internet. Although this trend enhances computer users' ability to share information and conduct business, it also provides more ways for intruders to break into computer systems.

Tools to breach computer systems that require minimal computer system expertise are increasingly available. As a consequence, more people can hack into computer systems, steal confidential data on a computer, alter, or even corrupt, targeted computer systems. Intruders can use your computer to attack your organization, other corporations, and even governments. Computers can be used to achieve detrimental effects if we, as computer users, are not aware of security vulnerabilities and do not take steps to prevent computer attacks.

According to Spectrum Systems, Inc., in 2002:

Estimated computer crime losses range from $300M to $500B annually Computer fraud in the U.S. alone exceeds $3B each year

Computer security breaches are rising at about 20% per year

91% of survey respondents detected computer security breaches

94% detected computer viruses

91% detected employee abuse of Internet access privileges

40% detected system penetration from the outside

Less than 1% of all computer intrusion cases are detected

34% of detected cases are reported

There are over 3,000 hacker web sites

To secure your system, first you need to know how your system may be vulnerable, and what threats intruders can cause. This information is provided in the Security Threats section. Next, you will explore current technologies to protect your data in Security Technologies section. Lastly, you will learn about existing tools and best practices to prevent and detect intrusions, as well as recovering from an attack in Prevention, Detection, and Recovery section.

Whether a computer can be kept secure depends largely on its users. At the end of this unit, you should become an informed user of security issues and counter measures to provide better protection for your computer system.

Reading Sequence:

6.1 Security Threats

Page 148: iCarnecie SSD2 Book

6.2 Security Technologies

6.3 Prevention, Detection, and Recovery

6.1 Security Threats

Before we delve into ways security can be breached, let us first examine the characteristics of a secure system.

A secure system maintains the following:

Data confidentiality- data access is restricted to authorized personnel Data integrity- data is not altered unintentionally

Data availability- services that enable data access are operational

Consequences of weak computer security for home users include:

Sensitive information exposed- for example, intruder can use your password and credit card number to steal your money.

Loss of data - for example, intruders can delete or corrupt important documents such as financial statements and business proposals.

Loss of system functionality- for example, intruders can occupy your CPU and memory using malicious programs disabling the system to process legitimate instructions.

Additional consequences of weak computer security for businesses may include: Loss of time and money devoted to resolving security issues (for example, loss of revenue opportunity during

system downtime) Loss of trust in system from customers resulting in loss of profit, reputation, jobs, and potentially the entire

business (for example, if credit card information of customers could be obtained by intruders through an online store, then no one would use the site, and the business will no longer be profitable.)

To understand how to secure a computer system, you should first understand the intruders, who they are and how they attack. The common attack methods discussed in this section are categorized into three groups: identity theft/privacy violation attacks, malicious software programs (for example, virus, worms, and Trojan horse), and denial of service attacks. Identity theft/privacy violation attacks generally violate data confidentiality. Malicious software programs can violate data confidentiality, integrity, and availability. Denial of service attacks are aimed at the availability of a system's resources.

We will examine each category of attack in more detail and gain a better understanding of the impact these security threats have on computer systems. You will also gain some tips on preventive measures to mitigate these attacks.

Reading Sequence:

6.1.1 Intruders: Who, Why, and How? Learning Goal: Knowledge of who the intruders are, their motivations of attack, and the steps they take to compromise computer systems.

6.1.2 Identity Theft and Privacy Violation . Learning Goal: Gain familiarity with ways an attacker can steal login names, passwords, and other sensitive information.

6.1.3 Malicious Software . Learning Goal: Knowledge of software programs such as virus, worm, and Trojan

Page 149: iCarnecie SSD2 Book

horse.

Parsons/Oja, Chapter 3-Section E. Learning Goal: Knowledge of computer viruses and how to fight them.

6.1.4 Denial of Service . Learning Goal: Obtain understanding of denial of service (DoS) attack.

6.1.1 Intruders: Who, Why, and How?

The first step to safeguarding your computer system and information property is to understand your opponents. The profiles of computer system attackers include:

People who hack for fun, curiosity, personal pride, or just for the sake of breaking into computer systems to see how far they can get (for example, high school or college students, also known as script-kiddies, who attempt to gain access to secure systems such as those owned by the government)

Internal or external personnel who may be seeking revenge on the targeted organization. Security breaches from within an organization account for 70% to 90% of all security breaches according to estimates by The Hurwitz Group of Framingham, Massachusetts

People who may want to make a profit or gain other benefits using confidential data from the targeted system (for example, business advantage, military advantage)

Criminals or organizations whose objective is to corrupt the security of the targeted system for unethical purposes including blackmail and industrial espionage

Terrorists who want to promote political aims and demoralize the victim country

Computer systems that are easy for intruders to attack are those used in residential settings, commonly referred to as home computers. Once home computers are compromised, they may be used to launch larger attacks against computers in an organization. Home computer systems are more vulnerable to attacks for the following reasons:

Home users may be using cable modem/wireless networks, which can be eavesdropped. Home computer systems are less likely to be configured securely.

Home users are less likely to detect that their system's security has been breached.

Access to home systems might provide an alternative access to the computers in their work place.

Typically, intruders launch attacks using the following steps:

Step 1: Obtain information

Guess passwords. Pretend to be a system administrator asking for sensitive information.

Read packets of sensitive information sent over the Internet or stored on the computer.

Scan for vulnerabilities.

Step 2: Analyze Information Use the information obtained and look for weak points in the network to exploit (for example, open ports,

user accounts).

Step 3: Launch attack

Page 151: iCarnecie SSD2 Book

The table below provides an overview of the level of compromise each of the attacks addressed in this section can achieve. Note that most of these attacks are used to obtain information, which could enable more damaging attacks on data integrity.

Data Confidentiality Data Availability

Password Cracking x

Packet Sniffing x

Social Engineering x

Spoofing x

Port Scanning x

Table 1 Level of security compromise achieved by identify theft and privacy violation attacks

One of the attack mechanisms is to capture login and password information in order to break into your user account. Once intruders crack your user name and password, they can act as you, with all your access privileges to alter the data on your account, send email from your account, or attack other computers from your account. Furthermore, if your account could obtain higher rights, such as administrative rights, intruders may use your account to obtain those rights as well. They can also try to generate messages pretending to be from a source you trust and trick you into providing sensitive information such as login names, passwords, and confidential data on your system. The following material covers some of the methods attackers use to obtain sensitive information.

Password Cracking

The easiest password attack mechanism is called dumpster diving, a euphemism for "rummaging through trash." As its name suggests, this method involves searching for sensitive information that may be thrown away into the trash, which can be accessed by an intruder who can physically retrieve the trash. Some users allow easy access to their passwords by leaving their passwords on notes around their computer area—some passwords are even taped to the computer monitor.

One way to obtain a password is the brute force method, trying all different alphanumeric combinations until the password is cracked. A similar method is the dictionary attack, matching every word in the dictionary against the password to decrease the search space. There are many software programs designed to crack passwords using these methods.

Prevention:

Do not throw away legible password information in the trash or leave your passwords at obvious places Destroy or lock up sensitive information

Use difficult to guess passwords that are resistant to brute force or dictionary attacks

Change passwords frequently

Limit physical access to computer areas, especially central servers

Page 152: iCarnecie SSD2 Book

Packet sniffing

A packet sniffer is a software program or a hardware device that captures data packets as they are transmitted through the network. Some data packets captured may contain sensitive information. Installing a packet sniffer does not require administrator rights. It can be installed on a laptop and access the network through an open port.

Cable modem and wireless users have a higher risk of exposure to packet sniffers compared to DSL and traditional dial-up users because entire neighborhoods of cable modem and wireless users are part of the same LAN. A packet sniffer installed on any cable modem or wireless user's computer may be able to capture data packets transmitted by other computers in the same LAN.

Prevention:

Employ data encryption to use encrypted protocols (more about encryption will be discussed later in 6.2.1 Encryption)

Limit physical access to network connections

Monitor network usage and investigate abnormal or suspicious activities

Social Engineering/Fraud

Social engineering refers to the action of tricking people into providing information needed to gain access to systems. Unlike the other attack methods discussed, this attack does not involve a software tool. An attack via social engineering can be accomplished by manipulating the network administrator or other authorized user to give you account name and password information. This can be achieved over the phone, via email or even in person pretending to be someone important in an organization.

The following is an example of a social engineering attack: Joe is an employee at a company. He wants to access the CEO's computer. He calls the system administrator pretending to be the CEO. He claims to have forgotten his password and asks the system administrator to reset it. Because resetting passwords is a common task that network administrators perform frequently, the network administrator reset the password without asking Joe further questions. While the CEO is out of the office, Joe sneaks into the CEO's office and uses the password obtained from the system administrator to access the CEO's computer. He can now act as the CEO and go through his files, alter his data, or send out emails.

Prevention:

Verify identities of people requesting sensitive information Become aware of social engineering schemes and educate others of security policies and their importance

Spoofing

Spoofing is the act of using one machine to impersonate another. An intruder can launch attacks using the identity of another machine so that the intruder would not be held liable for his actions. For instance, an intruder can mask the identity of a machine with special access privileges to obtain control of other computers on the network. Then the intruder can launch a denial of service attack (will be discussed later in 6.1.4 Denial of Service) on a target computer system by sending numerous data packets to tie up the target system's network resources, and cause the system to become unavailable to other users. When the targeted system tries to find the attacker, the trace results would likely to point to the machine that was used to mask the identity of the intruder.

Two methods of spoofing are IP spoofing and email spoofing.

Page 153: iCarnecie SSD2 Book

IP spoofing is a technique used to gain unauthorized access to computers, whereby the intruder sends messages to a computer with an IP address indicating that the message is coming from a trusted host. To use IP spoofing, an intruder must first identify an IP address of a trusted host and then modify the packet headers so that the packets look like they are coming from that host. This method is effective because dialog between machines are automated, which eliminates the need for username or password.

For more information on the many forms of IP spoofing, read "Spoofing: An Overview of Some of the Current Spoofing Threats" from the SANS website. The SANS website also contains a paper on "Introduction to IP spoofing".

Another technique is email spoofing where an attacker fakes an email header to make it appear as if it came from somewhere or someone other than the actual source.

The following are examples of spoofed emails that could lead to an attack on data integrity:

Email from a system administrator instructing users to delete files, or provide sensitive information such as logins and passwords

Email claiming to be from a system administrator requesting users to change their passwords to a specified string and threatening to suspend their account if they do not comply

Email claiming to be from a person in authority requesting users to send them a copy of a password file or other sensitive information

Note that Internet service providers usually will not specify your new password. Also, most legitimate service providers would never ask you to send them any password information via email, phone, or any other means.

You can read about a real-world e-mail spoofing on Best Buy, "E-mail Scam Makes Best Buy Scramble."

Prevention:

Monitor transaction logs of servers such as email server, Web server, and scan for unusual behaviors (monitoring should be done off-line to avoid attacks during the process)

Minimize system privileges of servers

Limit user access to network or administrator command functions

Port Scanning

The objective of port scanning is to detect security weaknesses in a remote or local host. A port scanner is a program that scans TCP/IP ports and services (for example, TELNET or FTP) and reports responses from the target system. An intruder can use a port scanner to find information about the target host such as which port is open and whether an anonymous user can log in. Once an intruder logs in successfully through the open port, the intruder can try to gain access to more computers on the network. Port scanning activity is usually a precursor to an attack on a target system.

Prevention:

Close unused ports Monitor suspicious network activities (for example, if a host is scanning through port activities, the attacker

may be preparing for an attack)

Page 154: iCarnecie SSD2 Book

6.1.3 Malicious Software Virus Trojan Horse

Worm

Prevention

Detection

Counter Measures

Malicious software accounts for a significant portion of computer system attacks. Billions of dollars are spent after the attacks in clean-up costs. Malicious software can manipulate your machine, alter the data on your storage media, and violate the integrity of your data. Some malicious software programs can corrupt your files and spread to other machines through the network. Important data such as login names, passwords, credit card information, financial statements, and business proposals can be deleted, altered, or rendered illegible by the machine. This section introduces three common classes of malicious software programs: virus, Trojan horse, and worm.

Virus

A virus attaches itself to a file or software application, and then replicates itself on the host computer, spreading copies of itself to other files. It can corrupt files, alter or destroy data, display irritating messages, and/or disrupt computer operations. When a computer opens an infected file, it executes the attached virus instructions. An undetected virus can hide in a computer for days or months, while reproducing itself, and attaching itself to other files. The infected files may be spread when a user transfers them via the Internet or removable storage media to other computers.

Viruses are categorized by the type of files they infect. Some common categories are as follows:

Boot sector- compromises the system at the lowest level. This leads to difficulties in starting the system securely; it also causes recurring problems during the computers operation

Application software- infects executable files (for example, .exe files)

Macro- infects macro files and documents that use macros such as Microsoft Excel and Microsoft Word; it is attached to a document or worksheet, and often distributed as an e-mail attachment. When one opens the document, the macro virus copies itself into the other macro files, where it is picked up by other documents.

Virus sample: Melissa Macro Virus

The Melissa virus arrives as an email message with an infected Word document (often named "list.doc") attached. The subject line of the email usually contains, "important message from". It affects Outlook or Outlook Express mail client users. When the attachment is opened, the virus program will execute if macros are enabled. First, the virus will alter the macro security setting to allow other macros to execute. It spreads by accessing the user's Outlook address book and sends copies of itself along with the document that contains it to other users without the original user's knowledge. If the document contains sensitive information, the sensitive information may be exposed to other users. Additionally, once the infected file is opened, it can infect other Word files. If an infected Word file is emailed to another user, the receiver of the message will have a Melissa-infected attachment.

You can learn more about Melissa virus.

Page 155: iCarnecie SSD2 Book

Viruses frequently have double extensions such as .txt.vbs, .mpg.exe, and .gif.scr. The files attached to the email messages sent by these viruses may appear to be harmless files of type: text (.txt), movie (.mpg), picture (.gif) or other file types, when in fact the file is a malicious script or executable, for example, .vbs, .exe, .scr. If you are using the Microsoft Windows operating system, be aware that the operating system hides extensions for known file types by default. To make file extensions visible, you can click on My Computer on the desktop, then from the Tools menu, select Folder Options... Click on the View tab, and uncheck Hide file extensions for known file types option.

Virus sample with hidden extensions: Love Bug

This virus arrives as an email attachment, LOVE-LETTER-FOR-YOU.TXT.vbs. Once you open the attachment, the virus overwrites most of the music, graphics, document, spreadsheet, and Web files on your disk. Then the virus mails itself to everyone in your email address book. The damage due to the Love Bug cost up to US$8.7 billion in lost productivity and system repairs according to Computer Economics estimates.

For further information about viruses, visit the CERT Computer Virus Resource page.

Trojan Horse

A Trojan horse is a program that appears to be performing one task while executing a malicious task in the background. It may reach your computer as an email attachment, usually as amusing or seemingly useful software to entice you to open it. Once you open the attachment, the Trojan horse program can search for your user information, steal your login names, and copy your passwords. Some Trojan horse programs can delete, modify, or transmit files on your computer. And, some Trojan horse programs may contain viruses, worms, or other Trojan horse programs. Trojan horse programs can use your account privileges to install other programs such as programs that provide unauthorized network access. Or, they can use your account to attack other systems and implicate your site as the source of an attack.

In addition, these Trojan horse programs can further exploit vulnerabilities in your system to increase the level of access beyond that of the user running the Trojan horse, such as administrative access. Once the intruder obtains administrative access, the intruder can do anything that an administrator can such as changing login and password information on other computers, and installing software applications. When an intruder gains administrative access to your systems, it is very difficult to trust the machine again without reinstalling the system software.

Despite the destructive power of Trojan horse programs, these programs cannot execute unless they are run on the target system. An intruder may trick the user to run the program. By understanding the various methods the intruder may use to manipulate users to execute Trojan horse programs on their systems, you can better identify a Trojan horse attack tactic and avoid being a victim.

An intruder can entice a user to run a Trojan horse program by forging an email as a Microsoft representative instructing the user to open an attachment to perform procedures that would patch a security weakness. The user would then open the attachment, which is actually a Trojan horse program. An intruder may also use social engineering ploys such as calling a system administrator and posing as a legitimate system user who cannot launch a specific software application. The intruder would then manipulate the system administrator to open a Trojan horse program.

Intruders can use compromised software download sites and replace legitimate versions of software with Trojan horse versions. An intruder can trick the users by redirecting them to a website to download a Trojan horse program. In addition, a Trojan horse program may be placed on a website in the form of Java, JavaScript, or ActiveX component. Note that Java, JavaScript, and ActiveX are also known as mobile codes.

Page 156: iCarnecie SSD2 Book

These programs are executed by your Web browser once you access the site. To avoid Trojan horse attacks via malicious websites, you can disable Java, JavaScript, and ActiveX in your Web browser. However, disabling these features may hamper your viewing of certain websites. A good practice is to disable Java, Java Script, and ActiveX and only enable them when necessary.

You can learn more about ActiveX security from the CERT website.

More information regarding the risks posed by malicious code in web links can be found on the CERT website.

Trojan horse sample: Back Orifice (BO)

The Back Orifice is a Windows 95/98 backdoor program. Once installed inadvertently, it permits intruders who know the listening port number and BO password to control the affected machine remotely. The intruders can execute privileged operations such as execute commands, list files, upload files, and download files. You can read more about Back Orifice and other backdoor Trojan horse programs.

Worm

A worm is malicious software that can execute itself on a vulnerable remote machine. Compared to a viruses, which infect files and spread through the transfer of infected files and email messages, worms can penetrate computer systems more easily because they do not need a user to execute them. Worms can perform trigger events that vary from display of irritating messages to destruction of data.

Most worms travel within email messages and TCP/IP packets, replicating from one computer to another. A worm can arrive as a mass-mailing worm that sends itself to every address in the email address book of an infected computer. To cover its tracks, a mass-mailing worm can set the "From:" line of the message to be a randomly selected address from the email address book.

Worm sample: 911 Worm

This worm is also known as Chode, Worm.Firkin, and other names. It searches through a range of IP addresses of known ISPs to find an accessible computer that has a non-password-protected shared drive. It uses the shared drive to copy its files onto the other computers. Once the infected computer starts Windows, a .vbs script is launched. On the 19th of the month, this script deletes files from the following directories:

C:\windows C:\windows\system C:\windows\command C:\ Then, it displays a message indicating the machine has been infected.

You can learn more about the 911 Worm from Symantec's website.

Prevention

The most effective way to prevent malicious code attacks is avoid opening unexpected email messages or attachments. You should be cautious and use only authorized media for loading data and software. You should not run executable programs unless you trust the sender of the information and you confirmed with the sender that he intended to send you the attachment. Also, avoid sending programs from an unknown source to others.

Page 157: iCarnecie SSD2 Book

You should also be cautious when executing content such as Java applets, JavaScript, or Active X controls from web pages. To decrease your computer's susceptibility to worms, you may wish to configure your browser to disable the automatic execution of web page content. You may also want to disable macros in any product that contains a macro language. For example, to disable macro execution in Microsoft Word, click on Tools, select Macro, and then select Security. Choose a security level from High or Medium. "High" silently ignores the macro code and "Medium" prompts you to enable or disable the macro code.

Many security vulnerabilities such as those related to the operating system are discussed on mailing lists. Software companies such as Microsoft release service packs or patches that can be installed to fix the security holes, but if these updates are not installed in a timely fashion, your operating system remains vulnerable to attacks. It is also important to become aware of emerging viruses, worms, and Trojan horse programs. You can consult McAfee's virus calendar for the latest reported viruses.

Detection

Some notable symptoms of malicious code infection on your computer system are:

Unexpected changes in file sizes or date/time stamps Slow starting or slow running because the virus is exhausting computer's resources

Unexpected or frequent system failures

Low computer memory on disks

Abnormal application behaviors

Counter Measures

When you suspect that a virus has entered your system:

1. Try to contain the virus.

2. Try to identify the virus.

3. Try to recover corrupted data and files.

4. Once you have determined the source of infection, alert others of the virus.

There are various tools such as anti-virus scanners that can help you look for known viruses. You can also use anti-virus monitors to look for virus-related application behaviors. These type of tools will be discussed in more detail in section 6.3.2 Intrusion Detection Tools.

You can find more information about malicious code from the CERT website.

6.1.4 Denial of Service Network Connectivity Network Bandwidth

Other Resource Consumption Attacks

Distributed Denial of Service Attack

Prevention

Page 158: iCarnecie SSD2 Book

In February 2000, DoS [denial of service] attacks took down five popular Web sites in the world, including Amazon, Yahoo! and eBay. Yankee Group has estimated that these attacks have cost the industry at least US$1.2 billion. [InfoWorld, NETstatistica]

In a denial of service (DoS) attack, the objective of the attacker is to exhaust system resources such as network connectivity and network bandwidth to prevent legitimate traffic from being transmitted and processed. This attack is characterized by the following:

Disruption of network connectivity and Internet services Disruption of services to specific system(s) or person(s)

Consumption of other resources on a computer system

Network Connectivity

To tie up a network connectivity of a target machine, an intruder can initiate a half-open connection to the target machine. The target machine starts the connection process and waits for intruder's bogus connection to be completed. While it is waiting, it is blocking other legitimate connections. This attack can even be launched over a dial-up modem connection against a high-speed network system.

An example of this type of attack is the SYN flood attack.

Network Bandwidth

One common attack on the target system's network bandwidth is to generate an excessive amount of traffic on that network. This attack is also known as network flooding. An example of a network bandwidth attack is the Smurf attack. The Smurf attack is launched using the Ping command. (You can perform a Ping request by going to the Command console, and type in "ping [IP address or host name]". The machine you pinged replies by sending the echo message back to you.)

In a Smurf attack, the intruder sends ping commands repeatedly using the victim's address as the return address. When the Ping command is broadcast to multiple hosts on the target system's local network, all the machines receiving the Ping request will reply to the innocent, spoofed target system for each Ping command. This causes the target system's network to be flooded with ping replies. If there are enough packets flooding the network, the spoofed host will no longer be available to receive or distinguish legitimate traffic. Its services are rendered unavailable.

The diagram below illustrates a Smurf attack.

Page 159: iCarnecie SSD2 Book

Figure 1 Smurf attack

Other Resource Consumption Attacks

An intruder may also attempt to stall a system by attacking other components including CPU cycles, memory, and disk space using malicious programs. Recall that viruses, worms, and Trojan horses are programs. Executing these programs consumes CPU cycles, memory, and disk space. These malicious programs can copy themselves repeatedly to exhaust your CPU cycles, memory, and disk space.

Another way to consume disk space is by spamming an email server, generating excessive numbers of email messages. For instance, when 80% of your email storage is filled with spam mails, disk space needed to store legitimate emails will be limited. An intruder can also devise ways to cause the system to generate error messages that need to be written to disk continuously. When data is continuously written to disk with no limits on the amount of data that can be written, the system will eventually run out of disk space and become unable to perform other functions.

There are numerous ways in which an intruder can tie up your system resources is almost unlimited. The speed and impact of their attack can also be increased exponentially when they use multiple computers to launch the same attack.

Distributed Denial of Service Attack

A distributed denial of services (DDoS) attack can be more destructive than a DoS attack. A DDoS attach is usually launched using multiple computers to attack one victim computer. In a DDoS attack, the intruder compromises a few computers to act as the control centers, also known as "handlers" or "masters." The intruder also installs "agents" (frequently through a Trojan horse program) that run on other compromised computers. These agents are also known as "zombies" or "slaves." Each handler computer controls a group of agent computers. Intruders who used a DDoS attack are harder to identify because many more computer are involved, and the handler-agent tactic adds another level of complexity when tracing back to the intruder who first initiated the attack.

To initiate a DDoS attack, each handler computer commands their agent computers to flood the target system by sending out data packets to the target system simultaneously. When the target system's network bandwidth is flooded, legitimate network traffic will be unable to pass through, causing the network to be unavailable. When connected to a network, your computer can be used either as a handler computer or an

Page 160: iCarnecie SSD2 Book

agent computer to attack other computer systems. These attacks may have been used on major e-commerce sites such as Yahoo.com and eBay.com.

Read the story, "Cyber assaults hit Buy.com, eBay, CNN and Amazon".

Below is an illustration of a DDoS attack.

Figure 2 DDoS attack

Prevention

Disable or block any unused network services. Observe your system performance and establish baselines for ordinary activity. Use the baseline to gauge

unusual levels of disk activity, CPU usage, or network traffic.

Routinely examine your physical security with respect to your current needs (for example, servers, routers, unattended terminals, network access points).

Page 161: iCarnecie SSD2 Book

6.2 Security Technologies

There are many methods to strengthen the security of the computer systems or a network of computer systems. In this section, you will learn the various ways computer systems are secured via encryption and authentication.

Reading Sequence:

6.2.1 Encryption . Learning Goal: Obtain understanding of data encryption methods.

Parsons/Oja, Chapter 5 - Section E. Remark: A general overview on encryption.

6.2.2 Applications of Encryption . Learning Goal: Become aware of uses of encryption in software applications as well as hardware devices such as DVD movies and cellular phones.

6.2.3 Authentication . Learning Goal: Knowledge of different methods used for authentication. This includes digital signatures, secure-socket layer (SSL) protocol, smart cards, and Biometrics.

6.2.1 Encryption Substitution Cipher Transmitting the Key

Private Key Encryption Scheme

Public Key Encryption Scheme

Hybrid Encryption Schemes

Because unauthorized individuals may be "listening" to your data packets, information transmitted over a computer network is not always secure. There are many points in a computer network where communications can be intercepted. To address this problem, sensitive information must be encrypted prior to transmission, and then decrypted by the receiver. Encryption is the process of transforming information so it is unintelligible to eavesdroppers. Decryption is the process of transforming encrypted information so that it is intelligible to the intended recipient. A message to be encrypted is known as plaintext, and the encrypted version is called ciphertext. (A cipher is a secret code.) In order to encrypt a message in a way that the receiver can decrypt it again, there must be a key, or password, that determines how the encryption is done.

Communication via secret code has a long history, dating back at least to the ancient Greeks. Spurred by the need for greater security, an entire subfield of mathematics and computer science has grown up around cryptography. Cryptography algorithms are mathematical functions used for encryption or decryption. These mathematical calculations can be quite complicated, because they must eliminate any detectable patterns in the ciphertext that could make the code easy to break. One popular encryption algorithm for use in electronic commerce is DES, which stands for Data Encryption Standard. It was developed by the US government for applications, including secure communication applications, between government and financial institutions. Another popular encryption algorithm for computers, especially for Internet applications, is RC4. It was developed by a private company, RSA Security, Inc.

To learn more about the basics of cryptography, a good source of online information is the Cryptography FAQ.

Page 162: iCarnecie SSD2 Book

In the remainder of this section, we will first look at some simple encryption schemes, and see why they are not good enough to meet today's security requirements. Then we will examine some encryption schemes being used today.

Substitution Cipher

The most basic type of private key encryption is the substitution cipher. A substitution cipher changes the plaintext to ciphertext by replacing each element of the plaintext with its encrypted substitute. The elements might be individual letters, but they could also be words or phrases. Probably the simplest of all substitution ciphers is the character-shift cipher, which substitutes letters based on their position in the alphabet. For example, if we replace each letter of the plaintext with the letter that occurs after it in the alphabet, then A becomes B, E becomes F, and so forth. And, for completeness, we'll say that Z becomes A. The "key" in a character-shift cipher is the number of positions to shift each letter, and the direction in which to shift. If you know the key, you can decrypt the message by shifting the ciphertext characters in the opposite direction. This recovers the plaintext.

Message Encryption Technique Encrypted Message

HELLO WORLD shift right byone character

IFMMP XPSME

IBM shift left byone character

HAL

Table 1 Substitution encryption results

The character-shift cipher, because it is so simple, only provides for a small number of possible ways to encrypt a message. How many ways? Notice that shifting left by one character is the same as shifting right by 25 characters. Therefore, we only need to consider shifts in one direction. And, shifting by 26 characters would amount to no encryption at all, since A would be replaced by A, etc. So, there are only 25 distinct shifts, or 25 possible keys. This coding scheme therefore has a very small keyspace. The following chart shows all 25 character-shifts.

OriginalLetter

Right Character Shift

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

B C D E F G H I J K L M N O P Q R S T U V W X Y Z A

C D E F G H I J K L M N O P Q R S T U V W X Y Z A B

D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

E F G H I J K L M N O P Q R S T U V W X Y Z A B C D

Page 163: iCarnecie SSD2 Book

F G H I J K L M N O P Q R S T U V W X Y Z A B C D E

G H I J K L M N O P Q R S T U V W X Y Z A B C D E F

H I J K L M N O P Q R S T U V W X Y Z A B C D E F G

I J K L M N O P Q R S T U V W X Y Z A B C D E F G H

J K L M N O P Q R S T U V W X Y Z A B C D E F G H I

K L M N O P Q R S T U V W X Y Z A B C D E F G H I J

L M N O P Q R S T U V W X Y Z A B C D E F G H I J K

M N O P Q R S T U V W X Y Z A B C D E F G H I J K L

N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

O P Q R S T U V W X Y Z A B C D E F G H I J K L M N

P Q R S T U V W X Y Z A B C D E F G H I J K L M N O

Q R S T U V W X Y Z A B C D E F G H I J K L M N O P

R S T U V W X Y Z A B C D E F G H I J K L M N O P Q

S T U V W X Y Z A B C D E F G H I J K L M N O P Q R

T U V W X Y Z A B C D E F G H I J K L M N O P Q R S

U V W X Y Z A B C D E F G H I J K L M N O P Q R S T

V W X Y Z A B C D E F G H I J K L M N O P Q R S T U

W X Y Z A B C D E F G H I J K L M N O P Q R S T U V

X Y Z A B C D E F G H I J K L M N O P Q R S T U V W

Y Z A B C D E F G H I J K L M N O P Q R S T U V W X

Z A B C D E F G H I J K L M N O P Q R S T U V W X Y

Table 2 Simple shift-substitution

While this may look like a pretty complicated table, a computer can instantly calculate all 25 decodings of a message and then pick the decoding that produces recognizable English words. This method of trying every possible key to break a code is called a brute force attack, and is highly effective on codes with small keyspaces.

Page 164: iCarnecie SSD2 Book

Since simple codes can be broken quickly by brute force, one essential component to a secure code is a large keyspace. Let us see how we can increase the keyspace for a substitution cipher. Suppose that instead of shifting each character of plaintext by the same amount, we instead used a secret password, or even better, a passphrase, as our encryption key. The letters of the passphrase can be used one at a time to tell us how many characters to shift the corresponding plaintext letter by. For example, if the passphrase is CAT, we note that the letters C-A-T have alphabetic positions 3-1-20. We will therefore shift the first letter of plaintext by three characters, the second letter by one character, and the third letter by twenty characters. If we are encrypting a long message, we can repeat the passphrase in order to make its length match the plaintext.

Plaintext HELLO WORLD

Key CAT

Copied Key CATCA TCATC

Key Converted to Numbers

Plaintext

3 1 20 3 1 20 3 1 20 3

H E L L O W O R L D

Ciphertext K F F O P Q R S F G

Table 3 Passphrase key encryption

Using a passphrase to control the substitution cipher greatly expands the keyspace. With a passphrase n letters long, the keyspace is of size 26n, which grows very quickly with n. An eight-letter passphrase provides for over 208 billion possible keys.

Transmitting the Key

Suppose you want to send messages to a friend who will be traveling to a hostile location, and you want your communication to be protected against eavesdropping. You could pick a passphrase and give it to your friend before she departs on her trip. But, what happens if the passphrase leaks out after your friend has left? Your communication will no longer be secure, and you will have no way to get a new passphrase to her without it being intercepted. Another problem is that if you stick with the same passphrase for too long, an eavesdropper might be able to crack your code by statistical analysis of the encrypted messages.

It is safer to choose a new key for each message. But, you will need a way of securely transmitting that key to your friend. One solution to this problem that has been used over the centuries is to pick a line in a book to use as a passphrase, assuming that both you and your friend have copies of the book. Instead of transmitting the actual key, you just indicate the line number to look up to find the passphrase. For instance, H.II.ii.24 might refer to Hamlet Act II, Scene ii, Line 24. Even if an eavesdropper realized that this was a reference to Shakespeare's play, the eavesdropper would need to know the edition that was used in order to get an accurate key. A classical edition will use older spellings, while a modern version will use conventional spellings, and an abbreviated modern version will omit some passages. In the example below, the plaintext is encoded using a line from Hamlet taken from an edition called the First Folio, which uses older spellings.

Page 165: iCarnecie SSD2 Book

Plaintext NEW RADAR ANTENNA SPOTTED ON NORTHERN BORDER

Key Designation H.II.ii.24

Key YOUR VISITATION SHALL RECEIUE SUCH THANKES

Key Converted to Numbers

Plaintext

25 15 21 18 22 9 19 9 20 1 20 9 15 14 20 8 1 12 12 18 5 3 5 9 21

5 19 21 3 8 20 8 1 14 11 5 19 25

N E W R A D A R A N T E N N A S P O T T E D O N N O R T H E R N B

O R D E R

CiphertextM T R J W M T A U O N N C B U A Q A F L J G T W I T K O K M L V C

C C I X Q

Table 4 Passphrase key transmission and encryption

Private Key Encryption Scheme

In a private key encryption scheme, the same key that was used to encrypt a message can also be used to decrypt it. This is also known as the symmetric encryption. In this scheme, the sender and receiver must keep the key to themselves, hence the term, "private" key encryption scheme. If anyone else discovers the private key, the message would not be secure. Figure 1 below illustrates how private key encryption works.

Figure 1 Private key encryption

Private key encryption schemes are used by modern encryption algorithms such as DES and RC4.

Public Key Encryption Scheme

Public key encryption, uses one key is to encrypt a message and another key to decrypt it. It is also known as asymmetric encryption scheme. In this encryption scheme, only the decryption key need be kept secret, and the encryption key can be freely published. For example, if you were to send a secret message to someone, you could encrypt the message with the recipient's public key. The recipient then uses his/her private key to decrypt the data. Since it is assumed that only the recipient has his private key, the message cannot be decrypted by anyone else. Figure 2 below illustrates how public key encryption works.

Page 166: iCarnecie SSD2 Book

Figure 2 Public Key encryption

In a public key encryption scheme, each public key has a corresponding private key. An eavesdropper cannot decrypt a message even if he knows the public key that was used to encrypt it. Only the person holding the private key can decrypt the message.

Public key encryption is based on a branch of mathematics called number theory, which says that certain types of problems, such as factoring large numbers, appear to be intractably hard. In other words, if a number is many digits long, it can take an extremely long time to find a smaller number (other than 1) by which it divides evenly. Because intractable problems are so hard, a code based on these types of problems should be safe from brute force attack. The calculations required to break such a code would take way too long—perhaps trillions of years, even on a very fast computer.

One common way for people to communicate via public key encryption is a software package called PGP, which stands for Pretty Good Privacy. PGP was developed by an American programmer, Phil Zimmermann, because he wanted to ensure that private citizens, not just governments, would be able to communicate without fear of eavesdropping. You can learn more about it at the International PGP Home Page.

To arrange for secure email communication via public key encryption, the first thing you need to do after installing encryption software on your computer is ask the software to generate a key pair for you. The software will generate some large random numbers, and use these to calculate a private and a public key. Your private key must be kept in a secure place that only you have access to. Your public key can be given out to anyone. Some people publish their public key on their personal Web page. Others register their public key in online directories set up for that purpose. And, some people configure their email software to append their public key to each outgoing message, to make it easy for a reader who wishes to encrypt a reply to them.

Now suppose your friend wants to send you a secret message. She encrypts the message using your public key, and sends the encrypted text via email. An eavesdropper may intercept the email, but the eavesdropper will not be able to read the message. When you receive the message, you use your private key to decrypt it. If you want to send a reply, you can encrypt it with your friend's public key. Your friend will decrypt it using her private key. Some email programs now include built-in support for PGP, so that encryption and decryption take place automatically.

Public key encryption can be used to ensure that the person receiving the message is the intended receiver; it can also be used to ensure that the sender of the message is the genuine originator of the message. Using private key and public key pairs, a digital signature can be generated to ensure that the sender of the message is genuine. This will be discussed in more detail in section 6.2.3 Authentication.

Hybrid Encryption Schemes

Although public key encryption is very secure, it does have some drawbacks. This method for encrypting and decrypting messages requires a lot of computation, so it is slower than other types of codes. Also, the encrypted message may be quite a bit longer than the original plaintext, perhaps twice as long, so it will take

Page 167: iCarnecie SSD2 Book

longer to transmit over a network. These considerations led people to develop hybrid schemes in which public key encryption is used to send a freshly-created key, called the session key, and then the actual message is encrypted using a symmetric encryption scheme like RC4 or DES, based on that session key. Because session keys are generated randomly and thrown away after one use, even if an eavesdropper manages to decrypt one message by brute force, the eavesdropper will be unable to decrypt any other messages between the same parties. So, the hybrid scheme is reasonably secure, and it takes advantage of the efficiency of the simpler symmetric encryption schemes.

Most public-key encryption schemes are actually hybrids of this sort. SSL (the Secure Socket Layer protocol used by web browsers) is a hybrid scheme. More about SSL will be discussed in section 6.2.3 Authentication.

6.2.2 Applications of Encryption Email Hard Drives

DVD Movies

Cellular Phones

Encryption technology is widespread in the digital world. Some important uses of encryption are discussed below.

Email

Email may travel through a dozen computers on its way from the sender to the intended recipient, so there is ample opportunity for eavesdropping. By default, email is not encrypted at present, but many users are opting to use PGP to secure their email communications. Some mail clients now include built-in PGP support.

Hard Drives

Some users are choosing to encrypt their entire hard drive, in order to protect against loss of secrets in the event that their computer is stolen or seized. An old laptop full of trade secrets or classified military information might be worth much more to a thief than a new laptop with an empty hard drive. While user directories can be protected with passwords, an intruder with physical access to the machine can use his own copy of the operating system to boot the computer, and thereby gain access to all the data on the computer. Or, the intruder can make a copy of the hard drive, a process known as mirroring, and thus steal the data it contained.

Encrypting the hard drive prevents others from reading your files, even if they steal or copy the drive. Each time your computer boots, you would be required to enter a pass phrase to unlock the drive.

DVD Movies

Movies on DVD (Digital Video Disk) are encrypted using a scheme called CSS (Content Scrambling System), in order to prevent people from making unauthorized copies. However, the encryption scheme was not secure. In 1999, several groups of computer programmers broke the encryption by reverse-engineering a software DVD player. Although the motion picture studios filed several lawsuits to prevent the distribution of software for decrypting DVD movies, their efforts have been unsuccessful. Programmers claimed that computer code is a type of speech, and therefore should enjoy the same legal protections as books and

Page 168: iCarnecie SSD2 Book

music. Hence, they have spread the code all over the world, and even printed the code on T-shirts. You can learn more about this controversy by visiting the Gallery of CSS Descramblers.

Cellular Phones

Every cellular phone has an electronic serial number to provide unique identification of the phone. When a call is made, the cellular phone transmits its identification information. This allows the phone system to provide continuous service to the caller as the caller travels from one place to another, and it also allows the call to be billed accordingly. Someone who captured this information could "clone" the cellular phone by copying its ID into another phone. As a result, its calls would then be billed to the original owner. In order to prevent this, digital cellular phones use encryption to protect the phone's identity. (Analog cellular phones, based on older technology, do not use encryption.) Because people often use the pushbuttons on a phone to enter private data such as bank account numbers and credit card numbers, all digits dialed on a digital phone are also encrypted.

Cellular phones use relatively weak encryption. Recently several cellular phone encryption schemes have been cracked by independent cryptography experts, but even this weak encryption is sufficient to deter casual eavesdroppers.

6.2.3 Authentication Strong Passwords Smart Cards

Biometrics

Digital Signatures

Digital Certificates and Certificate Authorities

SSL Protocol

Authentication is the process of confirming an identity, determining whether you are who you claim to be. This is usually done by verifying that your login name and password match. However, passwords can often be stolen, accidentally revealed, or forgotten. This section introduces some techniques that would make the authentication process more stringent including stronger passwords, smart cards, and biometrics. In latter parts of this section, you will learn about technologies such as digital signatures, certificates, and the SSL protocol that ensure data originated from the genuine source.

Strong Passwords

As you recall from the previous section, 6.1.2 Identity Theft and Privacy Violation, passwords are like the keys to the accounts you want to protect. A weak password may be easily guessed by an intruder. The first line of defense that you can employ against intruders is a password that would be hard for intruders to crack. Below are some guidelines as to what constitutes good password and what constitutes bad passwords.

Characteristics of a good password:

Difficult to guess At least 8 characters long, the longer the better (if you can remember it)

Contains a mix of uppercase letters, lowercase letters, numbers, symbols, and punctuation marks

Characters are arranged in an unpredictable order

Page 169: iCarnecie SSD2 Book

Can be typed in quickly by you to prevent someone from obtaining your password by looking at your key strokes

Characteristics of a bad password:

Based on personal information such as all or part of your name, nickname, birth date, company name, and relative's name

Based on surrounding objects, such as "computer", "desk", "book"

Words from a dictionary

Names of fictional characters from movies or books

Words spelled in a particular pattern (e.g. with the last letter omitted, backwards)

Character sequence that is easy to type, such as "asdf" and "qwer"

Characters that follow a certain pattern such as "abcabcdabcde" and "1122334455"

Passwords you have seen or used previously

Generating a good password:

Use a password generator application Use the third letter of each word (more than 2 characters long) from a randomly selected sentence

Example:

o Sentence: "AUTHENTICATION is the process of confirming an identity, determining whether someone is who he claims to be."

o Password: "Teonetemoa."

Insert symbols randomly (e.g. "Te*netem$a.")

Mix of uppercase letters, lowercase letterers, numbers, symbols, and punctuation marks (e.g. "T1e*netEm$a.")

Smart Cards

A smart card is a credit card-sized plastic card with an embedded integrated circuit chip. It serves as a secure medium for storing important personal identification information such as picture identifications, voiceprints, fingerprints, signatures, and account information.

Below is an illustration of a smart card chip.

Figure 7 smart card chip

Smart card chips can be embedded on phone cards, banking cards or health cards. Using the phone card as an example, the smart card chip is embedded on the phone card, which contains your phone account number

Page 170: iCarnecie SSD2 Book

and other related information. To use the card, you would slide the card into the card reader usually embedded as part of the public phone. The card reader would prompt for a PIN number, and then it would read off the information from the smart card to authenticate you. Once you are authenticated, you are permitted to make the phone call if you have enough minutes left on the card. Similarly, a smart card that stores login and password information can be used to log onto computer systems. To access a computer system, you would insert the smart card into a card reader connected to the computer system. After providing your PIN number, the system will authenticate you based on the information on the smart card and the PIN number you provided.

The embedded chip consists of a microprocessor, ROM, RAM, and electrically erasable programmable read only memory (EEPROM). Recall from section 2.1.2 Types of Memory, EEPROM enables the chip to retain its state even when power is removed. The chip provides memory capacity, as well as computational capability. The self-containment of a smart card allows it to be resistant to network or Internet attacks. Information on a smart card can be scanned by a custom-programmed reader to authenticate the cardholder in order to permit or deny access to the system's services. Modern smart cards contain security features such as data encryption.

Biometrics

Biometrics refers to the automatic identification of a person based on his/her physiological or behavioral characteristics. Among the features measured are face, fingerprints, handwriting, iris, and voice. Biometric technologies are being developed to enhance identity verification solutions. This method of identification is more secure compared to traditional methods involving passwords and PIN numbers because the person to be identified is required to be physically present at the point-of-identification. Also, it is more convenient because it eliminates the need to remember passwords or PINs, or carry identification cards.

With the increased use of computers, it is necessary to restrict access to sensitive data. By replacing PINs, biometric techniques can potentially prevent unauthorized access to or fraudulent use of ATMs, cellular phones, smart cards, desktop PCs, workstations, and computer networks. PINs and passwords may be forgotten, and identification like passports and driver's licenses may be forged, stolen, or lost. Institutions currently using biometric-based authentication solutions include governments, military divisions, electronic banking, law enforcement, and social services.

Digital Signatures

Just as you would sign a document to indicate to the receiver of your message that the message came from you, you can attach a digital signature to an electronic document to indicate that the message did indeed originate from you. A digital signature must be both unique to the sender and unique to the particular message so that it can be verified but not reused. For instance, if you were to send an email request to have your friend deposit $2000 to your account, you may attach a digital signature to your email request so that your friend can trust that the request did come from you and the account information included in the email is not altered

To generate a digital signature unique to the message and to the sender, the solution is to make the signature be a "hash code" for the plaintext message. A hash code is a numerical value computed from the plaintext in such a way that any change to the plaintext, even to just one character, will cause the hash code to change as well. For instance, say Bob is sending Alice a message and he is including his digital signature. To generate a digital signature, Bob would first generate a hash code of the message, and then encrypt the hash code using his private key to create a signature that is both unique to him and unique to that particular message. When Alice receives the message, she can use Bob's public key to decrypt the digital signature and see the hash of the message. She can then compute the hash of the message. If the two hash codes were the same,

Page 171: iCarnecie SSD2 Book

the message had not been altered. Otherwise, either the message was altered during transmission, or it was not really signed by Bob. Two popular hash code algorithms in use today are MD5 and SHA-1.

Let us now delve into how digital signatures work using public key encryption. Recall the discussion on public key encryption from 6.2.1 Encryption. To encrypt a message, the sender uses the receiver's public key. To decrypt the message, the receiver uses private key. To generate a digital signature, the encryption process using public and private keys are reversed. The sender uses the private key to encrypt the hash of the message to indicate that the message did originate from the sender, and the receiver would decrypt that data with the sender's public key. The message is genuine because only the sender has the private key to encrypt the data. The process for generating and verifying a digital signature is illustrated in the diagram below:

Figure 3 Using public key encryption to generate and verify digital signatures

The steps described in the diagram are as follows:

Sender:

1. Transform the entire message using a hashing algorithm to generate a hash of the message.

2. Generate the digital signature by encrypting the message hashed using the sender's private key.

Receiver:

Page 172: iCarnecie SSD2 Book

1. Transform the entire message using a hashing algorithm to generate a hash of the message.

2. Decrypt the digital signature using the sender's public key.

3. Compare the message hashed, and the decrypted digital signature, which should be the same as the sender's message hashed. If these two hashes are the same, then the receiver can trust that the message was sent from the sender and that the message was not altered during transmission. Otherwise, the message may have been altered.

Digital signatures can be generated using PGP's digital signature feature. Some email clients also enable digital signature attachments to messages.

Keep in mind that attaching a digital signature verifies that the sender of the message is genuine and the message has not been tampered with. However, if the message you are sending is sensitive, you should also encrypt the entire message (along with your digital signature) with the receiver's public key. To read your message, the receiver would first decrypt the entire message along with the digital signature using the receiver's private key, and then use your public key to decrypt the digital signature. If the decrypted signature is the same has the hash code of the message, then the receiver can be sure that the message did come from you.

Digital Certificates and Certificate Authorities

Just as a driver's license or a passport is used to identify a person, a digital certificate is used to identify an individual, a server, a company, or some other entity. A digital certificate is an electronic identity document whose purpose is to help prevent impersonation. To extend this analogy, just as you would go to a government agency to obtain a passport, you would go to a certificate authority (CA) to obtain a digital certificate. A CA is a trusted third-party organization or company that validates identities and issues certificates. The certificates are used to associate public keys with entities (e.g. organizations, people). The role of the CA in data security is important, as electronic exchange of data becomes a necessity for communications and commerce. For example, electronic-commerce sites such as Amazon.com and BestBuy.com have digital certificates so that users can trust that they are using legitimate sites instead of a fraudulent site created by hackers.

In general, before issuing a certificate, the CA must verify the identity of the entity requesting for the certificate. The certificate issued by the CA associates a specific public key with the entity requesting for the certificate. A certificate also includes the name of the entity it identifies, an expiration date, the name of the CA that issued the certificate, and a serial number. Most importantly, a certificate includes the digital signature of the issuing CA to ensure the authenticity of the certificate.

Web browsers are usually pre-configured to trust certain certificate authorities, such as Verisign, Inc. You can view the list of trusted CAs by clicking on Tools from your Internet Explorer menu. Then choose Internet Options..., click on the Content tab. Click on the Certificates... button, and then click on the Trusted Root Certification Authorities tab. To see a digital certificate, you can go to a website that uses digital certificates such as that of a financial institution or that of an online store. For instance, when you view your personal information on Amazon.com, you can double-click on the "lock" icon at the bottom right-hand side of the screen and view the digital certificate.

The image below is a digital certificate from Amazon.com:

Page 173: iCarnecie SSD2 Book

Figure 4 Digital certificate

Root CAs can also grant certification authority to subsidiary CAs. The Certification Path tab shows the path from root CAs to the digital certificate holder. The screen shot below shows that Amazon's root CA is VeriSign/RSA Secure Server.

Page 174: iCarnecie SSD2 Book

Figure 5 Certification Path

When you visit a site that may have a faulty certificate, you will see a warning like the following screen shot:

Figure 6 Certificate warning

At this point, you can choose to proceed despite the warning, or choose "No" to terminate your request to the page. You can also view the certificate and then decide whether you want to proceed to the page. If a CA is not a member of your trusted CA list, you may choose to install the Certificate. Please be cautious before you install a certificate. Intruders may fake a certificate to get you to install it. Once the fraudulent certificate is installed, malicious programs may be run from your computer. You can read about the security incident

Page 175: iCarnecie SSD2 Book

where intruders pretended to be Microsoft employees and obtained certificates from VeriSign, Inc. These certificates could be used to sign programs, ActiveX controls, Office macros, and other malicious code.

The set of standards and services that govern the use of public-key cryptography and the system of certificates is called Public Key Infrastructure (PKI).

A typical enterprise's PKI encompasses the following:

Issuance of digital certificates to individual users and organizations Integration with corporate certificate directories; tools for managing, renewing, and revoking certificates

You can read about how digital signatures, certificates, and PKI work together to ensure the security of network communications.

SSL Protocol

Web applications rely on encryption to protect information such as passwords, credit card numbers, customer names, and addresses transmitted between a Web browser and a server. SSL (Secure Socket Layer) is a protocol layer that operates on top of TCP/IP to provide encrypted communications. The protocol is a set of rules governing server authentication, client authentication, and encrypted communication between servers and clients. SSL is widely used on the Internet, especially for interactions that involve exchanging confidential information such as credit card numbers. SSL uses public key cryptography to transmit a unique session key for each connection. It then uses a faster, symmetric encryption algorithm such as DES or RC4 to encrypt whatever information the application needs to transmit.

When you establish a connection to a web site, such as the web site for Amazon.com booksellers, you want to be assured that your communications will not be read by an eavesdropper and you are communicating with a legitimate Web server, not an imposter pretending to be Amazon.com. In order to verify the identity of a Web server, the SSL asks the server for its public key and it requires the key to be digitally signed by a certificate authority.

When you communicate with a Web server using the prefix https instead of http, your browser establishes an SSL connection. Many websites such as Amazon.com use this technique to keep your password and personal data secure from others. You will also see a lock icon appear at the bottom right of the web page window indicating the data on the page came to you encrypted via a SSL protocol. If do not see a lock icon when transmitting sensitive information, you should be aware that your data was not encrypted, and may be seen by eavesdroppers. The image below highlights the URL that begins with "https" and the lock icon, indicating that the data on the page will be transmitted securely.

Page 176: iCarnecie SSD2 Book

Figure 6 Using SSL

As part of the initial "handshake" process between the server and the client, SSL requires a server SSL certificate. The server presents its certificate to the client to authenticate the server's identity. The authentication process uses public-key encryption and digital Signatures to confirm that the server is in fact the server it claims to be.

For more detailed information about SSL, see an introduction to SSL.

6.3 Prevention, Detection, and Recovery

In addition to using technologies that keep your data secure such as encryption and authentication, there are many ways to protect your data by preventing and monitoring network activities. It is also important to keep back-ups of your data in case of data loss.

Reading Sequence:

6.3.1 Firewall . Learning Goal: Obtain knowledge of what a firewall is, what purpose a firewall serves, and how the firewall attempts to perform its job.

6.3.2 Intrusion Detection Tools . Learning Goal: Gain familiarity with tools used for intruder detection and prevention such as network monitoring tools, and anti-virus tools.

6.3.3 Data Recovery . Learning Goal: Learn about back-up methods for data recovery.

Parsons/Oja, Chapter 4-Section E. Learning Goal: Learn about disk backup procedures that provide for the

Page 177: iCarnecie SSD2 Book

recovery of lost or corrupted files.

Parsons/Oja, Chapter 4-Lab: "Backing Up Your Computer". Learning Goal: Practical experience with data backup and recovery.

6.3.4 Summary of Security Tips . Learning Goal: Knowledge of security practices that are most important to prevent and counter some security vulnerabilities.

6.3.1 Firewall Application Gateway Packet Filter

Application Gateway versus Packet Filter

Hybrid

Intruder Attacks Prevented by Firewall

Setting up a Firewall

A firewall is a program or hardware device that protects your network by filtering incoming packets from the Internet entering your protected network or computer system. It can be used as a cost-effective method to protect a computer at home, or within an organization. Using a firewall to protect your private network is similar to employing gates and guards to protect your property. It provides a level of separation between your protected system and the Internet. A firewall serves as one of the first defenses against unauthorized access to systems and information. It acts as a gatekeeper to your computer system. It is usually installed between an internal network and the Internet to ensure that only authorized traffic can enter and leave the secured network. If incoming traffic is not recognized as permitted traffic by the firewall, it is not allowed through.

Firewalls are also important because they can provide a single "choke point" where security policy can be implemented and auditing can be performed. Firewalls often provide summaries to the administrator about the kinds of data passed through, the amount of traffic processed, and the number of attempts to break into the protected system encountered.

The figure below illustrates the firewall as a filter for incoming traffic entering the protected network.

Page 178: iCarnecie SSD2 Book

Figure 1 Firewall and the protected network

Application Gateway

There are two types of firewalls. The first type is an application gateway. Instead of allowing corporate hosts to communicate directly with external hosts, communication has to go through an application, called a proxy, running on or directly behind the firewall. For example, when a corporate host tries to read a Web page, it establishes a connection with a Web proxy running on the firewall instead of the actual server. The proxy will inspect the requests and, if approved, it will fetch the page from the actual server. Once the page is returned, the proxy has the option of inspecting it, and then finally forwarding it to the requesting host. Similar proxies can be built for electronic mail and other applications.

Packet Filter

The second type of firewall is a packet filter. It uses information in the header of every packet to decide whether a packet is acceptable to pass the firewall. Recall that a packet contains the address of its sender, the address of the destination, and data. If a packet's source or destination is not acceptable, the packet is blocked, and a record is entered in a log that can be inspected by the network manager.

Packet filters allow only fairly coarse access control. The reason is that they have to make filtering decisions exclusively based on whether specific header fields (for example, port numbers or IP addresses) match or do not match certain well-known values. For example, it is possible to restrict the applications that can send

Page 179: iCarnecie SSD2 Book

data through the firewall based on port numbers. Because email usually uses port 25, legitimate email traffic sent to port 25 can pass through the firewall. It is also possible to restrict, based on IP addresses, with which hosts or destination networks corporate systems can communicate. For example, the packet filter can prevent communication with specific websites. However, if a Web server uses non-standard port numbers or if proxies are used to mask IP addresses, a packet filter may not be able to catch all packets that violate corporate policies.

A more recent packet filtering method compares certain key parts of the packet. The firewall examines packets and tracks their state from packet to packet. It also tracks inter packet communication to ensure data coming back was requested from inside the firewall.

Application Gateway versus Packet Filter

Compared to packet filters, application proxies can provide a finer-grained access control than packet filters, and they also have the advantage that they can check contents. For example, application proxies can screen email for privileged information. Additionally, they can reject mal-formed data or change the data to a proper form. A drawback is that they are much slower than packet filters. Moreover, a proxy has to be developed for each application. Note that if a corporate network is connected to the Internet through a firewall that uses application gateways, the hosts on that network are not visible on the Internet. This means their IP addresses will never show up in any packets on the Internet.

Hybrid

In an attempt to combine the security of the application gateways and the flexibility and speed of packet filtering, some vendors have created systems that use the principles of both. In these hybrid systems, new connections are authenticated and approved at the application layer. Then the remainder of the connection is passed down to the session layer, where packet filters ensures that only packets that are part of an ongoing (already authenticated and approved) transmission are being passed.

Other possibilities include using both packet filtering and application layer proxies. This method protects computers that provide services to the Internet (for example, public Web server), and serve as an application layer gateway to protect the internal network. Additionally, this method provides multiple layers of defense for intrusions aimed at services on the internal network.

Intruder Attacks Prevented by Firewall

A firewall may protect against the following intruder attempts to breach the security of the system:

Remote login - Intruders may enter your protected network via Telnet logins. Firewalls can block traffic from Telnet and other remote data transfer methods.

Application backdoors - Some programs have special features that may allow intruders to enter illegitimately. Some other programs may contain bugs that provide a backdoor or hidden access that can provide the intruder with some level of control of the program. A firewall can be set up to allow traffic to pass through legitimate ports of the application only.

Source routing - In most cases, the path a packet travels over the Internet is determined by the routers along that path. But, the sender of the packet can arbitrarily specify the route that the packet should travel. Hackers sometimes take advantage of this to make information appear to come from a trusted source or even from inside the network. Most firewall products disable source routing by default.

Page 180: iCarnecie SSD2 Book

Viruses - A hybrid firewall can be used to examine mail traffic and filter out those with specific attachments (such as those with file extensions .exe and .vbs).

Denial of service- A firewall can block offending IP addresses

Setting up a Firewall

The effectiveness of a firewall is dependent upon the rules regarding what type of data can pass through, and what type of data is not permitted. The firewall can also be configured to help reinforce certain security policy set up by you or your organization on machines within the protected network. For applications, it can serve as an added layer of security check to ensure that application backdoors are not exploitable.

Firewall configuration is based on the level of security you or your organization wants to establish. The highest level of security would be to block all traffic, but that would defeat the purpose of having an Internet connection. Some firewalls permit only email traffic, thereby protecting the network against any attacks other than those against the email service. Other firewalls provide a lower level of security, and only block services that are known to be problems. Generally, firewalls are configured to protect against unauthorized remote logins via Telnet. This helps prevent intruders from logging into machines on your network.

Some firewalls can be configured to block traffic from the outside to the inside, but permit users on the inside to communicate freely with the outside. However, it is also important to ensure messages from the inside are filtered through the firewall. In case of a virus infection, filtering packets internal to the network can prevent the infection from spreading. A common rule of thumb for setting up a firewall is to block everything and then begin to select what types of traffic you will allow.

Despite how a firewall is set up, be aware that a firewall only protects you from the traffic it denies, and denying all traffic may not be feasible. There are other tools to strengthen the security of your computer system, which you will learn in the next section.

6.3.2 Intrusion Detection Tools Intrusion Detection Systems Network Monitoring Tools

Anti-Virus Software

Intrusion Detection Systems

An intrusion detection system (IDS) for a computer is like a security system for a home. When an intrusion is detected, the IDS alerts the network administrators, just as the alarm of the home security system would go off to alert the homeowners. An IDS gathers and analyzes information within a computer or a network to identify possible security breaches. In case of a security breach, an IDS can provide traces of events to help track down the intruder. However, an IDS does not block potentially malicious traffic. When used with a firewall, an IDS can verify the firewall configurations and serve as an added layer of security that alerts network administrators of suspicious data that passed through the firewall. Compared to firewall, IDS provides more in-depth traffic monitoring.

An IDS works by matching incoming traffic against an intrusion detection (ID) signature database of known attacks or suspicious activity, and alerts administrators when a match occurs. An ID signature can be a special TCP state, special bytes in the IP header, or a special byte stream in a packet. Some intrusion signatures and incident databases are publicly available. IDS can also send automatic notifications to alert system administrators of potential security breaches via a variety of channels, including email and mobile

Page 181: iCarnecie SSD2 Book

phones. These notifications would help network administrators identify subsequent steps for resolving the security breach and they can help strengthen security policies.

Strengths of IDS:

Can trace each step of an attack Cannot be easily circumvented

Weaknesses of IDS: Cannot block intruding traffic Only as strong as its signature database

Possibility of false alarms

Set up may require some level of configuration and security knowledge

An example of an open source network IDS is Snort. It keeps an active log file to detect possible intrusions or access violations occurring in real-time. It can also monitor and inspect network traffic and failed connection attempts, connections to/from unusually locations, unauthorized network probes, systematic port scans, traffic contrary to firewall setup, and unusual file transfer activity.

Setting up an IDS

Typically, an IDS is set up behind the firewall to examine more thoroughly packets that have filtered through the firewall. The figure below illustrates how an IDS could be set up in a network system.

Page 182: iCarnecie SSD2 Book

Figure 1 Setting up an IDS

Network Monitoring Tools

Network monitoring should be conducted continuously to maintain confidence in the security of a protected network and data resources. Network monitors may be installed at strategic locations to collect and examine information continuously that may indicate suspicious activity. Some systems can react to suspicious network activity by blocking suspect connections, limiting or disabling affected services, isolating affected systems, and collecting evidence for subsequent analysis. Additionally, monitoring can help determine whether security countermeasures are effective.

Below is a list of network monitoring tools with brief descriptions to provide you with a sense of what type of network monitoring tools are being used today.

Tripwire® - enables you to detect unexpected contents of files and directories Analyzer/Sniffer - captures and analyzes network packets. It gathers information about data passing through

your network and decodes the analyzed data.

Big Brother - tests system conditions and the availability of network services, and notifies administrators about system problems.

Page 183: iCarnecie SSD2 Book

Ethereal - enables you to examine data from live network or from a captured file on disk. It is a free network protocol analyzer for UNIX and Windows (including Win2K).

Anti-Virus Software

Virus attacks can spread quickly and are costly and time-consuming to fix. Researchers at CAIDA estimate that Code Red worm infected 359,000 computers in less than 14 hours. [CAIDA] Therefore, it is worth the investment to install anti-virus software on all servers and workstations within the protected network to guard against malicious code attacks.

In general, an anti-virus software program searches through files (or memory) for indications of malicious code using a virus profile (sometimes called "signatures") provided by the vendor. Anti-virus software programs can also remove viruses from files, isolate files that cannot be cleaned, and discover Trojan horse programs and worms. Some anti-virus software can recover data deleted by viruses.

Because new viruses are discovered daily, the effectiveness of anti-virus software is dependent upon having the latest virus profiles installed on your computer. Some virus tool vendors provide subscription services or other distribution facilities to help customers keep up to date with the latest viral signatures.

Strengths of anti-virus software:

Protect users from email borne malicious code that can go unnoticed by IDSs and firewalls Can detect a network-propagated virus infection

Weaknesses of anti-virus software:

Must be updated frequently Does not protect against all network-based exploits

Two popular anti-virus programs are Norton Anti-Virus and McAfee Anti-Virus toolkits. Click on either of these links to explore their virus information libraries.

More information about viruses and anti-virus software can be found on the CERT Computer Virus Resource page.

You can also read an article on "Malicious Code Propagation and Antivirus Software Updates" from the CERT incident notes page.

6.3.3 Data Recovery

In case of a security breach where your data is compromised, tampered with, corrupted, or deleted, you need to be sure you have a backup, or a copy of your data to restore your computer system. Data that can be compromised include files, application programs, and the operating system. Backing up your data is one of the most important actions in securing your computer system. Having a backup of your data not only mitigates data loss caused by intruder attacks, backups also help recover from losses caused by unintentional deletion of data, software malfunction, hardware malfunction, and natural disasters.

In general, you should back up your system:

Periodically (for example, monthly, weekly, every other day, everyday) depending on how frequently your data changes

Page 184: iCarnecie SSD2 Book

Before you make potentially irreversible changes to your data such as changing file structures, deleting large amounts of data

Before installing hardware or software components that may alter your data

Backups should be kept on a removable medium or stored at a remote site in case of natural disasters or physical destruction of computer equipment. When performing virus scans or data integrity checks on your system, be sure to perform it on your back ups too. It is important that the backed up data is not compromised or corrupted.

There are various backup methods.

Full backup

A copy of all your data

Differential backup

A copy of all the data that changed since the last full backup

Incremental backup

A copy of all the data that changed since the last full, differential, or incremental back up. Note that the first incremental backup is also a differential backup from the full backup.

Selective backup

A copy of only selected data

Below is a chart comparing the relative time consumed for each method, and a suggested time frame for performing each backup scheme.

Backup Method Relative time Suggested backup period

Full backup *** every week or every other week

Differential backup ** mid-way between full backups

Incremental backup * mid-way between differential backups

Selective backup * to** when selected data is changed

Table 1 Comparing backup methods

To understand how these backup methods work better, let us visit some scenarios.

Example 1: organization that does a full backup every Friday at 5 P.M. and a differential backup every Wednesday at 5 P.M.

Incidence: data failure on Thursday at 6 P.M.

Page 185: iCarnecie SSD2 Book

Data recovery method: restore data from last Friday's full backup and then Wednesday's differential backup.

Data loss: data after Wednesday's differential backup and before data failure Thursday- about 25-hours worth of work on the machine

Example 2: organization that does a full backup every Friday at 5 P.M., a differential backup every Wednesday at 5 P.M., and an incremental backup every other day at 5 P.M.

Incidence: data failure on Thursday at 6 P.M.

Data recovery method: restore data from last Friday's full backup, then Wednesday's differential backup, and finally Thursday's incremental backup.

Data loss: data after Thursday's incremental backup- about one hour worth of work on the machine

Notice that it may take more time to recover data if many incremental backups were done, but the amount of data lost would be less. When determining how often you should backup your data, ask yourself how many hours worth of work on the computer are you willing to risk losing? For example, if your answer is 24 hours, then you should back up everyday. If your answer is 48 hours, you should back up every other day. When choosing a backup method, keep in mind the relative amount of time each backup method takes to complete when you would conduct the backup. For example, a full backup would take the longest amount of time; therefore, they are usually performed during hours when the computer system is not being used as much. At the minimum, full backups should be performed on a regular basis.

6.3.4 Summary of Security Tips

There are many ways to violate your data integrity, breach your data confidentiality, and interrupt your system availability through malicious acts, user errors, and disasters. The following is a list of security practices that can help you protect your computer system:

Keep applications and operating system updated with the latest security patches (vendors such as Microsoft are continually fixing vulnerabilities and posting updates to their customers)

Turn off your computer or disconnect from the network when not in use

Close all unused Internet ports

Install firewalls to protect your network boundary in order to keep unwanted traffic and users out of the network

Use security software such as firewall and intruder detection systems

Practices against privacy violation and identity theft:

Use strong passwords that are 8 or more characters long, consisting of a mix of upper and lower case letters, numbers, and punctuation marks

Encrypt sensitive data such as passwords and credit card numbers

Page 186: iCarnecie SSD2 Book

Practices against malicious code: Avoid opening unexpected email attachments. If you must, be sure your virus definitions are up-to-date, save

the file to your hard disk, scan the file using your anti-virus software, and then open the file Expose hidden filename extensions

Exercise caution when downloading unauthenticated software. If you choose to install software that has not been signed by a trusted source, you may wish to wait for a period of time before installing it in order to see if a Trojan horse is discovered

Disable Java, JavaScript, and ActiveX if possible- a malicious web developer may attach a script to the content sent from a web site. The malicious script is transferred to your browser, where it can execute and compromise your machine. However, disabling Java, JavaScript, and ActiveX may impair your browsing experience

Disable scripting features in email programs if possible- email programs use the same code as web browsers to display HTML, therefore vulnerabilities that affect ActiveX, Java, and JavaScript are often applicable to email as well as web pages

Turn off macros in applications

Install anti-virus software and keep it up-to-date on user machines and on email servers

Consult your system support personnel if you work from home to conform with employer's policies or procedures relating to the security of your home network

Practices against data failure, corruption, or deletion:

Develop a recovery plan in case your system is compromised, or destroyed Perform and verify backups

Make a boot disk before your computer is damaged or compromised

If your computer is compromised:

Disconnect it from the network and restore from backups Verify the integrity of the entire computer (software, configuration files, logs, data, etc.)

If integrity cannot be verified, reinstall operating system and applications

Apply all security patches and workarounds before reconnecting to network

It is also possible to safeguard your system so that traffic other than that which is necessary cannot pass through your system. But, keep in mind, you may be limiting your system's ability to interact with other systems or users (for example, filtering out email attachments). Or, you can go to the extremes to avoid security threats and limit your use of the computer by disconnecting from the network. That, however, would severely limit the functionality of your computer. When setting up a computer system, there is a balance that you will need to establish between risk and reward. You should estimate how much risk you are willing to take in order to obtain the functionality that you desire for your computer system. In general, when safeguarding your computer system, make sure you follow a reasonable security policy advised by security experts (from security organizations such as The CERT® Coordination Center (CERT/CC), SANS Institute, or security personnel from your organization).

Most intrusions result from exploitation of known vulnerabilities, configuration errors, or virus attacks where countermeasures were available. One of the most important and useful ways to strengthen the security of your system is to become informed of security issues and vulnerability updates. By performing the

Page 187: iCarnecie SSD2 Book

recommended practices, you can operate your system in a more secure manner, and help spread best practices to others around you.

Some useful resources:

CERT Tech Tip: Home Network Security Recovering from an Incident

Unit 5 and Unit 6 Review Materials

Note: The questions on the exam will be based on variations of the following pool of questions and exercises in Unit 5 and Unit 6.

1. Computer System Attacks a. Describe each of the following computer system attacks

i. file virus

ii. macro virus

iii. boot sector virus

iv. Trojan horse

v. worm

b. Name two software programs that protect against the attacks listed in part a.

2. Data Backups

a. Describe full, incremental, and differential backups.

b. Name two benefits of performing backups.

c. In the table below, fill in a backup schedule for a one-week period for a typical desktop machine.

Strategy Schedule

Full answer

Incremental + Full answer

Differential + Full answer

3. Data Integrity

a. In the context of Java applets, what is a sandbox, and how does it protect computer information?

b. What is a digital certificate, and how does it protect computer information?

c. What is a firewall, and how does it protect computer information?

d. In the context of a Web browser, what is a cookie, and how might it not protect computer information?

Page 188: iCarnecie SSD2 Book

4. Data Transfer

a. What is the purpose of an NIC?

b. What is the function of a hub?

c. What is the function of a router?

5. Domain Names

a. What is a fully qualified domain name?

b. Explain what is indicated by each part of www.icarnegie.com.

c. List five non-country, top-level domains.

d. What is the function of a DNS (Domain Name Service)?

6. Encryption

a. Describe how character-substitution encryption functions.

i. Define plaintext.

ii. Define ciphertext.

b. Describe how private-key encryption functions.

c. Describe how public-key encryption functions.

d. Encrypt the following word with a two-character right shift.(Note: The word will not be "secret" on the exam.)

e. secret ==> _________7. Modems

a. Explain modulation/demodulation.

b. How does a modem function in a POTS connection?

c. Describe two techniques for expediting the transmission of large amounts of data over a POTS line.

8. Network Cables

a. What do cabling categories describe?

b. What are the physical characteristics of twisted-pair cables?

c. What are the physical characteristics of coaxial cables?

d. What are the physical characteristics of fiber-optic cables?

e. Compare the cable types in parts b, c, and d with regard to cost and performance.

9. Networks

a. What is a LAN?

b. What is a WAN?

c. What is a thin client?

Page 189: iCarnecie SSD2 Book

d. What is a thick client?

e. What are the implications of thin and thick clients for a server?

10. Packets

a. What is a packet?

b. What is a packet collision?

c. Describe the function of simplex (comment on collision rates).

d. Describe the function of half-duplex (comment on collision rates).

e. Describe the function of full-duplex (comment on collision rates).

11. Topologies

a. Define topology.

b. Describe star topology.

c. Describe bus topology.

d. Describe ring topology.

Appendix A. Running a Visual Basic File

Exercise 4 contains two Visual Basic executable files. Follow the steps listed below to run the Visual Basic file on the machine.

1. Try running application Paging.exe by clicking on Paging.exe. If you see a File Download screen, click on Open.

2. If you could execute Paging.exe, you do not need to install any software on your machine.

3. If you could not execute Paging.exe, download Visual Basic 6.0 Run-Time Files (you may need administrative rights on your computer to do this).

4. After you have downloaded Visual Basic 6.0 Run-Time Files, try running Paging.exe.

For more information on Visual Basic 6.0 Run-Time Files, consult the Microsoft website.

Appendix B. Downloading WinZip Application

Exercise 5 requires the use of WinZip application. Any version of WinZip would be sufficient for the exercise.

If you do not have WinZip software installed on your computer, you can download an evaluation version of WinZip 11.1 from WinZip.com.

1. Download WinZip Evaluation Version from WinZip.com. 2. Follow instructions and click on "Download Evaluation" link on the page.

Page 190: iCarnecie SSD2 Book

Or, you can download 7-Zip. 7-Zip is a free and open source file archiver designed originally for Microsoft Windows, and later made available to other computer operating systems.

1. Download 7-Zip from 7zip.com. 2. Follow instructions and click on "Download" link on the page.

SSD2 Reading Assignments (NOTE: updated for the 10th and 11th editions of the course reference textbook)

All reading assignments and reading sequence for the course are included at the start of each course section and are valid for both 10th and 11th editions of the reference textbook.

Sections

Textbook:

New Perspectives on Computer Concepts 10th Edition—ComprehensiveJune J. Parsons and Dan Oja

ISBN-10: 1-4239-0610-1ISBN-13: 978-1-4239-0610-0Format: Softcover Publisher: Thomson Course Technology, a division of Thomson Learning, Inc Cambridge, MA, COPYRIGHT © 2008

OR

New Perspectives on Computer Concepts 11th Edition—ComprehensiveJune J. Parsons and Dan Oja

ISBN-10: 1-4239-2518-1ISBN-13: 978-1-4239-2518-7Format: Softcover Publisher: Course Technology, Cengage Learning, Boston, MA, COPYRIGHT © 2009, 2008

1.1

Required Readings:

Parsons/Oja, Chapter 1-Section B (pages 14-21)

Optional reading:

Parsons/Oja, New Perspectives Labs: "Operating a Personal Computer" (page 46)

1.2

Optional reading:

Parsons/Oja, Chapter 9-Section A (pages 486-496) Parsons/Oja, Chapter 9-Section B (pages 497-509)

Parsons/Oja, Chapter 9-Section C (pages 510-522)

1.3 Required Readings:

Page 191: iCarnecie SSD2 Book

Parsons/Oja, Chapter 1-Section C (pages 22-28)

2.1

Required Readings:

Parsons/Oja, Chapter 2-Section B (pages 67-75)

Parsons/Oja, Chapter 2-Computers in Context "Military" (pages 108-109)

2.2

Required Reading:

Parsons/Oja, Chapter 2-Section D (pages 88-97)

Parsons/Oja, Chapter 8-Sections A-D (pages 422-463)

2.3Required Readings:

Parsons/Oja, Chapter 2-Section C (pages 76-87)

2.5Required Reading:

Parsons/Oja, Chapter 8-Section B "Image Compression" (pages 439-441)

3.1

Required Readings:

Parsons/Oja Chapter 4-Section A (pages 184-193)

Parsons/Oja, Chapter 3-Section D (page 154)

3.3Required Readings:

Parsons/Oja, Chapter 5-Section D (pages 274-281)

3.4

Required Readings:

Parsons/Oja, Chapter 4-Section D (pages 212-221) Parsons/Oja, Chapter 4-Section C (pages 207-211)

Parsons/Oja, Chapter 4-Lab "Working with Windows Explorer" (page 236)

4.1

Required Reading:

Parsons/Oja, Chapter 3-Section A (pages 120-124) Parsons/Oja, Chapter 3-Section D (pages 152-161)

Parsons/Oja, Chapter 3-Issue "How serious is Software Piracy?" (pages 170-171)

4.2Required Reading:

Parsons/Oja Chapter 3-Sections B and C (pages 125-151)

4.4 Required Readings:

Parsons/Oja, Chapter 11-Section A (pages 610-621) Parsons/Oja, Chapter 11-Section B, subsections "Data

Management Software" and "Database Management

Page 192: iCarnecie SSD2 Book

Systems" (pages 622-626)

Parsons/Oja, Chapter 11-Section D, subsection "Searching for Information" (pages 648-649)

4.5

Required Readings:

Parsons/Oja, Chapter 12-Section A (pages 674-688)

Parsons/Oja, Chapter 12-Section B (pages 689-701)

5.1

Required Reading:

Parsons/Oja, Chapter 7-Section A (pages 360-373) Parsons/Oja, Chapter 7-Section B (pages 374-383)

Parsons/Oja, Chapter 7-Section D (pages 392-399)

Parsons/Oja, Chapter 7-Issue, "Who's Reading Your Email?" (pages 408-409)

Parsons/Oja, Chapter 11-Section B, subsection "XML" (pages 630-632)

Parsons/Oja, Chapter 7-Section C (pages 384-391)

5.2

Required Readings:

Parsons/Oja, Chapter 5-Section A (pages 246-255) Parsons/Oja, Chapter 5-Section B (pages 256-264)

Parsons/Oja, Chapter 5-Section C (pages 265-273)

Parsons/Oja, Chapter 5-Section D (pages 274-281)

5.4

Required Readings:

Parsons/Oja, Chapter 6-Section A (pages 302-311) Parsons/Oja, Chapter 6-Section B (pages 312-321)

Parsons/Oja, Chapter 6-Section C (pages 322-329)

6.1Required Readings:

Parsons/Oja, Chapter 3-Section E (pages 162-169)

6.2Required Readings:

Parsons/Oja, Chapter 5-Section E (pages 282-287)

6.3

Required Readings:

Parsons/Oja, Chapter 4-Section E (pages 222-231)

Parsons/Oja, Chapter 4-Lab "Backing Up Your Computer" (page 236)