This course is closed. The accuracy of this page's content is not guaranteed. [Return to college.yukondude.com]

You really should consider upgrading your browser to a more recent version. You'll still be able to view everything on this site, but it'll be an ugly experience.

CPSC100: Practical Computer Fluency (F'05)
Week 2 Lecture Notes: Computer Fundamentals and Operating Systems

Computer Fundamentals

  • Despite the variety of computer types, models, and technologies, all are made up of four primary components: input devices or connections, a central processing unit or processor, storage devices, and output devices or connections. The following diagram illustrates the relationships between these components.

    Computer Internals

    Data flows in the directions of the arrows. Not all computers are connected to a network as illustrated.
  • If you were to compare this to the typical human, the input would be the 5 senses, the output would mostly be muscle contractions, the storage is a person's memory, and the CPU is the brain. The "program" that runs on the brain CPU might be called your mind, your personality, or even your soul.
  • Input devices provide data from the outside world to the processor: keyboards, mice, joysticks, microphones, digital cameras, scanners, and so forth, including various sensors for embedded computers that measure temperature, speed, throttle position, or whatever.
  • Output devices allow the processor to communicate the results of its work to the outside world: monitors, printers, speakers, LED and LCD displays, and all sorts of different servos and actuators for embedded computers that change valve positions, angle rudders, pump the brakes--the list is endless.
  • Storage devices are used by the processor to temporarily or permanently store data so that it can be retrieved at a later time. "Volatile" storage loses its contents when the computer power is turned off (the human analogy would be your own memories). The most common example of this type of storage is Random Access Memory, or RAM, or just "memory". "Persistent", or "non-volatile", storage does not lose its contents when the power is turned off: hard disks, floppy disks, CD-ROMs, DVDs, and so forth (the human analogy would be books, cave drawings, and oral histories passed from generation to generation).
  • The Central Processing Unit, or just "processor" for short, is the engine or brain of a computer. The processor executes a series of instructions that gather data from the input devices, occasionally store intermediate results using the storage devices, and then produce final results suitable for the output devices.
  • The diagram above also shows a network of some sort (perhaps the Internet, or maybe a cell phone network). The computer's interface with a network involves both input and output devices, although these may be physically incorporated into a single piece of hardware (e.g. a network interface card, or NIC). This is because the computer both sends messages out to a destination computer somewhere on the network, and also listens for messages that arrive as input to the computer.
  • All of the arrows on the diagram are typically realized by cables of some sort, or they may be wireless (radio or infrared) signals, or they may be "wires" built in to the computer's main circuit board (sets of these wires, or "traces", are often called "busses"). There are many, many types of these cables, each with its own type of connector: coaxial, serial, parallel, USB, FireWire, ribbon, twisted-pair, Ethernet, and so on.

The Central Processing Unit

  • The Central Processing Unit (CPU) is the brains of the computer. It's only about the size of a fingernail, but is encased in a large plastic enclosure with many electrical pin connectors sticking out. Recent CPUs also have large heat sinks and sometimes even little fans to keep them cool.
  • CPUs are purely digital devices. This means that they only understand discrete numerical values. In fact, the only numerical values a CPU understands is zero and one: a numbering system called "binary". Ultimately, everything we do with a computer must be translated into those binary values.
  • The instructions that CPUs understand are very simple: fetch a value from memory, perform simple calculations, store a value in memory, and compare two values and jump to another instruction depending upon the outcome. Other than these jumps, the CPU simply executes each instruction in turn, one by one.
  • The CPU is hooked to a crystal clock that ticks very quickly. Each time the clock ticks, the CPU performs one of these very simple operations (often it takes multiple ticks to perform one operation, but never less than one).
  • These ticks are produced at a certain frequency. Apple ][+ era computers (The Mostek 6502 CPU) had a frequency of about 1.5MHz (1.5 million ticks per second). If you look very closely at the internal video display used by the Terminator in the first movie, it appears that Cyberdyne Systems Model 101 is built using a Mostek 6502 CPU.
  • The most recent CPU chips from Intel run at a frequency of over 2GHz (more than 1,000 times that of the first Apples). But frequency alone shouldn't be used as criteria for comparing the speed of CPUs, particularly if the chips are from different product lines or from different manufacturers.
  • In 1964, Gordon Moore (who co-founded Intel in '68) announced that the number of transistors on computer chips appeared to be doubling every 18 months. The trend has continued to this very day. It also loosely translates to a doubling of CPU speed every 18 months.

Computer Software

  • Software is that part of the computer that you cannot kick.
  • You may think of software as the recipe that a CPU must follow in order to perform a task.
  • Computers are very literal: they will only do exactly what you tell them to do--even if you really meant to tell them to do something else (this is what we call a bug).
  • Computers are also deterministic: given the same input, they will always produce the same output. This is a good thing, because otherwise it would be impossible to program computers to do the same thing twice (although quantum theory heralds the day when computers don't behave deterministically).
  • A program is just a list of instructions to the CPU, that when executed, turn into what we think of as software. A program implements an algorithm (a mathematical formula or set of instructions) in the "machine language" of the CPU.

The Boot Process

  • Before any computer can perform useful work, it must first initialize itself using a process known as bootstrapping, or simply the boot process. When power is first applied to a computer, it is in a random state: all of the volatile storage devices are filled with meaningless noise. To move from this chaotic state to an ordered state involves a bit of effort (entropy must be reversed). Most PCs follow a similar set of steps to bootstrap themselves, as outlined in the following points. Compare this to your own experience of first waking in a hotel room while on vacation: you need to do some work to: remember where you are and why, get up, get dressed, shower, and so forth. You can't really perform useful work until all of that has been done.
  • A special chip in the computer holds what is called the BIOS (Basic Input/Output System), essentially just the instructions needed by the PC to get things started. The first thing the BIOS does is execute the POST (Power On Self Test) which checks the video card (so that any errors can be displayed to the user--if the video card doesn't work, then the BIOS beeps a few times to indicate the problem).
  • The BIOS then checks that the other major devices are connected and functional: keyboard, mouse, internal busses (circuit board "wires" connecting critical components).
  • The next step is to verify that the RAM (volatile storage) in the computer works. The BIOS writes to each location in memory and then reads the same data back to make sure that the memory chips are functioning properly. This step can take a few seconds, depending upon how much memory is installed.
  • The BIOS also checks the main storage devices connected to the system, including floppy drive(s), CD-ROM drive(s), and hard drive(s).
  • The BIOS then starts looking for an operating system to load. It usually checks the floppy first, then the CD-ROM, and finally the hard drives. As soon as it finds something promising, it loads the first "chunk" of data from the storage device into memory and tells the processor to execute the instructions found in that chunk. The BIOS's work is now done.
  • The first chunk begins to execute. It should contain just enough instructions to load the next chunk stored on the disk into memory and execute those instructions. There may be many such steps, but the end result is to load the operating system into memory and start it running.
  • The operating system (OS) first initializes itself, and then loads any special device drivers (little programs that allow the OS to communicate with specific types of hardware). On Windows, little dots or a progress bar are displayed while this is going on.
  • Once the drivers are loaded, the OS runs any programs that are supposed to run every time the computer is booted up (e.g. virus scans).
  • The operating system then runs a program that allows a user to log on to the system with a username and password. Some operating systems skip this step entirely if they're not meant to be used by more than one person.
  • The operating system then runs a program called a "shell" and loads any of your user preferences (colours and so forth). This is the program that displays the graphical desktop in Windows or Macintosh (and others), or a text-based prompt in other operating systems. This shell program runs the entire time you use the computer and allows you to interact with other programs (e.g. word processors, web browsers, calculators).

Operating Systems

  • When sold as shrink-wrapped products, we know operating systems by such names as Microsoft Windows, Apple Macintosh, UNIX (and its variants Linux, Solaris, AIX, HP-UX, etc.), OS/2, and even ones you may never have heard of: OS/390, OS/400, Be, CP/M, VMS, TOPS, MVS, ITS, etc.
  • But those products include a whole lot more than just the operating system program: web browsers, disk utilities, graphical user interface shells, file managers, calendars, e-mail programs, and so forth.
  • An operating system (OS) is a program that we never interact with directly. The operating system has two main responsibilities:
    1. Manage hardware and software resources so that programs may use these resources without conflict.
    2. Provide a consistent and hardware-independent programming interface for software development.
  • The first of these responsibilities is most important for operating systems that can run more than one program at a time (almost any OS with which you might be familiar). These programs are completely unaware that other programs are also running. Suppose that two programs that are currently running each wish to display something on the screen, save a file to the hard disk, and play a sound on the speakers. If they both tried those simultaneously, they would likely overwrite each other's efforts: producing a garbled screen display, a corrupted file containing interspersed bits written by both programs, and some random noise from the speakers. The operating system's job in such a scenario is to isolate each program from the hardware devices by playing a "traffic cop" role. The programs are still allowed to use the hardware, but they always do so through the intermediating OS, which prevents the programs from interfering with each other (perhaps by isolating the two programs' display into separate windows, by placing the saved files in two different locations, and by letting only one program at a time use the speakers). The operating system does this by essentially restricting each running program to its own "virtual computer". If a program ever tries to break out of this virtual environment (usually because of a programming defect, or "bug"), the operating system can detect this condition and halt the offending program. You may get an error message (perhaps a General Protection Fault), and you will lose any unsaved data in that application, but the OS should be able to restrict the damage to only that virtual computer; all of the other programs should continue running normally.
  • Because the OS must be an intermediary between programs and the computer hardware, this leads directly to the second responsibility: The OS hides the specifics of any particular piece of hardware, proving only a standard way of accessing hardware of that nature. This means that application programs (word processors, spreadsheets, games, etc.) do not have to be written for specific hardware, only for specific operating systems. In the days of yore, this was not the case, and WordPerfect (the champion word processor of its day) had to include hundreds of printer definition files for every conceivable printer make and model on the market. Today, the operating system loads just one such device driver for a particular printer (or any other device) and all programs simply ask the operating system to print something, none the wiser about the model of printer connected to the computer.
  • How does a single computer run many programs simultaneously? The operating system manages this by letting each program in turn use the processor for a short period of time (microseconds or nanoseconds). The switch is so fast that we don't notice that only one program is really running at any one time.
↑Top