Data Storage. Without a memory no information can be stored or retrieved in a computer. Computer memory has experienced a similar increase along a different dimension. While processing speed increases at the same rate that memory size increases, the gap between the speed of the processor and the speed of memory also increases. As the gap between processor and memory speeds grows, architectural solutions help bridge the gap. A typical computer contains several types of memory, ranging from fast, expensive internal registers, to slow, inexpensive removable disks. The interplay between these different types of memory is exploited so that a computer behaves as if it has a single, large, fast memory, when in fact it contains a range of memory types that operate in a highly coordinated fashion. Memory Hierarchy Memory in a conventional digital computer is organized in a hierarchy as illustrated in Figure 5. At the top of the hierarchy are registers that are matched in speed to the CPU, but tend to be large and consume a significant amount of power. There are normally only a small number of registers in a processor, on the order of a few hundred or l ess. At the bottom of the hierarchy are secondary and offline storage memories such as hard magnetic disks and magnetic tapes, in which the cost per stored bit is small in terms of money and electrical power, but the access time is very long when compared with registers. Between the Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks registers and secondary storage are a number of other forms of memory that bridge the gap between the two. Cache and main memory are built using solidstate semiconductor material. It is customary to call the fast memory level the primary memory. The solidstate memory is followed by larger, less expensive, and far slower magnetic memories that consist typically of the (hard) disk and the tape. It is customary to call the slower level the secondary memory. The objective behind designing a memory hierarchy is to have a memory system that performs as if it consists entirely of the fastest unit and whose cost is dominated by the cost of the slowest unit. External Storage: External storage is normally the place where programs and data are stored when the power is turned off. This type of memory used for largeFigure 5: The memory hierarchy. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks term memory storage than internal memory. The most common external storage devices are tape and disk devices. External memory operates at much slower speed than internal memory and it stores programs and data that are not currently being used by the CPU. External storage is also known as secondary storage or auxiliary storage. External storage devices can be classified either mechanical or magnetic:1. Mechanical storage devices: are punched paper card and punched paper tape. Both of these are less popular now than in the past. 2. Magnetic storage devices: This device store information as magnetic spots on oxide surfaces. It used now in the personal computer systems. Because the magnetic spots do not need a constant supply of power to “ refresh “ themselves ( as most RAM chips do ), external storage units provides nonvolatile storage. Also, external storage is cheaper per unit of storage than the internal memory. The Three most common forms of magnetic media used on personal computer systems are Magnetic tapes, floppy disks, and hard disks. All of these can be erased and rerecord again and again. As new information is written, it automatically covers up whatever was there before. To avoid accident erasure, both cassette tapes and floppy disks can be writeprotected. Tape recorders and floppy disk drives will not write on writeprotected media. Most hard disks cannot be write protected. The tape or disk drive reads and writes on tapes and disks by moving them past a read/write head. The head reads their magnetized Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks surfaces, converting the information into electrical impulses that it sends to the computer and vice versa. 1 Magnetic Tapes: Magnetic tape has been widely used for many years as external storage. It is quite cheaper. A magnetic tape unit typically has a single read / write head, but may have separate heads for reading and writing. The main disadvantage of Magnetic tape is that they are sequential access storage devices. That is, to find information on the tape you must search through the tape sequentially. Which means that to read the last item on a tape, you must wind the tape ( using Magnetic recorder ) past all the previous items. The time it takes to begin reading the desired information from a storage device is called the device’s accesstime. A Magnetic tape recorder has poor access times because it can take several minutes to get to the right spot on the tape. The rate at which data are read once an information transfer has begun is the data transfer rate. Standard Magnetic tape recorders have an effective data transfer rate between 300 and 1500 bits per second. For example, at a rate of 500 bits per second, it takes more than five minutes to load a 16k bits file into internal memory. Information is stored on a tape in two dimensional fashion, as shown in Figure 6. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks Bits are stored across the width of the tape in frames and along the length of the tape in records. A file is made up of a collection of (typically contiguous) records. A record is the smallest amount of data that can be read from or written to a tape. The combination of sequential storage and slow data transfer makes Magnetic tape unsuitable for most practical applications of PC. 2 Hard disks: A hard disk is a device for storing information that supports a large storage density and a relatively fast access time. A moving head hard disk drive is composed of a stack of one or more platters that are spaced several millimeters apart and are connected to a spindle, as shown in Figure 7. Each platter has two surfaces made of aluminum or glass, which are coated with small particles of a magnetic material such as iron oxide, which is the essence of rust. This is why disk platters, floppy diskettes, audio tapes, and other magnetic media are brown. Binary 1’s and 0’s are stored by magnetizing small areas of the material. Figure 5: A magnetic disk with three platters. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks A single head is dedicated to each surface. Six heads are used in the example shown in Figure 7, for the six surfaces. The top surface of the top platter and the bottom surface of the bottom platter are sometimes not used on multiplatter disks because they are more susceptible to than the inner surfaces. The heads are attached to a common arm (also known as a comb) which moves in and out to reach different portions of the surfaces. In a hard disk drive, the platters rotate at a constant speed of typically 3600 to 10,000 revolutions per minute (RPM). The heads read or write data by magnetizing the magnetic material as it passes under the heads when writing, or by sensing the magnetic fields when reading. Only a single head is used for reading or writing at any time, so data is stored in serial fashion even though the heads can in principle be used to read or write several bits in parallel. One reason that the parallel mode of operation is not normally used is that heads can become misaligned, which corrupts the way that data is read or written. A single surface is relatively insensitive to the alignment of the corresponding head because the head position is always accurately known with respect to reference markings on the disk. A single surface contains several hundred concentric circles (called tracks) of data from the inside to the outside edge of the disk, which in turn are composed of sectors of typically 512 bytes in size, stored serially, as shown in Figure 8. Each sector is a pieshaped wedge of one track. The sectors are spaced apart by intersector gaps, and the tracks are spaced apart by intertrack gaps, which simplify positioning of the head. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks A set of corresponding tracks on all of the surfaces forms a cylinder. For instance, track 0 on each of surfaces 0, 1, 2, 3, 4, and 5 in Figure 7 collectively form cylinder 0. The number of bytes per sector is generally invariant across the entire platter. Disk drive capacities and speeds: If a disk has only a single zone, its storage capacity, C, can be computed from the number of bytes per sector, N, the number of sectors per track, S, the number of tracks per surface, T, and the number of platter surfaces that have data encoded in them, P, with the formula: C=N*S*T*P. A highcapacity disk drive may have N = 512 bytes, S = 1,000 sectors per track, T = 5,000 tracks per surface, and P = 8 platters. The total capacity of this drive is C = 512 bytes/sector *1000 sectors/track *5000 tracks/surface *8 platters *2 surfaces/platter or 38 GB. Maximum data transfer speed is governed by three factors: the time to move the head to the desired track, referred to as the head seek time, the time for the desired sector to appear under the read/write head, known as the rotational latency, and the time to transfer the sector from the disk Figure 8: Organization of a disk with a 1:2 interleave factor. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks platter once the sector is positioned under the head, known as the transfer time. Transfers to and from a disk are always carri ed out in complete sectors. Partial sectors are never read or written. A sector is the smallest unit of information sent between the disk drive and the CPU. 3 Floppy disks: Unlike Magnetic tape devices, floppy disk systems are random access storage devices, there read/write heads can move in and out to quickly access information on any part of the disk. The disk drive is the unit that reads and writes on the floppy disk A floppy disk, or diskette, contains a flexible plastic platter coated with a magnetic material like iron oxide. Although only a single side is used on one surface of a floppy disk in many systems, both sides of the disks are coated with the same material in order to prevent warping. Access time is generally slower than a hard disk because a flexible disk cannot spin as quickly as a hard disk. The rotational speed of a typical floppy disk mechanism is only 300 RPM, and may be varied as the head moves from track to track to optimize data transfer rates. Such slow rotational speeds mean that access times of floppy drives are 250300 ms, roughly 10 times slower than hard drives. Capacities vary, but range up to 1.44 MB. Floppies are inexpensive because they can be removed from the drive mechanism and because of their small size. The head comes in physical contact with the floppy disk but this does not result in a head crash. It does, however, place wear on the head and on the media. For this reason, floppies only spin when they are being accessed. The amount of information stored on floppy disk depends on four factors: 1) The number of tracks. Lec. (4) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks 2) The number of sectors per track. 3) The number of bytes stored in each sector. Doubledensity disks store twice as many bytes in the same size sector as singledensity disks. 4) Whether data is written on one or both sides of the disk, that is, whether storage is single or double sided. 25 2 16 = 65.536 2 20 = 1.048.576 2 24 = 16.777.216 A binary number is a string of 1s and 0s, each indicating the presence or absence of a power of two. For example, consider the binary number 101. This number is converted to its decimal equivalents as follows: binary number 0 0 0 0 0 1 0 1 power of two 7 6 5 4 3 2 1 0 decimal number 0 0 0 0 0 4 0 1 101 binary = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) = (1×4) + (0×2) + (1×1) = 4 + 0 + 1 = 5 decimal Thus, 101 is the binary number representation of the decimal number 5. In a binary number such 101.1 the fractional number part is a sum of negative powers of 2. For example, 101.1 binary is converted to its decimal equivalent as follows: 101.1 binary = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) + (1×2 1 ) = (1×4) + (0×2) + (1×1) + (1×(1/2)) = 4 + 0 + 1+ 1/2 = 5.5 decimal Keep in mind that computers work exclusively with binary numbers because they can store only either a 1 or a 0. To do arithmetic and word processing they must convert from binary to decimal and back again. In the binary system, using n bits, we can represent numbers from 0 through (2 n 1) for a total of 2 n different values. We need m bits to represent X different values, where for example, 150 different values can be represented by using 26 In fact, using 8 bits, we can represent 2 8 =256 different values (i.e., from 0 through 255). 6 Basic Terms and Notation. The alphabet of computers, more precisely digital computers, consists of 0 and 1. Each is called a bit, which stands for the binary digit. The term byte is used to represent a group of 8 bits. The term word is used to refer to a group of bytes that is processed simultaneously. The exact number of bytes that constitute a word depends on the system. For example, in the Pentium, a word refers to four bytes or 32 bits. We use the abbreviation “b” for bits, “B” for bytes, and “W” for words. Sometimes we also use doubleword and quadword. A doubleword has twice the number of bits as the word and the quadword has four times the number of bits in a word. 2bit ? 2^2 = 4 possible states (00, 01, 10, 11) 3bit ? 2^3 = 8 possible states (000,   , 111) 8bit ?2^8 = 256 possible states (00000000,    , 11111111) Bits in a word are usually ordered from right to left, as you would write digits in a decimal number. The rightmost bit is called the least significant bit (LSB), and the leftmost bit is called the most significant bit (MSB). We use standard terms such as kilo (K), mega (M), giga (G), and so on to represent large integers. Unfortunately, we use two different versions of each, depending on the number system, decimal or binary. Table 1 summarizes the differences between the two systems. Typically, computerrelated attributes use the binary version. For example, when we say 128 megabyte (MB) memory, we mean 128×2 20 bytes. Usually, communicationrelated quantities and time units are expressed using the decimal system. For example, when we say that the data transfer rate is 100 megabits/second (Mb/s), we mean 100×10 6 Mb/s. 27BASIC COMPUTER OPERATIONS A computer as shown in Fig. 2.1 performs basically five major operations or functions irrespective of their size and make. These are 1) it accepts data or instructions by way of input, 2) it stores data, 3) it can process data as required by the user, 4) it gives results in the form of output, and 5) it controls all operations inside a computer. We discuss below each of these operations. 1. Input: This is the process of entering data and programs in to the computer system. You should know that computer is an electronic machine like any other machine which takes as inputs raw data and performs some processing giving out processed data. Therefore, the input unit takes data from us to the computer in an organized manner for processing. Fig. 2 Basic computer Operations 2. Storage: The process of saving data and instructions permanently is known as storage. Data has to be fed into the system before the actual processing starts. It is because the processing speed of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed. Therefore the data is first stored in the storage unit for faster access and processing. This storage unit or the primary storage of the computer system is designed to do the above functionality. It provides space for storing data and instructions. Lec. (3) Computer Fundamentals 1 st stage College of Computer Technology Dept.Information Networks 22 The storage unit performs the following major functions: ? All data and instructions are stored here before and after processing. ? Intermediate results of processing are also stored here. 3. Processing: The task of performing operations like arithmetic and logical operations is called processing. The Central Processing Unit (CPU) takes data and instructions from the storage unit and makes all sorts of calculations based on the instructions given and the type of data provided. It is then sent back to the storage unit. 4. Output: This is the process of producing results from the data for getting useful information. Similarly the output produced by the computer after processing must also be kept somewhere inside the computer before being given to you in human readable form. Again the output is also stored inside the computer for further processing. 5. Control: The manner how instructions are executed and the above operations are performed. Controlling of all operations like input, processing and output are performed by control unit. It takes care of step by step processing of all operations in side the computer. Data representation. The basic building block of personal computers is the transistor. A transistor is an electronic device for controlling the flow of electrons in an electrical circuit. If electrons are allowed to flow, the circuit is on; conversely, if electrons are not allowed to flow, the circuit is off. Thinking of a transistorized circuit as a switch like a light switch at a home. The switch is either on or off and stays that way until it is flipped again. When a circuit is on, we say it is in the marking state and assign a 1 to it. Conversely, when it is off, we assign a 0 to it. A modern digital computer is often said to be a binary computer because its most basic circuits can remember either one of two states: 0 and 1. The binary digits 0 and 1 are called bits. Both the internal and external memory of computer are nothing more than storehouses for bits. Numbers systems. The number systems that we discuss here are based on positional number systems. The decimal number system that we are already familiar with is an example of a positional number system. In contrast, the Roman numeral system is not a positional number system. Every positional number system has a radix or base, and an alphabet. The base is a positive number. For example, the decimal system is a base10 system. The 23 number of symbols in the alphabet is equal to the base of the number system. The alphabet of the decimal system is 0 through 9, a total of 10 symbols or digits. There are four number systems that are relevant in the context of computer systems and programming. These are the decimal (base10), binary (base2), octal (base8), and hexadecimal (base16) number systems. Digits Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 System Base Possible digits Binary 2 0 1 Octal 8 0 1 2 3 4 5 6 7 Decimal 10 0 1 2 3 4 5 6 7 8 9 Hexadecimal 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Note Computers internally use the binary system. The remaining two number systems—octal and hexadecimal—are used mainly for convenience to write a binary number even though they are number systems on their own. We would have ended up using these number systems if we had 8 or 16 fingers instead of 10. 24 In a positional number system, a sequence of digits is used to represent a number. Each digit in this sequence should be a symbol in the alphabet. There is a weight associated with each position. If we count position numbers from right to left starting with zero, the weight of position n in a base b number system is b n . For example, the number 579 in the decimal system is actually interpreted as (Of course, 10 0 =1). In other words, 9 is in unit’s place, 7 in 10’s place, and 5 in 100’s place. Binary System: The key to understanding computers is the binary number system. The binary number system has only two digits: 0 to 1. Just as decimal notation is based on places that represent powers of ten, binary notation is based on power of two. For example, the decimal number 537 is really the sum of powers of ten: 537= (5×10 2 ) + (3×10 1 ) + (7×10 0 ) = (5×100) + (3×10) + (7×1) = 500 + 30 + 7 = 537 Binary numbers are sums of powers of two in the same way that decimal numbers are sums of powers of ten. The following table shows the decimal numbers represented by some of more important powers of two in personal computing: 2 2 = 0.25 2 1 = 0.5 2 0 = 1 2 1 = 2 2 2 = 4 2 3 = 8 2 4 = 16 2 5 = 32 2 6 = 64 2 7 = 128 2 8 = 256 25 2 16 = 65.536 2 20 = 1.048.576 2 24 = 16.777.216 A binary number is a string of 1s and 0s, each indicating the presence or absence of a power of two. For example, consider the binary number 101. This number is converted to its decimal equivalents as follows: binary number 0 0 0 0 0 1 0 1 power of two 7 6 5 4 3 2 1 0 decimal number 0 0 0 0 0 4 0 1 101 binary = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) = (1×4) + (0×2) + (1×1) = 4 + 0 + 1 = 5 decimal Thus, 101 is the binary number representation of the decimal number 5. In a binary number such 101.1 the fractional number part is a sum of negative powers of 2. For example, 101.1 binary is converted to its decimal equivalent as follows: 101.1 binary = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) + (1×2 1 ) = (1×4) + (0×2) + (1×1) + (1×(1/2)) = 4 + 0 + 1+ 1/2 = 5.5 decimal Keep in mind that computers work exclusively with binary numbers because they can store only either a 1 or a 0. To do arithmetic and word processing they must convert from binary to decimal and back again. In the binary system, using n bits, we can represent numbers from 0 through (2 n 1) for a total of 2 n different values. We need m bits to represent X different values, where for example, 150 different values can be represented by using 26 In fact, using 8 bits, we can represent 2 8 =256 different values (i.e., from 0 through 255). 6 Basic Terms and Notation. The alphabet of computers, more precisely digital computers, consists of 0 and 1. Each is called a bit, which stands for the binary digit. The term byte is used to represent a group of 8 bits. The term word is used
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
