Introduction of Computer System
Computer Systems are the foundation of the digital world. Knowing about the working principle of computer system is beneficial for understanding digital world.
General Computer VS Embedded Computer
Computer systems fall into essentially two separate categories. The first, and most obvious, is that of the desktop computer(or general computer) like Windows, MacOS, Ubuntu Desktop. The second type of computer is the embedded computer, a computer that is integrated into another system for the purposes of control and/or monitoring.
The primary difference between an embedded machine and a general-purpose computer is its application. The basic principles of operation and the underlying architectures are fundamentally the same. Desktop computers can run a variety of application programs, with system resources orchestrated by an operating system. In contrast, the embedded computer is normally dedicated to a specific task. In many cases, an embedded system is used to replace application-specific electronics.
Computer System Overview
A computer system is composed of many parts, both hardware and software. At the heart of the computer is the processor, the hardware that executes the computer programs. The computer also has memory, often several different types in one system. The memory is used to store programs while the processor is running them, as well as store the data that the programs are manipulating. The computer also has devices for storing data, or exchanging data with the outside world. These may allow the input of text via a keyboard, the display of information on a screen, or the movement of programs and data to or from a disk drive.
The software controls the operation and functionality of the computer. There are many "layers" of software in the computer. Typically, a given layer will only interact with the layers immediately above or below it.
At the lowest level, there are programs that are run by the processor when the computer first powers up. These programs initialize the other hardware subsystems to a known state and configure the computer for correct operation. This software, because it is permanently stored in the computer's memory, is known as firmware.
The bootloader is located in the firmware. The bootloader is a special program run by the processor that reads the operating system from disk (or nonvolatile memory or network interface) and places it in memory so that the processor may then run it. The bootloader is present in desktop computers, and may be present in some embedded computers.
Above the firmware, the operating system controls the operation of the computer. It organizes the use of memory and controls devices such as the keyboard, mouse, screen, disk drives, and so on. It is also the software that often provides an interface to the user, enabling her to run application programs and access her files on disk. The operating system typically provides a set of software tools for application programs, providing a mechanism by which they too can access the screen, disk drives, and so on.
At the highest level, the application software constitutes the programs that provide the functionality of the computer.
Processors
A processor is an electronic device capable of manipulating data (information) in a way specified by a sequence of instructions. The instructions are also known as opcode(operation code) or machine code. A sequence of instructions is a machine-code program. Each type of processor has a different instruction set, meaning that the functionality of the instructions varies.
There are six basic types of access that a processor can perform with external chips.
- write data to memory
- write data to an I/O device
- read data from memory
- read data from an I/O device
- read instructions from memory
- perform internal manipulation of data within the processor
The internal data storage of the processor is known as its registers. The processor has a limited number of registers, and these are used to hold the current data/operands that the processor is manipulating.
The Arithmetic Logic Unit (ALU) performs the internal arithmetic manipulation of data in the processor. The instructions that are read and executed by the processor control the data flow between the registers and the ALU. The instructions also control the arithmetic operations performed by the ALU via the ALU's control inputs. A symbolic representation of an ALU is shown in Figure.
Whenever instructed by the processor, the ALU performs an operation (typically one of addition, subtraction, NOT, AND, OR, XOR, shift left/right, or rotate left/right) on one or more values.
There are two major approaches to processor architecture: Complex Instruction Set Computer (CISC, pronounced "Sisk") processors and Reduced Instruction Set Computer (RISC) processors. Classic CISC processors are the Intel x86, Motorola 68xxx, and National Semiconductor 32xxx processors, and, to a lesser degree, the Intel Pentium. Common RISC architectures are the Freescale/IBM PowerPC, the MIPS architecture, Sun's SPARC, the ARM, the Atmel AVR, and the Microchip PIC.
Basic System Architecture
The processor alone is incapable of successfully performing any tasks. It requires memory (for program and data storage), support logic, and at least one I/O device ("input/output device") used to transfer data between the computer and the outside world. The basic computer system is shown in:
The memory of the computer system contains both the instructions that the processor will execute and the data it will manipulate. The memory of a computer system is never empty. It always contains something, whether it be instructions, meaningful data, or just the random garbage that appeared in the memory when the system powered up. In Von Neumann computer architecture, instructions are read (fetched) from memory, while data is both read from and written to memory, as shown in Figure.
A classical Von Neumann machine has several distinguishing characteristics:
- There is no real difference between data and instructions. A processor can be directed to begin execution at a given point in memory, and it has no way of knowing whether the sequence of numbers beginning at that point is data or instructions.
- Data has no inherent meaning. There is nothing to distinguish between a number that represents a dot of color in an image and a number that represents a character in a text document. Meaning comes from how these numbers are treated under the execution of a program.
- Data and instructions share the same memory. This means that sequences of instructions in a program may be treated as data by another program. A compiler creates a program binary by generating a sequence of numbers (instructions) in memory.
- Memory is a linear (one-dimensional) array of storage locations. The processor's memory space may contain the operating system, various programs, and their associated data, all within the same linear space.
Each location in the memory space has a unique, sequential address known as address space. How that address space is partitioned between different memory and I/O devices is known as the memory map.
A bus is a physical group of signal lines that allow for the transfer of electrical signals between different parts of the computer system and thereby transfer information from one device to another. The majority of microprocessors available today use the three-bus system architecture. The three buses are the address bus, the data bus, and the control bus.
The data bus is bidirectional, the direction of transfer being determined by the processor. The address bus carries the address, which points to the location in memory that the processor is attempting to access. The control bus carries information from the processor about the state of the current access, such as whether it is a write or a read operation. The control bus carries information from the processor about the state of the current access, such as whether it is a write or a read operation.
A microprocessor is a processor implemented on a single, integrated circuit. With the exception of those found in some large supercomputers, nearly all modern processors are microprocessors, and the two terms are often used interchangeably. Common microprocessors in use today are the Intel Pentium series, Freescale/IBM PowerPC, MIPS, ARM, and the Sun SPARC, among others. A microprocessor is sometimes also known as a CPU (Central Processing Unit).
Memory
Memory is used to hold data and software for the processor. There are two main categories of computer memory:
- Primary Memory (RAM): also known as Random Access Memory, is where the computer stores data that is currently in use. This data is volatile, meaning it is erased once the computer is powered down. RAM provides high-speed access for the CPU (central processing unit) to retrieve data and instructions needed for ongoing operations. Different types of RAM include: SRAM, DRAM.
- Secondary Memory (Storage): This is non-volatile memory that retains data even after the computer is powered off. It's used for long-term storage of data and programs. Secondary storage devices are typically slower than RAM but have much larger capacities. Common types of secondary memory include:Hard Disk Drives (HDD), Flash, Solid State Drives (SSDs).
Input/Output
The address space of the processor can contain devices other than memory. These are input/output devices (I/O devices, also known as peripherals) and are used by the processor to communicate with the external world. Some examples are serial controllers that communicate with keyboards, mice, modems, etc.; parallel I/O devices that control some external subsystem; or disk-drive controllers, video and audio controllers, or network interfaces.
Microprocessor VS Microcontroller
Generic computer(Like desktop computer) or large-scale embedded computers may use microprocessor as their processor. This system has a large main memory to hold the operating system, applications, and data, and an interface to mass storage devices (disks and DVD/CD-ROMs)
A microcontroller is a processor, memory, and some I/O devices contained within a single, integrated circuit, and intended for use in embedded systems. The buses that interconnect the processor with its I/O exist within the same integrated circuit. The range of available microcontrollers is very broad. They range from the tiny PICs and AVRs to PowerPC processors with inbuilt I/O, intended for embedded applications.
The most common I/O is digital I/O, commonly called general-purpose I/O, or GPIO. These are ports that may be configured by software, on a pin-by-pin basis, as either a digital input or digital output. As digital inputs, they may be used to read the state of switches or push buttons, or to read the digital status of another device. As outputs, they may be used to turn external devices on or off, or to convey status to an external device.
Many microcontrollers also have analog inputs, allowing sensors to be sampled for monitoring or recording purposes. Thus, an embedded computer may measure light levels, temperature, vibration or acceleration, air or water pressure, humidity, or magnetic field, to name just some. Alternatively, the analog inputs may be used to monitor simple voltages, perhaps to ensure the reliable operation of a larger system.
Some microcontrollers have serial ports, which enable the embedded computer to be interfaced to a host computer, a modem, another embedded system, or perhaps a simple network. Most microcontrollers have timers and counters. These may be used to generate internal interrupts at regular intervals for multitasking, to generate external triggers for off-chip systems, or to provide control pulses for motors. Alternatively, they may be used to count external triggers (pulses) from another system. A few microcontrollers also include network interfaces, such as USB, Ethernet, or CAN.