Computer

From MobileRead
Jump to: navigation, search

This article discusses the computer or more accurately a General Purpose Stored Program Digital Computer. The intent is to describe how the computer that is inside of most eBook readers actually works. The focus is to be as clear and simple as possible. Modern home and personal business computers are often called PCs.

Contents

[edit] History

For a basic history of the role of characters in the development of the computer for eBook use see the eBooks article. For a look back at earlier data devices take a look at Paper and Pencil.

Often historians indicate that computers existed sometime before the last ice age or similar nonsense. They typically equate the words calculator and computer as meaning the same thing. Today no one would make that mistake. As the word is used today, history only goes back as far as World War II. The first electronic programmable computers were developed as part of the war effort. The British were developing a code breaking machine while the Americans were working on a machine that was intended to compute fire control tables for the large field artillery and ship-board guns used by the military. Both of these efforts were deemed important to the war effort.

The US had large rooms filled with women (these women were also called computers) working with calculators to build fire control tables for every possible piece of artillery. A fire control table would be used to determine the exact angle that a projectile needed to be shot in order to hit the target. It was a complicated mathematical formula. The British machine was instrumental in breaking some significant codes while the American machine was not quite completed prior to the war end. (Note that the Germans also had a computer used during the war but it was not electronic. It was built with electro-mechanical relays.)

At the end of the war the code breaking machine, called Colossus, was hidden away for security reasons while the American computer went on to completion and was shown to the world as the first general purpose digital computer. Technically the Colossus preceded it but was not a general purpose machine since it was targeted at code breaking. Both had severe limitations however as the only way to program them was to rewire them. The design allowed for rewiring by using a set of jumper wires called a plug board but a better method was needed.

The answer they were looking for was a way to store the program in the machine itself which meant they needed some sort of electronic memory. By the end of the '40s there were several candidates available to solve the memory problem and better ones were added later. By the middle '50s the computer was finding its way into businesses and the scientific community. It was no longer just a military weapon or laboratory curiosity.

[edit] Hardware

A general purpose computer consists of four main sections: the arithmetic and logic unit (ALU), the control center, the memory, and the input and output devices (collectively termed I/O). These parts are interconnected by busses and control logic as well as a master clock. The thing that sets a computer apart from other hardware devices is the ability to program the computer. That is to say that a list of instructions (the program) can be given to the computer and it will store them and carry them out at some time in the future. The computer language used by the program also includes the ability to make decisions based on information stored in the computer or available from I/O devices and thus the computer exhibits some level of intelligence. The way a decision works is by enabling the computer to jump from the normal sequential set of instructions to a different sequential set of instructions.

The logic and even the numbers is based on a simple switch that is either on or off. This is represented in computer numbers by the binary system of 1 and 0. All digital computers use the basic binary system to represent numbers, letters, logic control, and everything else performed by the computer. The smallest unit of the binary system is the "bit" which defines only a 1 or a 0. Multiple bits are used to define larger numbers. Eight bits is generally called a byte which is a term used to define a collection of bits large enough to potentially hold a character while multiple bytes might hold a word.

[edit] CPU

The control center, ALU, registers, and basic I/O control functions of a computer are collectively known as a central processing unit (CPU), sometimes called the processor. Early CPUs were composed of many separate components but since the mid-1970s CPUs have typically been constructed on a single integrated circuit (chip) called a microprocessor.

[edit] Register

The CPU uses registers to store temporary data. There are several registers in a computer. Each register can typically hold one word of data. There is one special register called the program counter. It holds the location of the next word in memory and will be used to retrieve a computer command. In addition there is a register that stores the status of things the CPU needs to keep track of.

[edit] Control center

The control center has all of the logic necessary to make the CPU function. It defines the instruction set (the detailed implementation of commands/instructions that the computer knows). It can be entirely made out of hardware or it can be made from minimal hardware and microcode. The microcode is a specific type of firmware that can replace a hardware implementation. It was pioneered in the '60s by IBM and permitted different hardware implementations to be able to actually run the exact same machine language programs. They have the same instruction set although the implementation of those instructions is different.

The way a computer works is to:

  1. retrieve a word from memory via the location (address) stored in the program counter and place it in a special register.
  2. decode the instruction found in the word.
  3. retrieve any data specified in the instruction.
  4. execute the instruction.
  5. increment the program counter and return to step one.

Note that the execution of the instruction may result in modifying the program counter thus causing a branch to a different set of instructions.

[edit] Instruction set

The instruction set that a computer understands varies with the type of CPU chip. It will typically include instructions that can:

  • move data to and from memory
  • manipulate the ALU
  • check status and branch depending on that status
  • save the current program counter and go to a different location to get instructions (called a subroutine)
  • respond to interrupts which are asynchronous events typically triggered by hardware. The response is to save the current program counter location load the program counter with a special address and then branch (jump) to the new instructions.
  • return to a previously saved program counter location.

[edit] ALU

The center of the CPU is the ALU (Arithmetic Logic unit). This piece of hardware typically consists of 3 registers (called A, B, and C in this discussion) and some additional hardware. It generally treats all data as a number (or value). It can add the value of two input registers, A and B, and save the answer in register C. While doing this it can set status bits based on the outcome. Status includes such things as the answer overflowed the value that could be stored in C, the answer was positive or negative, the answer was zero. A second function of the ALU is to compare two input values. In this case there is no need for an output. The status will tell you which number was larger or if they were the same. A third function is to perform logical operations on the values such as AND and OR. Some ALU's can do more such as subtracting values and shifting the values left or right by one or more bits.

While these operations may seem trivial and very simple it is amazing how complex a problem a computer can solve with successive use of very simple tasks. The computer strength is that it is very fast at performing these simple tasks and can perform millions of such tasks in the blink of an eye.

[edit] CPU types

Initially microprocessors only had a few different instructions. As time progressed the instruction set became larger and the overhead to execute became longer. These computer chips came to be known as CISC computers (Complex Instruction Set Computers). To achieve faster clock cycles and lower power needs the RISC (Reduced Instruction Set Computer) computer was developed. Today, desktop systems use a CISC architecture (x86, Pentium) while most portable devices use RISC chips (ARM). However, technology a has advanced to the point where even some CISC chips such as the ATOM processors can be very battery friendly and can be used successfully in portable devices.

[edit] Memory

The computer memory is where the program is stored. It is also used to store data that can be used by the program. In the case of an eBook Reader the prime data is the content of the eBook itself. The term memory can be confusing since it is used from both the internal memory directly accessed by the CPU and also for more permanent storage of data and programs. Storage of data is usually relegated to secondary memory devices while the direct access devices are generally referred to as RAM, Random Access Memory.

[edit] RAM

True RAM devices are accessed directly by an address. This means that the RAM memory is arranged in an array of locations. Each location has a unique address and inside that address is the data. Typically the arrangement of memory is such that the data is a fixed length. For example 32 bits is often used for memory representing a word of information (4 bytes of 8 bits each when each Byte holds a character or binary value). RAM memory typical provides the fastest access to data available in a computer. (One variation of RAM is to provide a small extremely fast area of memory called a cache to store often used data.)

[edit] ROM

RAM is typically volatile, meaning that it is erased when power is lost. The need to keep the RAM contents is what causes some battery powered devices such as PDAs to use battery power even when off. To avoid this problem predefined memory content called ROM (Read Only memory) was developed. More recently this designation has been used to also represent changeable data so long as it remained after power was off, thus you see terms like Flash ROM or flash memory.

[edit] Storage

There are also memory devices that behave like disk drives. (Disk drives themselves are also termed memory.) Instead of direct access these memory devices are formatted like a disk drive and are accessed by reading blocks of data like a disk drive. One very popular version is the SD card which is used to expand the storage memory on most eBook Readers and other portable computers while being removable. See File system for more on Storage systems.

[edit] I/O

Input and output devices can be added externally to the basic computer or built-in. These include but are not limited to:

and hundreds of other devices.

The possibility of continuing to design and add new devices has resulted in a need for a universal way to attach devices to a computer. The latest standard is called USB, universal serial bus. Earlier standards include the serial port, still in use, and the parallel port, now obsolete.

Hardwarewise, things like disk drives and tape drives are technically I/O devices but they are often referred to as memory devices since they do not interface or interact directly with humans and are used as a way to store information, which is what memory is used for. The SD card has become the dominate portable (removable) storage device and SSD (solid state disk) drives are replacing or supplementing traditional disk drives.

Additional hardware devices include communication hardware for cellular and internet connections. Historically, the serial port connected to a modem was used for this purpose. Today the term modem is used for the Internet connecting hardware. Connections can also be made using wireless capable devices.

[edit] Software

Software is the term used to describe all programs that are loaded onto computers. If the software is built-in such as being pre-programmed into the device the term used is firmware. Occasionally the term software is also used for data, thus eBooks are sometimes called software and in Europe they are even licensed as software causing them to be taxed differently. Software is stored in files on all storage devices. These files can contain either programs or data. Sometimes data can be embedded in a single file along with the program.

Software on a computer can be divided into 2 sections. One covers the OS (Operating System) and the second is the Applications that actually do what you want done. In mobile devices the name "applications" has been shortened to "Apps".

[edit] OS

When you first turn on a computer it is the operating system that starts first. The hardware has enough capability to access a small routine that will start the OS. In many computers this is called the BIOS (Basic Input/Output System) sometimes called the Built in Operating System due to the fact that it is installed in permanent storage (ROM). This software is very basic and its primary job is to start the main OS. It also has some diagnostic ability to check that the computer is basically working ok and includes enough routines to be able to talk to and configure the disk drive and other devices needed to hold the OS and start the device. (eBook devices typically have the full OS in ROM. See here for OS' available on eBook devices.)

Early computers had even more minimal basic support and used a multi-step process where the hardware started a loader which then loaded a little more capability and this loader routine was finally able to load the real OS. This technique was called booting since the computer was able to bootstrap itself into operation. Many still use the term to boot the computer.

Eventually the OS will begin to run on its own. As part of the process it loaded drivers and verified the operation of the hardware to some degree and loaded up the necessary features to act reasonable to the user. These days this includes a full graphics system that needs to be initialized and perhaps other background tasks. Eventually the final step will be to turn over control to the user.

An OS is divided into several distinct sections. The kernel is the heart of the OS. It manages tasks that are running, provides services such as the clock, and manages the memory use of the system. Typically programs that run will make system calls to the Kernel to request services such as a block of memory or access to a device. A request is even needed to display something on the screen. The Kernel is supported by drivers which are specialized software that are designed to interact with hardware that is attached to the computer.

Surrounding and isolating the kernel is a shell. This is often abbreviated sh or ssh (secure shell). The shell interfaces with the user and passes request to the kernel. If the computer supports multiple users simultaneously each will have his/her own shell. The idea of a shell was first developed on Unix systems and it greatly increase the stability of the System by filtering requests between the user and the Kernel. Some operating systems support more than one shell which allows the user to pick one that they like. The Shell provides some utility functions to help manage the computer and provides the service of launching the application programs. The user interface supported by the shell is one or more of a command line, a GUI (graphical user interface), and/or a menu interface.

Modern operating systems include Microsoft Windows, Linux, Solaris, MacOS X, Windows Mobile, Windows CE, Symbian OS, Android, iOS and many others. EBook Readers do not require a complex OS and generally use a simple one designed for mobile devices or in some cases they have a stripped down a larger OS (generally Linux) by removing features and capabilities that are not needed. See OS list for all of the OS topics in this wiki.

[edit] Drivers

Drivers are the specialized programs that provide the interface between the OS and hardware. Technically these are part of the OS and need to operate with special privileges that them to control portions of the hardware. Initially an OS will need to provide a set of drivers for essential devices.

However, once the basic drivers are done the OS will also need more specialized drivers to take advantage of special features often available in I/O hardware. Only the manufacturer of the hardware itself is likely to be able to provide this sort of driver. For this reason the maker of an OS often has relationships with peripheral hardware manufacturers to obtain or support the inclusion of these special drivers for each OS and hardware configuration.

[edit] Applications

It is the application that actually provides the purpose for buying a computer in the first place. There can be and usually are several applications that can be used on a computer. In the case of an eBook Reader it is possible that there is only one, the program that actually displays the book. A list of eBook Reading application programs can be found at E-book software in this wiki. Applications can also be used to convert eBooks from one format to another or to provide other useful functions.

An application uses OS resources to access hardware and provide other essential features. These services are often common to many applications so they have been assembled into a library of reusable routines that can be called by an application. These routines can be combined directly into the application itself or linked in when the application is run by the user. Linked in libraries are stored in your computer at a common location and generally have a .dll extension (dynamic linked libraries). Some of these libraries are provided by the OS but some can be provided by the application itself.

As with the OS shell, the user interface can be one or more of a command line, a GUI (graphical user interface), and/or a menu interface. It will typically be launched from a shell by the user but can also be launched automatically when the user powers up the device.

In some cases the application might be the only thing the user will ever see, with all things that can be done being done from inside the application. In cases like this the OS is called embedded since it is hidden from the user. An eBook Reader is typical of a device that uses an embedded OS. It some cases there is a back door to get to the OS by stopping the application.

Applications can be small programs or very elaborate ones. In some cases other programs would like to interact with an Application that they didn't write. In these cases an API, Application programming Interface, can be defined to prescribe exactly how a program can access databases using the same routines that are used by the original application. Small single purpose applications are often called Apps, particularly if they have a touch screen interface.

[edit] Languages

Originally the programmer wrote programs by entering the ones and zeros of the binary commands conforming to the instruction set that would be executed by the computer. Soon there were loaders developed that could load in binary data to simplify the task a bit. Assemblers soon followed. An assembler would take data that the user prepared using mnemonics and numbers to generate the machine code that would be executed on the computer. Assembly language was typically one for one with the machine commands. This is very tedious for programmers attempting to write anything complex, however even today assemblers still perform a roll. Clearly, for most programmers a better system was needed.

In 1955 the first computer programming language was released. It was called Fortran which stands for formula translation. It allowed a programmer to write using mathematical equation like statements where one statement might represent several machine language commands. In addition Fortran was developed for different machines which had different machine languages. This allowed a programmer to write source code without having to worry about what computer it was for. The compiler would convert the source code to an appropriate machine code.

While Fortran was mathematically and engineering oriented there was soon a need for business users. Cobol, Common business oriented language, was developed to meet that need. The idea of Cobol was that the input would be in the form of sentences that could be interpreted by a computer and converted to machine language. Both of these languages are still being used and many more have been added since. One of the more popular compiled languages today is called "C" or its derivative C++.

Typically a programmer writes the code and then compiles it into machine language using a compiler. However, some languages are designed to be used with interpreters and the source code is not compiled. These languages are often termed "high level" as they are aimed at being able to write and read the source easily. The user places the statements in a file which is read each time the program is run and interpreted line by line on the fly. Sometimes this form of programming is called scripting as the file containing the commands is being read like a script to be acted upon. A compiled program will generally run 10 times faster (or more) than a program that uses an interpreter but it may not matter to the user. Programming languages like Basic, Perl, and Python are typical interpretive languages although there may be a way to compile a program written in these languages to make it execute faster. Because they are executed directly from the source code they can be easier to change and debug. A script can also be written for a shell and interpreted.

Another advantage of interpretive languages is that the same source code may work on very different computer hardware or OS. A compiled program will only run on a particular class of OS, for example Windows. A Mac computer would need a different version of the same program that must be compiled specifically for the Mac. Different CPU architectures may also require specific binaries compiled for that CPU's instruction set. Java is an example of a programming language designed in this way. It uses a feature of semi-compiling sometimes called byte-compiling which converts the source to a more machine friendly version to make the program execute faster but it still needs an interpretive engine.

[edit] Hardware/Software interaction

The software, of course, runs on the hardware but in some cases it needs to be able to control the hardware it is running on. This is often done by having special memory locations or registers with special attributes. A register can hold a word of data but consider that hardware logic can wired directly to the register as well. For example, suppose a single bit from a register was wired to the power switch. If the program set that bit from a 1 (one) to a 0 (zero) it could actually turn the computer off. Having special registers like this can give the software quite a bit of control. A button on a computer console might be hooked to a bit in a register and if you push the button it might use hardware to set the bit. Computer software can read the bit and know that you pushed the button.

In some cases software can even replace hardware. Consider a clock. A computer usually has a clock inside and it could be implemented by having a piece of hardware like your digital watch and have the watch hardware set the time value in a register where the computer could read it. This works fine but if you realize that a computer also has a high frequency oscillator built in that produces a pulse every few nanoseconds a computer could also keep time by counting pulses. In this case a routine would be called every now and then to update a software based clock. Of course this implementation would have its limits but it gives you an idea of how software can replace hardware.

One item that used to be valuable in a computer was a phone modem. A modem is an I/O device that allows the computer to use a audio phone line to connect to the Internet or to other remote computers. It is possible for a computer to completely fake all of the necessary information and to pretend to be a modem without any (or very little) dedicated hardware at all. This is called a software modem. Many traditional hardware functions can be replaced using only software. The software might be a little slower than the hardware implementation but that may not matter. A software implementation is likely cheaper than the same device implemented in hardware.

Today audio phone lines for computer use have largely been replaced with cellular networks using WWAN, but the hardware is still called a modem.

[edit] Advanced Hardware Topics

This article has talked about the basic hardware features that define a computer and how it works. However, modern computers often have hardware and software features that go beyond the basics. This section will mention a few of them.

  • GPU - A Graphics Processing Unit - this is similar to a CPU except that it is designed specifically for Graphics processing. To match this idea with the human brain you would find the CPU approximates the left brain for reasoning and the GPU is more like the right brain is handling visual images and graphics. It some cases a graphics processor can be quite complex and provide significant improvements in display time.
  • FPU - A Floating Point Unit is a hardware processor designed specifically to work with Floating-point numbers. Floating-point numbers are the way a computer deals with really large and really small numbers. The FPU accelerates math operations on these numbers. It supplements the standard ALU in the computer.
  • DMA - Direct Memory Access is a capability to permit hardware other than the CPU to have access to main memory. Generally an FPU, GPU, and Disk Drives can see a marked improvement if they can access memory directly without having to go through the CPU. They are assigned a block of addresses from the CPU and can then read/write to those locations on their own. They signal the CPU when completed via an interrupt.
  • Cache - the word Cache means hidden and it refers to fast memory that can temporarily store recent data for reuse. It turns out that a program that needs data often needs the same data multiple times and in some cases data can even be prefetched to the cache memory in anticipation that it may be needed. Cache memory access is considerably faster than making a request to main memory. It does not add additional memory but provides two places, one quick and one more permanent to hold the data. Caching hardware can be fairly complicated in that it needs to know which data is the current data, particularly if DMA is in use.
Cache is also present, these days, in disk drives to hold several blocks of data so that the computer can get it more quickly in spite of the fact that the spinning disk might have moved on. Otherwise the computer would have to wait a full revolution of the disk until it was available again.
  • Virtual memory - In a virtual memory system you can think of the main memory as really residing in a special file on the disk drive. This allows you to pretend to have much more RAM memory that you really have. The real RAM is used to cache the disk drive memory contents which means you could have multiple levels of cache. This is accomplished primarily with software. Flushing the RAM contents to disk can permit you to turn off the computer without losing the RAM contents and thus behaves like a hibernate mode.
  • SoC - System on Chip is a design technique where several chips are laid out and combined into a single chip. In this way a complete computer system can be built on a single chip dye. This should result in less total cost and more reliable and faster interconnects of the various parts. This is especially useful for embedded designs.
  • DSP - Digital Serial Processor is a hardware implementation designed to maximize the throughput of serial data such as video streams, audio streams, Wi-Fi, USB or other serial tasks. It may also consist of conversion from or to Analog data. It typically features compression or uncompression of the data, a codec.
  • Multi-core processors - It is possible to put two or more CPU's in the same chip. These are called multi-core chips. The big advantage of multi-core is the close proximity of the various processors facilitates fast communication by sharing internal resources such as memory access and shared registers as well as independent operation. In many cases a multi-core processor may have several duplicate CPU's that can be used to divide the tasks being done and providing more rapid solutions. In a multi-tasking OS these separate cores could be assigned to unrelated tasks.
However, it is not a requirement that the cores be duplicate copies of the CPU hardware. For example a dual-core processor could have a CPU and a GPU sharing the same chip. For a computer that is aimed at multimedia the dual-core might be a CPU and a DSP.

[edit] For more information

    • If you feel something is not clear or more detail is needed then make a comment on the talk (discussion) page.
Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox