Introduction to Computer Systems

These notes provide a general introduction to computers systems. A computer system is made up of both hardware and software. Software is another term for computer program. Software controls the computer and makes it do useful work. Without software a computer is useless, akin to a car without someone to drive it. Hardware refers to the physical components that make up a computer system. These include the computer's processor, memory, monitor, keyboard, mouse, disk drive, printer and so on. In these notes we take a brief look at the functions of the different hardware components. In addition we describe the some of the essential software required for the operation of a computer system.

1 Hardware

The hardware of a computer system is made up of a number of electronic devices connected together. Figures 1 and 1A are block diagrams of a typical computer system.

 

Figure 1: Typical computer system

Figure 1A: Typical computer system: Processor and RAM

A computer has two major internal components that are of particular interest to us, namely its processor and its memory. There will also be a power supply unit (not shown) to provide power for the system. The term device is used to describe any piece of hardware that we connect to a computer such as a keyboard, monitor, disk drive, printer and so on. Such devices are also sometimes described as peripheral devices or simply peripherals. They may be classified as input/output (I/O) devices and storage devices. As the name suggests, I/O devices are responsible for communicating with the computer, providing input for the computer to process and arranging to display output for computer users. The keyboard and mouse are commonly used input devices. The monitor is the commonest output device, followed by the printer for hardcopy (permanent) output. Storage devices are used to store information in a computer system. The memory is used to store information inside the computer while the computer is switched on. Disk storage is the commonest form of external storage, followed by the tape storage. External storage devices can store information indefinitely or more realistically, for some number of years. A very important component of a computer system is the system bus which is used to transfer information between all system components.

It is crucial to understand that all information is represented inside a computer system in binary form i.e. using the binary numbers 1 and 0. The hardware of a computer system has no other way of representing information. Thus when you press a key on a computer's keyboard, a binary number (code) which represents that key is transmitted to the computer and not the symbol , for example, 'A', displayed on the key. Similarly, when a computer transmits a character to be displayed on the monitor, it is the binary code representing that character that is sent to the monitor. The monitor hardware takes this binary code and displays the corresponding symbol on the screen. To reiterate, all information is transmitted and manipulated inside a computer system in the form of binary numbers.

A binary digit (1 or 0) is called a bit and a group of 8 bits is called a byte. When describing storage capacity, the byte and multiples of bytes are the units used. A kilobyte (Kb) is 210 (1024) bytes, a megabyte (Mb) is 220 bytes (1024Kb), a gigabyte (Gb) is 230 bytes (1024Mb) and a terabyte (Tb) is 240 bytes (1024Gb). When describing transmission speeds, the number of bits per second is the unit used.

1.1 The Processor

The processor as its name suggests is the unit that does the work of the computer system i.e. it executes computer programs. Software is composed of instructions, which are executed (obeyed) by the processor. These instructions tell the processor when and what to read from a keyboard; what to display on a screen; what to store and retrieve from a disk drive and so on. A computer program is a set of such instructions, that carries out a meaningful task. It is worth remembering at this stage that the processor can only perform a limited range of operations. It can do arithmetic, compare numbers and perform input/output (read information and display or store it). It has no magical powers. It is instructive to bear in mind that all computer programs are constructed from sequences of instructions based on such primitive operations.

The processor itself is made up of a number of components such as the arithmetic logic unit (ALU) and the control unit (CU). The ALU carries out arithmetic operations (e.g. addition and subtraction) and logical operations (e.g. and, or xor) while the CU controls the execution of instructions. Traditionally, the processor is referred to as the central processing unit or CPU. With the advent of microprocessors, the term MPU or microprocessor unit is also used. A microprocessor is simply a processor contained on a single silicon chip.

In addition to the ALU and CU, the processor has a small number (usually less than 100) of storage locations to store information that is currently being processed. These locations are called registers and depending on the processor, a register may typically store 8, 16, 32 or 64 bits. The register size of a particular processor allows us to classify the processor. Processors with a register size of n-bits are called n-bit processors, so that processors with 8-bit registers are called 8-bit processors, similarly there are 16-bit, 32-bit and 64-bit processors. An n-bit processor is said to have an n-bit word size so a 32-bit processor has a 32-bit word size. The greater the number of bits the more powerful the processor is, since it will be able to process a larger unit of information in a single operation. For example, a 32-bit processor will be able to add two 32-bit numbers in a single operation whereas an 8-bit processor will only be able to add two 8-bit numbers in a single operation. An n-bit processor will usually be capable of transferring n-bits to or from memory in a single operation. This number of bits is also referred to as the memory word size. So, while a byte refers to an 8-bit quantity, a word can mean 8, 16, 32, 64 or some other number of bits. On some machines a word is taken to mean a 16-bit quantity and the term long word is used to refer to a 32-bit quantity.

An alternative method of classifying a processor is to use the width of the data bus (described later), in which case an n-bit processor describes one operating with a data bus of n-bits. This means that the CPU can transfer n-bits to another device in a single operation. Using this classification, the Intel 8088 microprocessor is an 8-bit processor since it uses an 8-bit data bus, although its CPU registers are in fact 16-bit registers. Similarly the Motorola 68000 is classified as a 16-bit processor, even though its CPU registers are 32-bit registers. Sometimes a combination of the two classifications is used where the 8088 might be described as 8/16-bit processor and the Motorola 68000 as a 16/32-bit processor. In these notes we use the register size as the method for classifying the processor.

The data bus width is very important in a computer system, since it determines the amount of information that can be transferred to or from the CPU, in a single operation. This means, for example, that the Motorola 68000 would have to transfer two 16-bit items to the CPU to fill a 32-bit register, since the data bus width is 16-bits. As we shall see later, I/O devices and memory operate at very slow speeds compared to the speed of the CPU. As a result, the CPU is frequently delayed by these slower devices, waiting for information to be transferred along the data bus. So, the more information we can transfer in a single operation, between an I/O devices and the CPU, the less time the CPU will spend waiting for information to process. This in turns means that we should strive to have the data bus as wide as possible.

An important component not shown in Figure 1.1 is the CPU clock. The clock controls the rate at which activities are carried out by the CPU. It generate a stream of cycles or ticks and an action can only be carried out on the occurrence of a clock tick. Obviously, the more cycles per second, the more actions that the CPU can carry out. The speed of the clock is measured in millions of cycles per second. One cycle per second is one Hertz (Hz), a kilohertz (KHz) is 1000Hz and a megahertz (MHz) is 1000 KHz. Currently, PCs are being marketed with clock rates range from 400MHz to 500Mhz and the rate continues to increase.

 

 

1.2 Bus System

The processor must be able to communicate with all devices. They are connected together by a communications channel called a bus. A bus is composed of a set of communication lines. A simple bus configuration is shown Figure 1.2. We refer to this bus as the system bus as it connects the various components in a computer system. Internally, the CPU has a CPU bus for transferring information between its components (e.g. the control unit, the ALU and the registers).

Figure 1.2: The system bus: the processor communicates with all devices via the system bus

Information is transferred from one device to another on the bus. For example, information keyed in at the keyboard is passed along the bus to the processor. The processor executes programs made up of instructions, which are stored in the computers memory. These instructions are transferred to the processor using the bus. As indicated in Figure 1.2, the lines of the bus may be classified into 3 groups. One group of lines, the data lines, is used to carry the actual data along the bus from one device to another. A second group of lines, the address lines, allow the CPU to specify where the data is going to or coming from i.e. which memory location is to be accessed or which I/O device is to be used. The third group of lines, the control lines, carry control signals that allow the CPU control the transfer of information along the bus. For example, the CPU must be able to indicate whether information is to be transferred from memory or to memory; it must be able to signal when to start the transfer and so on. We will refer to these groups of lines as separate buses in these notes, so we refer to the data bus, address bus and control bus as separate entities. It is important to realise that a computer system may have a number of separate bus systems so that information can be transferred between more than one pair of components at the same time. For example, it is common to have one bus for communicating between memory and the CPU at high speeds. This bus is called a CPU-memory bus. In addition, this bus would be connected to a second I/O bus via a bus adapter, as illustrated in Figure 1.3. This second bus would be used for the slower I/O devices.

Figure 1.3: CPU-memory bus and I/O bus

This allows the processor more efficient access to memory, as the CPU-memory bus can operate at very high speeds. These high speeds are only possible, if the physical bus length is quite short. Thus, by providing a second I/O bus to accommodate the various I/O devices that may be connected to the computer, the length of the CPU-memory bus can be kept shorter than it would be if the I/O devices were to be directly attached to a single system bus. On the other hand, to keep the cost of a computer system low, a single bus running at a slower speed, may be used to connect all devices to the CPU.

In order to attach any device to a computer, it must be connected to the computer’s bus system. This means that we need a unit that connects the device to the bus. The terms device controller and device interface are used to refer to such a unit. So, for example, a disk controller would be used to connect a disk drive to the system bus and the term I/O controller refers to the controller for any I/O device to be connected to the bus system. A computer system will have some standard interfaces such as a serial interface, which can be used with a number of different I/O devices. The serial interface, for example, can be used to attach a printer, a mouse or a modem ( device for communications over a telephone line) to the computer. So, if you wish to construct a new type of I/O device, you could use the standard laid down for the serial interface (the RS-232 standard) and you could then attach your device to the computer, using the serial interface.

 

 

1.3 Memory

Memory is used to store the information (programs and data) that the computer is currently using. It is sometimes called main or primary memory. One form of memory is called RAM which stands for random access memory. This means that any location in memory may be accessed in the same amount of time as any other location. Memory access means one of two things, either the CPU is reading from a memory location or the CPU is writing to a memory location. When the CPU reads from a memory location, the contents of the memory location are copied to a CPU register. When the CPU writes to a memory location, the CPU copies the contents of a CPU register to the memory location, overwriting the previous contents of the location. The CPU cannot carry out any other operations on memory locations.

RAM is a form of short term or volatile memory. Information stored in short term storage is lost when the computer is switched off (or when power fails e.g. if you pull out the power lead!). There is therefore a requirement for permanent or long term storage which is also referred to as secondary storage. This role is fulfilled by disk and tape storage. RAM consists of a large number of cells, each one capable of storing a small amount of information typically a single byte. These cells are numbered or addressed starting at zero, up to some maximum number determined by the amount of RAM present, as illustrated in Figure 1.4. Currently (1999), PCs typically have 64 Mb to 128Mb of RAM installed, but the figure is constantly being revised upwards.

Figure 1.4 Memory Organisation

The address of a memory cell is used when we wish to access that particular memory location. This means that we must know the address of a cell in memory before we can access its contents. A byte is a small unit of storage, capable of storing unsigned numbers in the range 0 to 255. In order to allow you store larger quantities in memory, the hardware allows you treat a number of consecutive cells as a unit. For example, by using two consecutive cells, 16-bits are available for storing information giving an unsigned number range from 0 to 216-1 (65,535). By using 4 consecutive cells, 32 bits are available, allowing numbers in excess of 1 billion to be manipulated. What about text, such as that on this page? In the case of text, each character is stored separately in a single byte. So if there are 2000 characters on a page, then 2000 consecutive bytes could be used to store the text.

There are two major forms of RAM called static RAM (SRAM) and dynamic RAM (DRAM). SRAM is the more expensive of the two as it is more complex to manufacture but it is considerably faster to access than DRAM. DRAM has an access time in the range of 60-100 nanoseconds upwards, while SRAM access times range from 4 or 5 nanoseconds to 20 nanoseconds upwards. It is not uncommon for a computer system to have a small amount of SRAM and a larger volume of DRAM making up its total RAM capacity. The SRAM is used to construct a cache memory which stores frequently accessed information and so speed up memory access for the system.

There are other forms of primary memory such as ROM, PROM, EPROM EEPROM and flash memory. ROM (Read Only Memory) is the same as RAM in so far as any location can be read from at random, but it cannot be written to. ROM is pre-programmed by the manufacturer and its contents cannot be changed, hence its name read only. This means that ROM is a form of permanent storage. However, since the user cannot store information in ROM, its usefulness is restricted. ROM is typically used to store programs and data that are required to start up a computer system. When a computer is powered on, its RAM will contain no useful information, but the processor is designed to run programs that it finds in memory. One major use of ROM is to store the initial program used by the processor when the machine is started. This use is described in the section on booting up a computer in the second half of these notes. Another use of ROM in personal computers, is to store operating systems subprograms for carrying out I/O and other activities. The term firmware is used for the combination of ROM and the software stored on it.

PROM stands for programmable ROM which means that the memory chip manufacturer provides a form of ROM that can be programmed via the use of a special hardware device. This allows computer system designers place their own programs on the PROM chip. If their programs do not operate correctly, the designer can program another PROM chip, as opposed to getting the memory manufacturer to do it, as is the case when a designer uses ROM. EPROM is a form of ROM that is erasable which means that the contents of the EPROM chip can be erased in their entirety and the chip can be reprogrammed (a limited number of times). As in the case of PROM, EPROM can only be programmed and erased (via exposure to ultra violet light) by a special hardware device, outside the computer system.

EEPROM is electrically erasable PROM. EEPROM can be erased inside a computer system using an electrical current. Its major advantage is that it does not have to be removed from the computer system. In recent years work has advanced on such non-volatile RAM (NVRAM) devices. Flash memory is one such device. This memory can be accessed like RAM (read and written), but is non-volatile i.e. it is a form of permanent storage. At the time of writing flash memory is available in the 1 to 16Mb range. One disadvantage of current NVRAMs is that they cannot be written to, as quickly as ordinary RAM. However, they are much faster to access than disk storage systems and they consume less power, so that in small portable computer systems they offer an alternative low-powered option to disk storage. However, NVRAMs are more expensive than disk storage devices.

NVRAM should not be confused with a device called a RAM card which is made up of normal RAM with a battery power supply. A RAM card can be removed from a computer and is about half the size of a floppy disk. At the moment they are available in the kilobyte to megabyte storage range. Because of the battery power supply, RAM cards retain their contents when removed from a computer.

1.4 Permanent Storage Devices

Long term storage is also described using the terms secondary, auxiliary, mass, and external. The two commonest forms of secondary storage are disk and tape storage.

Disk Storage

Disk storage is the most popular form of secondary storage. It is more versatile than tape storage. It is faster to access, as information on any part of the disk can be accessed (direct access) quickly, independently of its position on the disk. Its disadvantage is that it is more expensive than tape storage.

The surface of a disk is divided into tracks and each track is divided into sectors (blocks). There may be from 40 to hundreds of tracks on a disk surface. Each sector of a track will typically have a capacity from 32 to 1024 (1Kb) bytes. Information is stored on or read from a disk magnetically, using a read/write head. To access information on a disk, the head must be moved to the correct track (the time taken to do this is called the seek time); the correct sector must rotate around to the head (the time taken to do this is called the rotational delay or latency) and finally the information may be transferred (transfer time). On a typical hard disk, the average seek time is around 20 ms (milliseconds). Based on a disk rotation speed of 3600, the average rotational delay is the time for half of one rotation, about 8 ms. The transfer time is so small, compared to the seek time and latency, that it can be ignored. Rotation speed now range from 3000 to 9000 revolutions per sec.

Note: It is approximately 100,000 times slower to access information on disk than to access information in RAM. This is because of the electromechanical nature of the disk drive, involving disk rotation and read/write head movement. While the speeds used in disk drives are quite fast in human terms, in CPU terms, they are extremely slow. For example, the CPU can access information stored in RAM in of the order of 20 to 100 nanoseconds. The CPU can access information in its registers in a few nanoseconds. So from the CPU's perspective, if information has to be fetched from disk which takes of the order of 28 milliseconds, then a long wait ensues. As a result of the mismatch in speed between the CPU and disks, much work is concerned with making disk I/O as efficient as possible. For example, you can arrange to do disk I/O, so that when you read something from disk, you read a big chunk (at least one sector). Then when you need another piece of information, it may have been read into memory already, as part of the large chunk. You can also arrange information on disk, so that it is stored on the same track or neighbouring tracks which means that the seek time can be significantly reduced.

The physical size of disk drives has decreased dramatically over the years. Only a few years ago, a disk drive of 100Mb capacity would have been larger than a domestic washing machine. Nowadays such a disk drive fits easily inside a laptop or notebook computer. The cost of disk storage has fallen in a similar manner. The shrinking size and low cost of disk drives has led to the use of systems with several disk drives or arrays of disk drives. In addition, to increase availability of data, redundant arrays of independent disks (RAID) systems have been developed. Current disk sizes for PCs range from 4 to 16Gb, and the amount is constantly increasing.

In a RAID system, information is distributed over a number of disk drives in such a fashion that if one of the disk drives is removed from the system (due to failure), the information can still be accessed. A simple version of a RAID system is called mirroring, whereby two disks, whose contents are mirror images of each other, are maintained. Whenever, information is stored (updated) on one disk, it is automatically stored (updated) on the its mirror disk. In the event of one of the disk failing, then the second disk can be used to access the information. In this case we have 100% redundancy i.e. a complete copy of all information is stored on the second drive. This increases the availability of data in the system at the expense of a second disk drive. Using clever software however, similar availability can be achieved in a system without the overhead of 100% redundancy. For example, a RAID system might be composed of 9 disk drives where 8 of the disk drives are used to store information and 1 is used to store redundant information. This redundant information can be used to reconstruct data from any of the drives, in the event of a drive failing. In this case, we have only a little more than 11% redundancy, but the system can operate successfully (all be it more slowly) without information loss, if a disk drive becomes faulty.

In brief, the decreasing cost and size of disk drives is leading to computer systems having very large storage capacities with very high data availability.

Tape Storage

Tape storage is cheap with a large capacity e.g. 50Mb upwards for a typical tape. Video tapes can store 2Gb to 8Gb (billion bytes). The disadvantage of tape as a storage medium, is that tape is a sequential storage medium. This means that to access the nth item of information, you have to skip over the first n-1 items; in the same fashion as fast forwarding to play music from the middle of an audio tape cassette. This makes tape very slow to access in comparison with disks. Typically, tape storage is used to keep a backup of the information stored on a disk. Thus, in the event of a loss of information from disk, you can retrieve it from your tape backup. Tape is also used to transfer information (data and software) between computers. Tape is especially popular in large computer installations where large amounts of data have to be kept for years. On personal computers it is more common to use disks as a form of backup storage and as a means of transferring information between computers.

[Aside: Important Principle: Always have a Backup

A backup is a second copy of information stored on disk or tape. This crucial principle is basic common sense. Much time is spent entering data and programs (days, weeks, even years). But it must be remembered that computer storage media can be easily damaged, lost or stolen. In addition users may inadvertently delete information. All computer users lose information at some stage. The seriousness of this is greatly reduced or even eliminated if regular backups are taken. In the event of information loss, you simply use the backup copy. If the information is particularly valuable (in terms of time spent to enter it or economically) then it may be a wise precaution to have several backups. Backup copies should be stored separately from the main copy to avoid a disaster destroying all copies at the same time.]

There are a number of different types of tape available: reel tapes, cartridge tapes, digital audio tapes (DAT) and optical tapes. The capacity ranges from tens of megabytes for reel tapes, from hundreds of megabytes for cartridge tapes, from several gigabytes for DAT tapes and from a terabyte for optical tapes. The huge capacity of optical tapes is useful for organisations storing huge amounts of data such as weather forecasting services.

CD-ROM (Compact Disk Read-Only Memory) is another form of secondary storage, that is increasing in popularity. It is a low-cost storage medium with a very large capacity. Unlike disk storage, CD-ROM is a WORM (Write Once Read Many times) device i.e. it is a read only storage device. This means that like ROM, the disk comes with information already stored on it. Thus one of the main uses of CD-ROM is to disseminate information such as library catalogues, reports, manuals, journals, directories and software. It has also become a very popular medium for computer games. Many software vendors and computer manufacturers such as Sun and Apple distribute their software and manuals on CD-ROM. Many publishers now use CD-ROM especially for educational material and it is possible to buy encyclopaedia and history texts in CD-ROM form. The CD-ROM has sufficient capacity not only to store the written text, but also video and audio material which require large amounts of storage, for example, a digital version of a passport size photograph requires up to a megabyte of storage.

CD-ROM uses the same technology as the compact audio disk or CD and such disks can also be used in a CD-ROM drive. Optical scanning techniques, using lasers, are employed with CD-ROMs, which allow massive amounts of data to be stored in a compact area. A CD-ROM drive is about the same size as a floppy disk drive. CD-ROM is currently more reliable and durable than magnetic media (disks and tapes). In terms of capacity, a single CD-ROM may store up to 600 megabytes. In terms of text this is equivalent to about 200 books of 1000 pages each.

A disadvantage of CD-ROM is that it takes longer to access information compared to a hard disk. However, clever software tailored for particular applications often means that this is not a serious problem. Video Disks are similar to CD-ROM (but have a larger capacity) and are used for similar applications.

Rewritable CD storage (CD-R) is now becoming more widely used. This storage combines the reliability and storage capacity of CD-ROM with the flexibility of magnetic disks in that users can store their own information on them. They are still slower to access than conventional hard disks. Magneto-optical (MO) disks combine the use of magnetic and optical principles to store information. MO disks have a smaller capacity than CD-ROMs (e.g. a 3.5 inch MO disk stores 128Mb) and are quite expensive in comparison to conventional hard disks.

CD-ROMs are now being replaced by DVD-ROMs (Digital Versatile Disks). DVD-ROM capacity ranges from 4.7 Gb upwards (4.7x 2 or 4.7 x 4 Gb). These are also used for distributing films as a rival to video tapes. A current PC will typically have a DVD drive which is also capable of reading conventional CDs. DVD-RAMs are also available which allow users to store files.

Taking short term and long term storage together we can represent the relative capacity and access times in the form of a storage hierarchy as illustrated in Figure 1.5:

Figure 1.5: Storage hierarchy of a computer system

At the top of the hierarchy we have storage on the CPU chip (i.e. registers). This is the fastest form of storage in terms of the CPU accessing it. It also has the smallest capacity. Register capacity ranges from hundreds of bytes to a few kilobytes. We then have cache memory with a capacity of typically less than 1Mb. Nowadays we also have CPU cache memory i.e. cache memory on the CPU chip itself. This is in the low kilobyte range e.g. 8Kb to 64Kb at the moment. Cache memory has an access time of typically less than 20ns. The next level is that of main memory (RAM) with a capacity in the megabyte range and access times of 60-100ns. Disk storage is in the gigabyte capacity range with typical access times of microseconds. Tape storage provides from gigabyte to terabyte storage capacity with access times as slow as seconds for reel tapes (old technology). It should be noted that the access time, for the newer optical tapes, is much better.

 

 

 

 

1.5 I/O Devices

In this section we survey some of the commonly used I/O devices encountered in computer systems.

Input Devices

The keyboard and mouse are the most widely used input devices at the moment. The QWERTY keyboard, so called because the keys 'q','w','e','r','t' and 'y' are adjacent, is the commonest form of keyboard. But other types of keyboard are available, some being specially designed for people with special needs. It should be noted that the layout of keys on the QWERTY keyboard owes its origins to typewriter designers who were actually trying to slow down the speed at which a typist could type. The reason was that the old lever-based typewriters were liable to levers getting interlocked if two keys were pressed in rapid succession. Typewriter designers laid out the keys in a fashion that made it difficult to type quickly, the QWERTY layout being the product of this design. Because so many people trained on such keyboards, the layout still remains with us today, many years after the engineering problem which it was designed to alleviate, disappeared. It is worth noting that in some non-English speaking countries the layout is slightly different giving rise to QWERTZ and AZERTY keyboard layouts.

The mouse is used as a pointing device and to select options from menus. A tracker ball is used for the same purposes as a mouse and is popular on laptop computers. Another input device is called a light pen which can be used to point at a monitor, serving a similar function to a mouse. A touch sensitive screen is a method of input based on touching a specially designed screen in particular places. It is typically used in an application such as a tourist information system, where information can be obtained by touching menu options displayed on the screen.

A very common requirement for business is the processing of payments. Take an insurance company, for example, here, very many customers return payment for their insurance with some form of printed statement from the company. In order to automate processing such payments, a form of input called optical character recognition (OCR) was developed. An OCR device can scan a document and recognise characters. Originally, text had to be printed in a special OCR font for OCR to operate but nowadays OCR can handle almost any font. The advantage of OCR for companies is that when statements are returned with payments, they can be scanned in and the customer accounts automatically credited. A less sophisticated but similar device is an optical mark reader which can scan a specially designed form and recognise the presence of marks in particular positions. One use for such a device is in lottery games machines where a user marks numbers on a pre-printed form which is then read by an OCR reader connected to a lottery computer.

Magnetic ink character recognition (MICR) is similar to OCR but this time the characters are not scanned optically. Instead they are scanned magnetically as they have been printed with magnetised ink, each character having a very distinct shape. This is used on cheques by banks, to encode bank account numbers.

Barcode scanners are very popular input devices in supermarkets and stores. These devices scan barcodes which identify products. This is a form of OCR. The barcode is translated to a number which can be used by the computer to identify the product and look up its price in a database. In addition the software can keep track of stock levels by recording the number of sales of each item.

Image scanners are devices which scan an image (document, photograph) and produce a digital version of the image i.e. the image is stored as a sequence of binary numbers. Special software can then display the digital version of the image on a monitor. They effectively "photocopy" the image into the computer. This type of technology is very useful for storing legal documents, application forms and anywhere there is a requirement to access the contents of an original document very quickly. The term document image processing (DIP) is used to describe the application of this technique and it is becoming an important application in insurance and banking organisations.

[Aside: It should be noted that digital images require large amounts of storage. To alleviate this problem, various data compression techniques may be used. Data compression software can reduce storage requirements dramatically, with savings ranging from 10% to 90% depending of the type of data being compressed. Some PCs use this type of software to effectively double their hard disk storage capacity i.e. all data stored on the hard disk is compressed, so that an 80Mb disk appears as if it has 160Mb capacity. Data compression is also used by software vendors who typically compress their software when distributing it on floppy disks, since it reduces the number of floppy disks required. Data compression is also very important in data communications, since by compressing data, it can be transmitted in less time. This is important because users are charged for either transmission time or for the amount of data transmitted, or both. Compression techniques reduce both costs. Fax machines have hardware to compress the images being transmitted and due to the nature of most faxes (lots of blank lines i.e. white space) reductions of up to 90% can be achieved i.e. an image requiring 1Mb can be compressed to 100Kb for transmission. The receiving fax machine automatically decompresses the image as it receives it.]

A whole range of cards are available such as ATM and credit cards which encode information magnetically. These cards can be read by card readers and allow you carry out various transactions such as paying for goods or obtaining cash.

Voice Input is perhaps the most exciting form of computer input. While some devices and applications are available, a good deal of work remains to be done before we will easily be able to use computer software without the need for a keyboard and mouse.

Output Devices

Monitors are the commonest output device for a computer system. They range from the lowly dumb terminal screen to the high quality bit-mapped colour screen of workstations. A basic monitor displays up to 24 lines of 80 columns of standard characters. Advanced monitors range from monochrome to full colour and are bit-mapped which means that each point (usually called pixel which stands for picture element) on the screen corresponds to at least one bit in memory. By modifying the bits in memory, the image on the screen is modified. A colour screen may have up to 24-bits in memory corresponding to each pixel, since the colour of the pixel must be recorded. Such monitors vary in size and in the number of colours they support.

Printers are the commonest hardcopy output device. They range from cheap low quality dot-matrix to high speed, high quality laser printers with a variety of intermediate quality devices available.

[Aside: A word of caution is appropriate regarding the management and use of printers. Paper inevitably jams in printers at some stage, no matter whether its an expensive laser printer or a cheap dot-matrix one. There are very few more irate users, than one who has spent a few hours preparing a document, only to find that they cannot get it printed! So, if you have anything to do with managing or installing a computer system, be warned, make sure your users know the basics of clearing paper jams or face the consequences!]

Connecting a Printer to a Computer

Computers are connected to printers by cables using plugs and sockets as illustrated in Figure 1.6. The sockets are usually called interfaces or ports. Since we use these ports to send information, into or out of, a computer, they are also be called input/output ports or I/O ports. The cable used to connect the printer to the computer is often called a line. There are two types of cable which may be used. One is called a serial cable and the other a parallel cable. The parallel cable is made up of many lines running in parallel, hence its name. A different interface (socket) is required for each. So you have a serial interface for a serial line and a parallel interface for a parallel line. Most computers and printers have both types of interface, allowing you use which ever one you please. The serial line and interface is made up according to an international standard referred to as the RS232 standard. Hence a serial line and the interface for a serial line (i.e. a serial interface) are often referred to as an RS232 line and an RS232 interface.

Figure 1.6: Connecting a computer to a printer

 

You also use a serial interface if you wish to communicate with other computers over a telephone line. A device called a modem is used for such communication. It connects your computer to the telephone line via the serial port. In fact a whole variety of I/O devices may be connected a computer using a serial interface. For example, on multi-user computers which use computer terminals , each terminal (keyboard and screen) is connected to the computer via a serial line.

Plotters are output devices used for graphical output such as architectural and engineering drawings produced by CAD (Computer Aided Design) packages. They can handle a range of paper sizes and operate at various speeds.

 

Embedded Computer Systems

To date we have been describing a conventional computer system as might be used in an office or at home. However, strange as it may seem at first, the vast majority of computer processors are not used in such computer systems. One of the world's largest customers for processors is General Motors, the U.S. automobile manufacturer where they are installed inside cars. In the home, appliances such as microwave ovens, washing machines, sound systems, alarms and so on are usually controlled by a microprocessor. The computer system used in such applications is called an embedded computer system, as it is a component of another system.

Embedded processors are much the same (and sometimes are the same) as those used in a conventional computer system. For example, Patriot missiles are guided by a Digital VAX processor (a pretty suicidal task for a processor!). For many embedded systems, only very simple microprocessors are required and in many cases primitive 4-bit processors are still used, while 8-bit microprocessors are very commonly used.

The obvious difference between an embedded computer system and a conventional one is in the type of I/O device used. Embedded systems take their input from a range of devices such as switches and sensors including temperature, pressure, light, humidity, sound, vibration sensors and so on. The output of such systems typically goes to switches which can activate lights and other devices .

These I/O devices are usually electrical devices and use analog electrical signals. A computer on the other hand uses digital (binary) signals. The conventional I/O devices described earlier all use digital signals so they can be directly connected to an appropriate device controller. Sensors and switches must be connected to a analog-to-digital (A/D) converter for input to the computer system and to a digital-to-analog (D/A) converter for output from a computer system.

Smart Cards

A smart card resembles an ATM card but actually contains a microprocessor on the card itself. A common example is that of a phone card. The card will also have memory which in the case of a phone card records the number of units left on the card. Smart cards are being used in various applications such as for security purposes where the card can encrypt confidential information. Another application is that of an "electronic purse" where the card can be topped up with money from an ATM-like machine and then use for shop purchases with "money" transferred from the card to the shop where the purchase is made.

1.6 Classifying Computers

A few years ago computers were easily classified as being one of mainframe, minicomputer or microcomputer. Mainframe computers were physically large and powerful systems capable of supporting hundreds of users. They had relatively large amount of RAM (e.g. 1-2 Mb) and disk storage (e.g. 100 to 400 Mb). Minicomputers were smaller less powerful machines than mainframes, but were still multi-user machines. Microcomputers were small humble machines with 8-bit or 16-bit processors, 16Kb to 256Kb of RAM and 5 to 10 Mb of disk storage, used mainly for games and basic word processing.

Developments in microprocessor technology however means that today's desktop microcomputer will easily have more RAM and disk storage than the above mentioned mainframe, as well as having a more powerful CPU. Minicomputers today are really no more than very powerful microcomputers. The differences between such a machine and a desktop model may more likely be in the software that is being used as opposed to the hardware, for example, a multi-user operating system such as Unix, would typically be used, as opposed to the Windows systems of PCs. Mainframe computers are still powerful machines (physically much smaller than their ancestors) with hundreds of megabytes of RAM and terabytes of disk storage. They have very powerful CPU's that allow them cope with large numbers of users.

Supercomputer is the term used for the most powerful computer available at any time. These are typically tailored for very fast processing of what are known as number crunching applications. Such applications require a tremendous number of arithmetic calculations to be carried out. Weather forecasting is the classic example of such an application, where equations taking account of huge numbers of observations have to be solved. Other applications are to be found in astro-physics and some branches of chemical analysis and modelling. Supercomputers at the moment can carry out trillions of operations per second! The Cray is perhaps the most well known supercomputer, named after its designer, Seymour Cray.

1.7 Computer Networks

The trend at the time of writing these notes is for organisations to install distributed computer systems in a move away from large mainframe systems (referred to as downsizing). In a distributed system, computers are connected together to form networks. Networks often provide services (e.g. e-mail, printing, database access) on one machine for all users of the network. The machine providing the service is called a server. The machines (users) using the service are called clients. A typical organisation might provide each user with their own desktop machine, connected on a network, to a central file server machine. The file server is simply a microcomputer with high capacity disk drives, dedicated to the task of storing user files and applications software. A user can load software from the file server and run it on her own machine. In addition, they can have shared access to data stored on the file server. Because the machines are networked, it is easy to provide electronic mail (e-mail) applications to allow users communicate with each other. One of the problems with a distributed system is that of management. With a centralised mainframe-based system, it is easier for the system manager to keep track of software and data, as well as users! With a distributed system, users may store software and data on their local hard disks (even if they are advised not to do so!). This can cause problems in keeping data consistent (i.e. everybody should have access to the same data) and problems due to different versions of a software package being used.

A computer network which is local to a building or campus is called a local area network or LAN. The advantages of such a system include decreased cost (it is cheaper to install a network of PCs than a powerful mainframe) and increased reliability since users are not dependent on a single mainframe computer. LANs are to be found used in offices, schools, colleges, hospitals and most large organisations. They are suitable for networking within a building complex or campus area. They do not provide for new applications that could not be carried out on a single mainframe with terminals, but they have significant cost and reliability advantages.

Wide area computer networks (WANs) are interconnected computer systems where the distance between the machines making up the network is anything from a few Kms to the other side of the globe. Many WANs are based on phone lines for their connections. WANs are widely used in banking and the airline industry. The financial markets are also heavily dependent on WANs. They provide for remote database access (accessing a database in a computer system that may be hundreds or thousands of miles away) which is the basis for airline reservations and home banking applications. They also provide global e-mail for users.

The connection of two networks is called internetworking. The term internetwork or internet is used to describe the composite network. This may involve the connection of: a LAN to a WAN; or a LAN to another LAN; or of WAN to another WAN. The term Internet is now often employed to refer to a specific global network of computers that is widely used by people all over the world to communicate with each other. The internet has more than 2 million computers connected to it at the moment and the number of users is growing at a phenomenal rate. Organisations are connecting their LANs or WANs to the internet and individual users can also access the Internet from home, using a modem. The term information superhighway is being applied to this network and its planned high capacity successor. The information superhighway will allow users employ the network for all of their communication requirements e.g. e-mail, voice mail, fax, tele-conferencing, television and radio programs and so on. It will be based on optical fibre links which are capable of transferring vast amounts of information very quickly.

 

 

Units of Measurement in Computing

Table 1 summarises the units of measurement we encounter in describing the world of computers. The processing speed of a computer is enormous compared with the speed at which humans operate. When dealing with units of time, the familiar units of seconds, minutes, hours an so on, are much too large for describing the time it takes a computer to carry out some of its basic actions. We use sub multiples of a second such as a millisecond (1/1000 or 10-3), microsecond (1/1000,000 or 10-6), nanosecond (1/1000 million or 10-9) and picosecond (1 /million millions, or 10-12) when measuring the time it takes the processor to carry out its tasks.

Computers are also capable of storing huge amounts of information. The fundamental unit of storage is the byte (also called character). Since this is a small amount of information, we group bytes into larger units so that we can easily refer to thousands, millions or billions of them. When counting bytes we deal in powers of 2 such as 210 which is called a kilobyte (Kb), 220 called a megabyte (Mb), 230 called a gigabyte (Gb) and 240 called terabyte (Tb).

A crucial component of a computer system is a clock, the frequency of which, is important in determining a computer’s processing speed. Frequency is measured in units call Hertz (Hz) where 1 Hz equals one cycle per second and one million Hertz is one megaHertz (MHz). This unit is very small when we consider that modern computers operate with clock frequencies of up to 100 megaHertz. A basic PC now operates from typically 25 megaHertz upwards.

 

 

 

 

Unit

210

220

230

240

Storage

byte

kilobyte (Kb)

megabyte (Mb)

gigabyte (Gb)

terabyte (Tb)

 

 

 

 

 

 

Transmission Speed

bits per sec

kilo Kbps

mega: Mbps

giga: Gbps

tera: Tbps

 

 

 

 

 

 

 

Unit

10-3

10-6

10-9

10-12

Time

second

millisec (ms)

microsec (µs)

nanosec (ns)

picosec (ps)

 

 

 

 

 

 

 

Unit

103

106

109

1012

Frequency

Hertz (Hz)

kiloHz (KHz)

megaHz (MHz)

gigaHz (GHz)

teraHz (THz)

 

 

 

 

 

 

Table 1: Units of Measurement in Computing

 

 

2. Software

Software is another term for computer program. Some important software that usually comes with your computer is called systems software or the operating system and in this section we discuss some of the important components of operating systems. There is a whole field of computer science concerned with the study of operating systems because of its fundamental importance in the use of computers.

2.1 Operating Systems

The operating system is the software that enables you use a computer. Without an operating system, a computer would be useless. It is the software that allows you give the computer commands, such as to start a word processor or to list the files you have stored on the computer’s disk. For programming purposes the importance of the operating system becomes apparent when we wish to perform input and output (I/O). The operating system controls the computers I/O operations, allowing us, to deal with keyboards and screens, without getting bogged down in the details of their hardware interfaces. It is worth noting, at this point, that the operating system is software just like the software any programmer writes. The programmers who write operating system software use the same techniques as other programmers and they cannot walk on water! They do, however, have to concern themselves with details of hardware and operating system software, that most programmers do not have to worry about .

An operating system manages both the computer's hardware and software for you. It allows you use the computer by providing a user interface which enables you give the computer commands. Graphical user interfaces (GUIs) are becoming very popular nowadays. A GUI allows you use a mouse to select commands from menus usually displayed in windows on the screen. MS-Windows and the Macintosh operating system interface are widely used GUIs. A command interpreter is a user interface program that displays a prompt on the screen and the user enters a command using the keyboard. MS-DOS and Unix provide such command interpreters. Note that many systems now provide both GUIs and command interpreters. So, on a Unix system, you may use the Unix command interpreter or a windows-based GUI - e.g. X-windows. On a personal computer you may usually be able to choose to use MS-Windows or MS-DOS. We describe command interpreters in more detail, in section 2.6.

One way to look at an operating system is to view it as being composed of two major subsystems: a file handling subsystem and a program execution subsystem. The file handling subsystem is responsible for the management of files. A file may be defined as a named computerised container for information. The program execution subsystem is responsible for allowing you run or execute programs. A running program is called a process in operating systems terminology, so this subsystem is also called the process subsystem.

You must not confuse the term process with the term program. A program is a set of instructions and as such is a static entity i.e. does not change (unless of course you modify it). A process on the other hand is defined as a program in execution. This means that a process includes not only the instructions making up the program but also the values of the CPU registers and memory variables that are associated with a running program. Thus a process changes after each instruction executes i.e. each instruction causes some change in a register or memory variable. A process is therefore a dynamic entity. It may pass through different states such as executing, waiting for I/O to complete or waiting for the CPU to be allocated to it.

2.2 Computers and Operating Systems

There are numerous different types of computers being manufactured by many computer companies ranging from microcomputers to supercomputers. Each manufacturer’s hardware is typically different from that of their competitors. For this reason, traditionally, each computer type had its own operating system developed for it. This is because the operating system was totally dependent on the hardware of the computer it was to manage. The operating system could only be used on the particular machine it was designed for. This meant that if you bought a different type of computer, you had to learn how to use a new operating system. While this may have suited manufacturers, who did not want you to buy a competitor's machine, it certainly did not suit users. For example, Digital developed the VMS operating system for their VAX range of computers and IBM developed the MVS, VM and other operating systems for their mainframe series of computers. The VAX series is a very popular range of computers from micro to mainframe power. The VMS operating system is designed for the VAX computer series and will only run on a VAX computer.

In the 1970’s a new operating system called Unix was developed at Bell Labs. Unix was designed to be a portable. This meant that it could be moved from one type of computer to another different type of computer using different hardware, without too much difficulty. Unix has to be tailored for each machine, but it is designed to make this tailoring relatively straightforward. By the late 1980's, Unix had been implemented on every common make of computer, from the Digital VAX to IBM mainframes, from the humble microcomputer to powerful supercomputers. It is the only operating system that has been implemented on such a diverse range of hardware platforms. As a result, it is now one of the most commonly used operating systems in the world, becoming a de facto standard in operating systems.

In the microcomputer world, the MS-DOS operating system is very widely used on IBM microcomputers (PCs) and their clones. When IBM introduced their PC to the market, many of their competitors in effect copied the machine producing IBM compatibles or clones. Their competitors then acquired the same operating system for the clones, from a company called Microsoft who had developed the operating system for IBM! The IBM PC operating system was called PC-DOS while that of its clones was called MS-DOS. For practical purposes they are almost identical. MS-DOS is the most widely used operating system, since there are in excess of 200 million PCs in use around the world and this number is increasing at a rate of between 20 and 30 millions a year..

It should be noted that a microcomputer operating system is much less sophisticated than an operating system for more powerful computers. A microcomputer, typically only has to deal with a single user at any point in time i.e. it is a single-user system. Operating systems like Unix and VMS may have to cope with hundreds of users simultaneously i.e. they are multi-user systems. This means that the operating system, has to deal with the programs of a number of users, at the same time. Even a single user system may have to do this if it provides multi-tasking. A multi-tasking system is one whereby a number of programs can be executed at the same time. Multi-user systems have to be multi-tasking and this makes them harder to design and implement than single-user systems which are usually single tasking.

A major design problem in a multi-user system is due to concurrent access i.e. users accessing the machine at the same time. The problem is one of preventing them (their programs) from interfering with each other. For example, we must ensure that two or more users do not use the printer at the same time, otherwise their printouts would become mixed up. Text from different users would appear on the same page, and the printouts would be useless! Thus, one important theme in a multi-user operating system design is that of sharing resources. Since a number of users are accessing the computer system concurrently, the operating system must arrange to share (allocate) the resources of the computer system among the users. Hence an operating system is sometimes called a resource manager. The computer system resources which must be shared are: the CPU, memory, disk storage, printers, terminals and so on. Sharing the CPU is called scheduling and the part of the operating system that carries out this function is called the scheduler. Sharing memory is called memory management and the memory manager is the operating system component that carries out this function. Scheduling and memory management are fundamental functions of the process subsystem.

2.3 Scheduling

It is crucial to understand that in a single processor (uni-processor) computer system, only one program can execute at any point in time. Yet on a multi-user system all users have the impression that their program is the one currently executing. This is an illusion, achieved by the speed of the processor. The processor can execute millions of instructions per second. So, the operating system scheduler allocates the CPU to each user’s program for a short period of time called a quantum, usually a fraction of a second for example, 100 milliseconds. The CPU then executes that program until its time fraction expires. The scheduler then switches the CPU to another program for a fraction of a second and so on. When the scheduler returns to executing the first program, it resumes the program at the point it was last executing at. Because of the speed of the CPU, it will normally have returned to a program, before a user realises that the program has not being executing.

The scheduler is a small, but important program whose basic function is to decide which program (job) to run next and to start it. There are numerous scheduling policies used to decide which process gets the CPU next. One such policy is called the round robin policy where everyone gets an equal amount of CPU time in sequence so that no program gets a second CPU quantum until every program has received a first CPU quantum. Another scheduling policy is a priority scheduling policy where user programs are assigned higher or lower priorities. The scheduler gives high priority programs preference over low priority programs i.e. the scheduler executes the program with the highest priority.

While priority scheduling seems very unfair, it works quite well in practice because of one important feature of program execution, which is, that most programs carry out I/O. This is important because of the mismatch in speed between the CPU and the I/O devices of a computer. As mentioned earlier, it is 100,000 slower to access information on disk than to access information stored in RAM. Keyboard input compares to CPU speed in a similar fashion as snail speed compares to jet aircraft speed! Thus while the CPU is waiting for an I/O operation to complete for one program, it can be switched by the scheduler to another program. Thus, a high priority process that carries out I/O will not unduly hog the CPU from other programs. It has been observed that process execution involves periods of CPU execution and periods of I/O wait (waiting for an I/O operation to complete). Processes alternate between these two states. Programs may be classified as I/O bound if they exhibit many short CPU bursts (typical file processing program) intermingled with I/O waits. They are CPU bound if they exhibit a few very long CPU bursts. A high priority CPU bound process will indeed hog the CPU and the response time for other users will suffer as a consequence.

2.4 Memory Management

The operating system memory manager must arrange for programs to share memory. For example, a multi-user system running 4 user programs, might have its memory shared as illustrated in Figure 2.1. Note that the operating system itself is a program and so it must also be stored in memory and that it occupies a significant portion of memory. It also occupies a significant amount of disk storage space. It is important to be aware of the fact that the operating system, in managing the computers resources, uses a significant amount of those resources itself in terms of CPU time, memory and disk storage space.

Figure 2.1: Sharing Memory

A fundamental problem with computing systems has been the lack of sufficient RAM capacity to store very large programs or a large number of programs, in their entirety. As RAM capacity increases (doubles every 1.5 years approximately), so too, does program size, including the size of the operating system. The basic solution to this problem is to use disk storage to store portions of programs not currently required by the processor and to swap information between disk and RAM as it is required by the processor. The disadvantage of this solution is that it slows down program execution time given the time it takes to access disk storage.

One strategy called swapping, swaps entire programs between disk and RAM for execution. When a program has been swapped into RAM it can execute for a while, when the scheduler decides to execute another program, the current program is swapped out to disk and the next program is swapped into RAM. This allows you execute many more programs than you have RAM capacity to cater for.

However, swapping does not allow you write programs larger than the available RAM. One solution to this problem (i.e. to allow you write programs larger than the available RAM size) involves the use of overlays, an old technique dating from the early days of computing, but widely used in the PC world today. The idea is simple, instead of writing one large monolithic program, you write a number of smaller programs each of which can fit into RAM. You write the programs in such a way, that the first program carries out part of the task and before it terminates it loads in or overlays itself with a second program. This program carries out a further part of the task and overlays itself with a third program and so on.

As an example of the use of overlays, consider a menu driven program with 3 options (A, B and C). It could be constructed using 4 separate programs so that each option is carried out by a separate program:

program1: (Main Program)

display menu

read user option

overlay with program for user option

(i.e. one of program2, program3 or program4)

program2: carry out task for option A

overlay with program1 (main program)

program3: carry out task for option B

overlay with program1 (main program)

program4: carry out task for option C

overlay with program1 (main program)

The user executes the main program and chooses an option from the menu. The main program responds by overlaying itself with the appropriate program to carry out the user's option. When this program has finished, it overlays itself with the main program. This allows the user choose another option and the procedure is repeated. Overlays can be used on single user, single tasking machines, and are frequently used in PC software applications where insufficient RAM is available to hold very large application programs.

Virtual Memory

The use of a virtual memory system also solves the problem of insufficient RAM storage. A virtual memory system employs disk storage to provide the illusion that a machine has a very large RAM which is called its virtual memory. In this manner, a machine which has only a few megabytes of actual RAM, can operate, as is if it had many megabytes of RAM. The trick is to store much of the information on disk and copy it into RAM as it is required. The operating system and memory management hardware keeps track of what is stored in RAM and what is stored on disk, transferring information from disk as it is required. Information is usually transferred in units called pages, the technique being referred to as paging. There is also another technique called segmentation which is not as widely used.

Virtual memory may be visualised as a large linear address space, much larger than the actual physical address space, as illustrated in Figure 2.2. A mapping function is required to map addresses between the two address spaces. Programs use virtual addresses, for example, given a machine with 4 Mb of RAM and a 16 Mb virtual address space, a program will use addresses (for data and instructions) in the range from 0 to 16 million. It is one of the functions of the memory management unit (mmu, a hardware device) to perform the mapping between the virtual address used in the program and the actual physical address, in RAM.

Figure 2.2: One gigabyte virtual memory machine

Virtual memory as mentioned above, is typically composed of units called pages, ranging in size, from 512 bytes to 4Kb. Physical memory is treated as if it were made up of page frames of the same size as pages. A page table is used to indicate which page frame contains which virtual memory page. The page table has a reference bit to indicate if the page is already in the page frame. If we attempt to access a virtual memory address which is not currently in physical memory, a page fault occurs. This causes an interrupt which results in the transfer of the required page from disk to memory. A problem arises if all the page frames in memory are full i.e. where do we store the incoming page? The solution is to replace a page in one of our page frames, with the incoming page. The previous page will be copied to disk, if it has been changed since it was last loaded from disk.

How do we choose which page to replace? There are a number of page replacement algorithms that may be used. The optimal algorithm would be to replace the page that will not be needed for the longest period of time. However, we have no way of knowing this in advance, so we cannot implement this method. We could replace a page at random, however, performance is greatly improved if we do not choose a heavily used page. This is because, such a page would be required very soon and would have to be transferred to RAM and another page replaced and since transferring pages to and from disk requires disk I/O, it is very slow operation. Other algorithms that may be used include Least Recently Used (LRU), Not Recently Used (NRU) and First In First Out (FIFO). The reader will find details of these algorithms in any Operating System textbook.

Working Set Model

Most programs exhibit a phenomenon known as locality of reference. This means that most programs access a small number of their pages during any phase of their activity. For example up to 90% of CPU time is frequently spent executing 10% of the program code for many applications. Another way of looking at this, is to observe that most programs spent long periods of time executing loops. During the execution of a particular loop, only those instructions composing the loop and the variables accessed in the loop are required. This phenomenon also forms the basis in computer architecture for using cache memory to improve performance. The set of pages in current use is called the working set. If the entire working set is in memory, there will be few page faults. If the working set is not in memory, then there will be many page faults and performance degrades significantly as more time is spent servicing page faults than executing the program instructions. This phenomenon is called thrashing.

Virtual memory systems often use a mechanism known as demand paging. They only load pages into RAM as they are required (demanded). An alternative approach is to pre-load the working set of a program into memory (called prepaging), before beginning to execute the program, if you know in advance, what the working set is. Virtual memory systems may also use swapping. For example, in an interactive situation, a user editing a file, may go for a coffee break and the program remains in active until the return of the user. The system can detect this and swap the program pages out of memory, until the program is reactivated by the user.

2.5 File Subsystem

The file subsystem provides facilities for managing files such as:

• Space allocation for files

• Security of files

• Creation and modification of files

• Organising files (directory management)

An important function of the filing subsystem is space management. It must keep track of both the allocated space used by files (so that the contents of files can be accessed) and the free space available for use. Space is usually allocated in blocks of 512 or 1024 bytes. A file containing a single character, will still use up an entire block of storage. While this may appear wasteful, it makes space management much simpler. When a file is deleted, the filing subsystem reclaims the space used by that file, so that it can be reused.

A multi-user operating system allows users to share disk storage. This is an additional function of the filing system of a multi-user system. Usually the filing system arranges to partition the disk so that each user has an area of disk for their sole use. This area is called a directory (folder). A user’s directory contains their files and perhaps other directories. The operating system itself will also have its own directory where its programs are stored. The filing system allows each user to access only their own files or files which they have been given permission to access. In other words, the filing subsystem also maintains information about the access rights users have to files. This provides a level of security for users of a multi-user system.

2.6 Command Interpreter

The command interpreter, as mentioned earlier, is a program that allows you execute commands (run programs) on a computer. This means that it is an important component of an operating system. Every command you give is associated with running a program. When you start up (boot up) a microcomputer or log onto a multi-user computer, the command interpreter is usually started automatically for you, so that you can immediately execute commands. A GUI allows you give commands, by selecting options from a menu with a pointing device such as a mouse. A command interpreter carries out commands, usually loading programs from disk to do so. A small number of commands are built-in to the command interpreter program and do not have to be loaded from disk. For example, in MS-DOS commands such as diskcopy and format are the names of programs which reside on disk (external commands). When a user issues one of these commands, the command interpreter loads the appropriate program from disk and executes it. The command dir on the other hand is a built-in command and does not have to be loaded from disk. Each command interpreter will have some built-in commands and will load programs from disk to carry out other commands .

Most operating systems provide the facility of allowing you create a file of commands which will be executed automatically, by the command interpreter, each time you log on to (boot up) your machine. This file is called a login command file or startup file. For example, if you wished to use a word processor every time you start your machine, you could put the command to start the word processor, in your startup file. Then when you start your machine, the command interpreter will start your word processor automatically. Each operating system uses a special name for the startup file. In MS-DOS this file is called autoexec.bat, in Unix it is called either .login or .profile, and in VMS it is called login.com.

The operation of a text based command interpreter program is quite simple and can be shown in pseudo code as follows:

while (not finished)

{

Prompt user

Read command

Execute command or display error message if

the command is invalid

}

The prompt tells you that the command interpreter is waiting for your command. Various systems use different prompts and it is usually possible for you to change the prompt to whatever you want.

MS-DOS C> (or A> or B>)

Unix % (or $)

VMS $

 

 

 

The MS-DOS command interpreter is stored in a file called command.com. When MS-DOS is booted, it loads and executes this program. Unix provides a choice of command interpreter (called shells in Unix terminology) stored in the files /bin/sh, /bin/csh, or /bin/ksh.

Command Names

One problem with having different operating systems available is that they use different names for commands which carry out the same task. This can be a cause of confusion and frustration for users. As an example consider the names used for some file handling commands for the MS-DOS, VMS and Unix operating systems:

MS-DOS VMS Unix

type type cat

copy copy cp

del delete rm

dir directory ls

print print lpr

cd set default cd

(Note that VMS commands may be abbreviated e.g. ty may be used for type and dir for directory.) While the MS-DOS and VMS commands are similar, the Unix commands are quite different. There is some evidence to show that new computer users can learn the commands for any operating system in about the same amount of time. Unix advocates cite this when confronted with the charge that Unix command names are unfriendly! It is the author's opinion that much of the debate about so called friendly command names is spurious and that users are very influenced by the command names of the first computer system they encounter and are familiar with. If subsequent computer systems have similar command names to those of the first one used, then these may be regarded by users as being 'friendly', while if the command names differ greatly from those a user is familiar with, they may be regarded as 'unfriendly'. A user with a good grasp of the underlying functionality of commands should have little difficulty coming to grips with a new set of command names. An operating system should be evaluated on issues such as its reliability, efficiency, and security as opposed to its command names.

2.9 Booting up a Computer

The question arises as to how the operating system gets started? Remember, this is the software that allows you use the computer. In order for any program to execute, it must be in the computers memory. But the RAM of a computer loses its contents when the computer is switched off. How then is the operating system loaded into RAM and executed when a computer is switched on? The answer lies in using ROM because, as mentioned earlier. ROM retains its contents permanently. The operating system itself is not stored in ROM. There is normally only a small amount of ROM available and it would not be large enough to hold an operating system. Also, since its contents cannot be modified, it would not be possible to correct any errors (bugs) in the software that unfortunately arise in complex programs like operating systems. Thus it would not be a good idea to store the operating system in ROM, even if it was possible. Instead, what happens is that a small program is stored on the ROM which is used to get the operating system loaded and executed. The operating system code is stored on disk. The ROM program loads a part of the operating system, called the bootstrap program from a fixed location on disk (called the boot block) into RAM and switches control to this program. This bootstrap program in turn loads the rest of the operating system from disk into RAM and switches control to it. This process is called bootstrapping (booting) after the notion of pulling yourself up by your boot laces! One advantage of this technique, is that it means that the same computer can use a different operating system by placing an appropriate bootstrap program in the boot block for the operating system you wish to boot up.

In summary, when you switch on (boot up) a computer, a program in ROM is executed which loads in a second program from disk and starts it. This bootstrap program in turn loads the operating system program from disk and starts it. The operating system then starts the command interpreter to allow you give the computer commands. Each operating system has its own command interpreter which will be executed on booting. IBM PCs and their compatibles are unusual in that the ROM does not only contain a bootstrap program as described above, but it also contains code for device drivers for the screen, keyboard and disk etc. This code is referred to as the ROM BIOS (Basic Input Output System). In other operating systems this code would usually reside on disk with the rest of the operating system code. In addition, the ROM contains self-test code to ensure that the hardware is functioning properly when the machine is switched on. This code is called power-on self test code (POST code).

3 Programming Support

In order to write programs, language translators such as compilers, interpreters and assemblers are required. These translators have to have knowledge of the operating system in order to produce machine code programs that can be executed by the operating system. In addition programs called linkers and loaders are used to allow external subprograms such as library functions and system calls to be invoked from a program. Linkers and loaders arrange for the external subprograms to be integrated with a program and look after the loading of the program into a suitable area of memory. Such software may come with an operating system or be purchased separately. In either case, it is essential to have such software if users intend to write computer programs.

 

 

 

History of Computers

 

From the earliest times the need to carry out calculations has been developing. The first steps involved the development of counting and calculation aids such as the counting board and the abacus.

 

Pascal (1623-62) was the son of a tax collector and a mathematical genius. He designed the first mechanical calculator (Pascaline) based on gears. It performed addition and subtraction.

 

Leibnitz (1646-1716) was a German mathematician and built the first calculator to do multiplication and division. It was not reliable due to accuracy of contemporary parts.

 

Babbage (1792-1872) was a British inventor who designed an ‘analytical engine’ incorporating the ideas of a memory and card input/ouput for data and instructions. Again the current technology did not permit the complete construction of the machine.

Babbage is largely remembered because of the work of Augusta Ada (Countess of Lovelace) who was probably the first computer programmer.

 

Burroughs (1855-98) introduced the first commercially successful mechanical adding machine of which a million were sold.by 1926.

 

Hollerith developed an electromechanical punched-card tabulator to tabulate the data for 1890 U.S. census. Data was entered on punched cards and could be sorted according to the census requirements. The machine was powered by electricity. He formed the Tabulating Machine Company which became International Business Machines (IBM). IBM is currently the largest computer manufacturer, employing in excess of 300,000 people.

Aiken (1900-73) a Harvard professor with the backing of IBM built the Harvard Mark I computer (51ft long) in 1944. It was based on relays (operate in milliseconds) as opposed to the use of gears. It required 3 seconds for a multiplication.

 

Eckert and Mauchly designed and built the ENIAC in 1946 for military computations. It used vacuum tubes (valves) which were completely electronic (operated in microseconds) as opposed to the relay which was electromechanical.

It weighed 30 tons, used 18000 valves, and required 140 kwatts of power. It was 1000 times faster than the Mark I multiplying in 3 milliseconds. ENIAC was a decimal machine and could not be programmed without altering its setup manually.

 

Atanasoff had built a specialised computer in 1941 and was visited by Mauchly before the construction of the ENIAC. He sued Mauchly in a case which was decided in his favour in 1974!

 

Von Neumann was a scientific genius and was a consultant on the ENIAC project. He formulated plans with Mauchly and Eckert for a new computer (EDVAC) which was to store programs as well as data.

 

This is called the stored program concept and Von Neumann is credited with it. Almost all modern computers are based on this idea and are referred to as von neumann machines.

 

He also concluded that the binary system was more suitable for computers since switches have only two values. He went on to design his own computer at Princeton which was a general purpose machine.

 

Alan Turing was a British mathematician who also made significant contributions to the early development of computing, especially to the theory of computation. He developed an abstract theoretical model of a computer called a Turing machine which is used to capture the notion of computable i.e. what problems can and what problems cannot be computed. Not all problems can be solved on a computer.

Note: A Turing machine is an abstract model and not a physical computer.

 

From the 1950’s, the computer age took off in full force. The years since then have been divided into periods or generations based on the technology used.

 

First Generation Computers (1951-58): Vacuum Tubes

 

These machine were used in business for accounting and payroll applications. Valves were unreliable components generating a lot of heat (still a problem in computers). They had very limited memory capacity. Magnetic drums were developed to store information and tapes were also developed for secondary storage.

 

They were initially programmed in machine language (binary). A major breakthrough was the development of assemblers and assembly language.

 

 

Second Generation (1959-64): Transistors

The development of the transistor revolutionised the development of computers. Invented at Bell Labs in 1948, transistors were much smaller, more rugged, cheaper to make and far more reliable than valves.

Core memory was introduced and disk storage was also used. The hardware became smaller and more reliable, a trend that still continues.

 

Another major feature of the second generation was the use of high-level programming languages such as Fortran and Cobol. These revolutionised the development of software for computers. The computer industry experienced explosive growth.

 

 

 

Third Generation (1965-71): Integrated Circuits (ICs)

 

IC’s were again smaller, cheaper, faster and more reliable than transistors. Speeds went from the microsecond to the nanosecond (billionth) to the picosecond (trillionth) range. ICs were used for main memory despite the disadvantage of being volatile. Minicomputers were developed at this time.

 

Terminals replaced punched cards for data entry and disk packs became popular for secondary storage.

 

IBM introduced the idea of a compatible family of computers, 360 family, easing the problem of upgrading to a more powerful machine.

 

Substantial operating systems were developed to manage and share the computing resources and time sharing operating systems were developed. These greatly improved the efficiency of computers.

Computers had by now pervaded most areas of business and administration.

 

The number of transistors that be fabricated on a chip is referred to as the scale of integration (SI). Early chips had SSI (small SI) of tens to a few hundreds. Later chips were MSI (Medium SI): hundreds to a few thousands,. Then came LSI chips (Large SI) in the thousands range.

 

Fourth Generation (1971 - 1980s): VLSI (Very Large SI)

 

VLSI allowed the equivalent of tens of thousand of transistors to be incorporated on a single chip. This led to the development of the microprocessor a processor on a chip.

 

Intel produced the 4004 which was followed by the 8008,8080, 8088 and 8086 etc. Other companies developing microprocessors included Motorolla (6800, 68000), Texas Instruments and Zilog.

 

Personal computers were developed and IBM launched the IBM PC based on the 8088 and 8086 microprocessors.

Mainframe computers have grown in power. Memory chips are in the megabit range. VLSI chips had enough transistors to build 20 ENIACs.

Secondary storage has also evolved at fantastic rates with storage devices holding gigabytes (1000Mb = 1 Gb) of data.

 

On the software side, more powerful operating systems are available such as Unix. Applications software has become cheaper and easier to use. Software development techniques have vastly improved.

 

Fourth generation languages 4GLs make the development process much easier and faster.

 

[Languages are also classified according to generations from machine language (1GL), assembly language (2GL), high level languages (3GL) to 4Gls].

Software is often developed as application packages. VisiCalc a spreadsheet program, was the pioneering application package and the original killer application.

 

Killer application: A piece of software that is so useful that people will buy a computer to use that application.

 

 

Fourth Generation (1990s): ULSI (Ultra Large SI)

ULSI chips have millions of transistors per chip e.g. the original Pentium had over 3 million and this has more than doubled with more recent versions. This has allowed the development of far more powerful processors.

 

 

 

The Future

 

Developments are still continuing. Computers are becoming faster, smaller and cheaper. Storage units are increasing in capacity.

 

The distinction between mainframe, mini and microcomputer has become blurred.

 

Distributed computing is becoming popular and parallel computers with large numbers of CPUs have been built.

 

The networking of computers and the convergence of computing and communications is also of major significance.