IB Computer Science/Further System Fundamentals
Return to IB Computer Science
Further System Fundamentals edit
Processor configuration edit
Instruction Register edit
An Instruction Register is the part of a CPUs control unit (as seen below) that stores an instruction. The bits of the instruction register are decoded by a microprogram that controls the computer.
An Accumulator is a register within the ALU (as seen below). It temporarily stores the data from an arithmetical or logical operation, and then writes it to main memory or to another, non-accumulator CPU register (depending on what it is told to do).
Program Counter edit
A Program Counter is a register located in the CPU (as seen below). It is used to hold the address of the next instruction to be fetched from the immediate access memory for execution by the computer.
Magnetic Disk Storage edit
The most common physical device for storing files is the magnetic disk. A magnetic disk has one or more platters in the form of disks, covered with magnetic media. Hard disk platters are made of rigid metal, while floppy disks are made of more flexible plastic. Each platter on the magnetic disk has two working surfaces. Older hard disk drives would sometimes not use the very top or bottom surface of a stack of platters because they were more likely to be damaged.
The surface of a platter is organized as a number of round rings, called tracks. The group of tracks immediately above one another (as seen in the diagram below) is called a cylinder.
Furthermore, each track is divided into sectors. The information held in one sector, a block, is the unit of transfer between the disk and primary memory (normally 4K bytes or so). The operating system determines where the blocks for each file are placed.
The data on a magnetic disk is read by read-write heads. The standard configuration (as seen below) uses one head per surface, each on a separate arm, and controlled by a common arm assembly which moves all heads simultaneously from one cylinder to another.
The rate at which data can be transferred from the disk to the computer is composed of 3 different steps:
|Seek time||The time to move the heads to the right track.|
|Latency (rotational delay)||The time waiting for the sector to come round to the head.|
|Block transfer time||Time it takes to actually transfer the data.|
All these times are of the order of tens of milliseconds. The seek time and latency time vary, depending on where the required block is relative to the current position of the heads. It's useful to put all the blocks of a file on one track, to minimize seek times and latencies in accessing the file. Likewise, for a larger file, it's a good idea to have it all on the same cylinder (a set of corresponding tracks on different platters). There are many other placement tricks (such as placing heavily used files on the middle tracks so that the average seek time is reduced). However, since files are of varying sizes, and can change size dynamically, it's not usually possible to place the blocks optimally. 
Headline text edit
Operating systems and utilities edit
Further network fundamentals edit
Computer/peripheral communication edit
The definition of handshaking is described as when one computer is establishing a connection between the other computer or any other device that wants to connect to the computer. The handshake can be brought down into steps such as it will verify the connection, the speed and the authorization of the computer that it is trying to connect to. Example: When a modem connects to another modem, the dialling is the handshake between them. Modem handshakes can be muted by going to the control panel.  
The port connection is commonly found behind the back of the computer it usually resembles a plug-in. Hardware ports allows it to access to external devices. Such as USB, printers, mouse.
When referring to the internet or the network, a network port is a location where the information is sent. A more commonly used port is the http which is port 80. Which is commonly known as the Virtual Port.
A common way to manage a transfer is to provide a status in bits, which will be sent to a secondary input port. An example would be, a one in a single bit can tell the CPU that the printer is ready to take in more data. If a zero appears it would tell the CPU that the printer is busy therefore the CPU should not send any new data just yet. Another example would be if one bit in a different port could tell the CPU that a keystroke is hit and it is available at the data port. If the zero is shown it means that there was no keyboard stroke.
Virtual Port edit
A virtual port is an emulation of the serial port. The port can be created by a software which will enable extra ports in the system. A virtual port can be given any name (COM1337, VSP11, etc). There can be an unlimited number of virtual ports in your PC. The more ports the less computer performance it has.
Virtual ports copy all hardware serial port functionality, including Baud rate, Data bits, Parity bits, Stop bits, etc. They control the data flow, copying all signal lines (DTR/DSR/CTS/RTS/DCD/RI) and customizing pinout. A common virtual port is Bluetooth. A virtual port can be useful if there are less physical ports on the computer. Another use of a virtual port is to communicate with other serial devices via the internet or LAN and act as if they were connected together. Such examples can be found in applications such as Hamachi and Garena. Links: [www.garena.com], [www.hamachi.com] 
A buffer is a part of the memory used to hold temporarily data while it is moved from one place to another. The data is stored in a buffer which will then be received from an input device such as a keyboard to an output device such as a printer. When a data is moving between processes in a computer a buffer is also used. This can be related to buffers in telecommunication. Buffers can be found in a hardware or software but it is mostly implemented in software. If the data that is being transferred has a different rate at which it is received and processed, then the buffers are typically used in a scenario such as this. Buffers are in a combination with the I/O to hardware, such examples are the disk drives, sending and receiving data from one place to another, or playing sound on a speaker.
Buffer and the Cache edit
Some cache acts like a buffer. But it is not exactly the same, a cache operates on the premise that the same datum (plural for data) will be read from multiple times. The purpose of a cache is to reduce accesses to slower storage. A Cache is an abstraction layer meaning that it is a way of hiding the details of a particular set of functionality. Such as the OSI 7 Layer Model. A OSI 7 Layer Model
Data Transfer edit
Computers always need to transfer data with other external devices (Input/Output devices). There are two different ways for transferring the data between computer memory and external devices:
PIO (Programmed I/O) is a method in which processor keeps on reading or writing on a memory unit (8-bits, 16-bits or 32-bits, depending on the device interface) until the data transferring is completed. Obviously this method consumes a large amount of processor cycles. There are several different speeds of PIO, knows as programmed I/O modes, or more commonly, PIO modes. Table below shows five different PIO modes:
|PIO Mode||Cycle Time (nanoseconds)||Maximum Transfer Rate (MB/s)||Defining Standard|
PIO was the only method for transferring the data between devices and IDE/ATA hard disks through the mid 90s. Three lower-speed modes (Mode 1, Mode 2, Mode 3) were defined as part of the original ATA standards document; two more (Mode 4, Mode 5) were added as part of ATA-2 (as well as part of several unofficial standards.)
Direct Access Memory edit
DAM (Direct Access Memory) is a capability that allows the data on an external attached device (such as a Disk Drive) to be sent directly to the computer's memory on the motherboard. In DMA method the system issues an I/O command to the device, initiate a DMA transaction and then place the process in a waiting queue and the processor will be free afterwards to do other transmissions or execute codes. The DMA controller will inform the system when its current operation has been completed by issuing an interrupt signal. Although the data is still transferred 1 memory unit at a time from the device, the transfer to main memory now circumvents the CPU because the DMA controller can directly access the memory unit.
Let's go more in depth!
As it was mentioned in DMA method the processor is not involved during the whole transmission; but it only initiates the transmission and after that the data can be transferred directly from or to the main memory. But how do the CPU do that?
To initiate a transmission the processor should load three different values into three different registers in the DMA controller. These values are:
1- identity of the source device
2- the location in memory where the data transfer begins
3- the number of bytes to be transferred
The DMA controller then collaborates with the IO unit using the control lines on the bus to perform the handshaking protocol for managing the data transfer. When the transfer is complete, the DMA notifies the CPU via an interrupt. With the DMA, data does not pass through the CPU registers, but directly along the bus from source to destination.
Direct Access Memory edit
Direct memory access also known as DMA is a feature of modern computers. Within certain computers the hardware subsystems has its access system memory which is used for reading and/or writing independently of the central processing unit(CPU). Many systems use DMA, such example could include disk drive controllers, graphics cards, network cards, and sound cards. Computers that have DMA can transfer data from devices with less CPU overhead than computers without a DMA channel.
Without the DMA the CPU would be fully occupied for the entire duration of the read and write operation and it would not be able to do any other work. The DMA can start transfer, operate programs, and receive and interrupt from the DMA controller. Which can be useful to real-time computing.
Can you please vote and tell us which definition for "Direct Access Memory" is more clear to you? You can respond in the discussion section.
Polling and Interrupts edit
One of the duties of the processor in the computers is to manage the devices and programs and since there are many devices connected to the processor and also so many programs (those are running on the OS) the processor needs to be able to figure out what should it do in each moment. Two different ways of doing this are Polling and using Interrupts.
Polling is a method in which the processor checks every single device's current status in a loop and looking for data. When new data is available on one of devices it can then read the data and process the incoming bytes.
However this method can work to manage the devices and programs, there are some big problems with it. First, the processor would always be busy with checking all the devices and programs instead of processing data and executing some useful codes. Second, in this method it is very likely that some of arriving bytes are lost when the rate of transfer data is too high.
An Interrupt is a signal from a device attached to the computer or a program that is sent to the OS (Operating System) and causes it to stop and figure out what to do next. Interrupts initiated by hardwares are called Hardware Interrupts while the interrupts that have been made by programs are called Software Interrupts, traps or exceptions. An average PC supports 16 hardware interrupts and 256 software interrupts. Each type of exception (Software Interrupt) is associated with a routine that takes control when an interrupt occurs. This routine is called Interrupt Handler.
An Actual interrupt that is sent to the processor is called an IRQ (Interrupt Request). Each IRQ is a binary code that differs from other interrupts and the processor uses these binary codes to distinct different interrupts. However these interrupts may be different for each device and processor but they usually follow a standard. The typical Hardware Interrupts have been shown in the table below:
|IRQ Number||Binary code||Typical Use||Description|
|IRQ 0||00000000||System timer||This interrupt is reserved for the internal system timer. It is never available to peripherals or other devices.|
|IRQ 1||00000001||KeyBoard||This interrupt is reserved for the keyboard controller. Even on devices without a keyboard, this interrupt is exclusively for keyboard input.|
|IRQ 2||00000010||Cascade interrupt for IRQs 8-15||This interrupt cascades the second interrupt controller to the first.|
|IRQ 3||00000011||Second serial port (COM2)||The interrupt for the second serial port and often the default interrupt for the fourth serial port (COM4).|
|IRQ 4||00000100||First serial port (COM1)||This interrupt is normally used for the first serial port. On devices that do not use a PS/2 mouse, this interrupt is almost always used by the serial mouse. This is also the default interrupt for the third serial port (COM3).|
|IRQ 5||00000101||Sound card||This interrupt is the first choice that most sound cards make when looking for an IRQ setting.|
|IRQ 6||00000101||Floppy disk controller||This interrupt is reserved for the floppy disk controller.|
|IRQ 7||00000110||First parallel port||This interrupt is normally reserved for the use of the printer. If a printer is not being used, this interrupt can be used for other devices that use parallel ports.|
|IRQ 8||00000111||Real-time clock||This interrupt is reserved for the system's real-time clock timer and can not be used for any other purpose.|
|IRQ 9||00001001||Free||This interrupt is typically left open on devices for the use of peripherals.|
|IRQ 10||00001010||Free||This interrupt is typically left open on devices for the use of peripherals.|
|IRQ 11||00001011||Free||This interrupt is typically left open on devices for the use of peripherals.|
|IRQ 12||00001100||PS/2 mouse||This interrupt is reserved for the PS/2 mouse on machines that use one. If a PS/2 mouse is not used, the interrupt can be used for other peripherals, such as network card.|
|IRQ 13||00001101||Floating point unit/coprocessor||This interrupt is reserved for the integrated floating point unit. It is never available to peripherals or other devices as it is used exclusively for internal signaling.|
|IRQ 14||00001110||Primary IDE channel||This interrupt is reserved for use by the primary IDE controller. On systems that do not use IDE devices, the IRQ can be used for another purpose.|
|IRQ 15||00001111||Secondary IDE channel||This interrupt is reserved for use by the secondary IDE controller.|
When one of the Input or Output devices sends an interrupt to the CPU, before the processor catches it, that IRQ goes through a chip called PIC (Programmable Interrupt Controller). The PIC selects an IRQ from the highest priority device to pass to the CPU and if the processor is ready to accept that IRQ, the PIC sends it to the CPU. The processor has a flag that illustrates whether or not it is ready to accept IRQs. If the CPU catches the request (because as it was mentioned it can also ignore a request) it temporary stops what it is currently doing and executes the proper code related to that request. When the ISR is completed, the CPU returns to the program it was executing and resumes its previous task.
How to find out your PC IRQs?
In order to find the IRQs of your devices in windows, open the device manager (you can either right click on MyComputer -Or Computer in Windows Vista- and then click on properties. Then Click on the Device manager. Or simply search for device manager in your computer). Right click on any device and in the form that is opened go to the Resources tab and look at the binary code in fromt of IRQ.
For most distributions this will work:
# dmesg | grep irq
|Comparison between polling and interrupt systems|
|As it was mentioned, in the polling systems the processor should check the status of all of the devices (and programs those are running on the OS) in a loop to see what should it do next; while in a system which uses interrupts, the processor does not need to keep checking all of the devices and programs, but every device sends a signal to the processor whenever it needs. Obviously in the first method the CPU is always busy with checking the devices and therefore it has less power to execute useful codes and process data. another disadvantage with this method is that a device or program which wants to interact with processor should wait until the processor finishes the loop and turn to that specific device or program. while in interrupt systems, the client sends a signal (i.e. a byte) and informs the processor. as the result the speed of communication between clients and the processor will speed up in the systems those are using interrupts.|
Serial and Parallel Transmission edit
Data are transmitted through a communications medium, they are either sent in serial or in parallel transmission. Most of the owners of microcomputers know that their computers are equipped with serial and parallel ports. In which it will enable the computer to transmit both serial and parallel signals.
In both of the series, the bytes that are sent are sent along a medium. For example if it would send “SYAMIL”, it would sent the “S” first, then “Y” then “A” and so on this goes for serial. As for parallel transmission, they are sent separately, the parallel paths correspond to each bit of a byte so that all of the bits would arrive simultaneously.
Since parallel is more efficient then serial, it would need more wiring and extra bit paths, besides that it is more expensive then serial. Devices that are located near each other usually will use a serial transmission. For example, a parallel transmission computer would send a word document to a printer that it is connected to. 
- Irvine, Kip R. (2007). Assembly Language for Intel-Based Computers (5th edition ed.). Pearson Prentice Hall. pp. pp. 633, 622. ISBN 0-13-238310-1.
|edition=has extra text (help);
|pages=has extra text (help)
- Hutchinson Encyclopaedia. Helicon Publishing LTD 2008.
- Magnetic disk storage
- Mass-Storage Structure
- "Handshaking." <http://www.mrhope.com/jargon/h/handshak.htm>.
- "Handshaking." <http://webster.cs.ucr.edu/AoA/Windows/HTML/IOa3.html>.
- "Virtual Port." <www.ftdichip.com/Drivers/VCP.htm>.
- The 8237 DMA Controller
- DMA – Direct Memory Access
- Sunsite 
- BroadBand 
- Interrupt Control
- "Serial and Parallel Transmission." <http://www.blurtit.com/q511025.html>.