Friday, January 14, 2011

Resistive vs Capacitive touch screens


Capacitive touch screen: The capacitive touch screen is made up of a glass panel that is coated with a material.
The property of this material is that it can store electrical charge. So the capacitive touchscreens basically stores electrical charge.
But for good, Human body can also store charge. So, when you touch this screen with your finger, some of these charges on the screen gets transferred to your finger. The oscillator circuits located at the corner of your system will then sense this decrease in the charge on screen and the spot the exact location where touch occurred, and then transfers this specified information to the touchscreen driver software.

Example: iPhone series uses a Capacitive touch screen

Resistive touch screen: Resistive touch screen, on the other hand is again made up of normal glass panel. However, this glass panel in this case is coated with three layers.
Two of these layers being conductive and resistive are kept apart using spacers while the third scratch-resistant layer covers the whole setup

When the resistive touch screen system is running, current flows through these layers. On a finger touch, the two layers get connected and change in electrical field occurs. The system calculates the coordinates of point of contact and passes them to touch screen driver software.

Example: Nokia N97 uses a Resistive touch screen


Capacitive touch screen:

Pros:
  • Multi touch support available
  • Visibility good even in sunlight
  • Highly sensitive to finger touch leading to ease of use
  • Not prone to dust particles
  • Glossy look and feel
Cons:
  • Need to have atleast 5% humidity to achieve capacitive effect
  • More expensive than Resistive touch screen
  • Doesn't work with inanimate objects/fingernails/gloved fingers
  • Latest technology, may need to evolve a bit more!

Resistive touch screen:

Pros:

  • Relatively cheaper
  • Can operate with any pointing devices like stylus, pen, nail etc
  • Can operate at any level of humidity
  • Ease of use, as it could be used even with your winter gloves on!
  • Very useful for people using handwriting recongition system, due to ease of use with a stylus!
  • More accurate than capacitive touch screen!
  • Old technology and hence more reliable!
Cons:
  • Multi touch support not available. Though technology did evolve after some modifications with the existing resistive touch screen circuitry, its still not 100% developed yet!
  • Highly sensitive. As it can operate with almost any sort of pointing devices, can be more vulnerable with dust particles!
  • Poor visibility in sunlight, mostly due to multiple layers reflecting light!
  • Screen, being sensitive at the upper layer, can be more vulnerable to scratches!

Thursday, January 13, 2011

August 2007 - Comp Org & Soft Sys

------------------------------------------------------------------------------------------------------------------
 
What is the use of control memory? Differentiate between microinstruction sequencing and microinstruction execution.


------------------------------------------------------------------------------------------------------------------

Does disk striping improve I/O request rate performance compared to a comparable disk array without striping?
If a single I/O request consists of multiple logically contiguous strips, then up of 'n' strips of data can be handled in parallel, greatly reducing the I/O transfer time.

------------------------------------------------------------------------------------------------------------------
What is bus arbitration? What is the difference between synchronous and asynchronous bus.

------------------------------------------------------------------------------------------------------------------

Redundant Array of Independent Disks - RAID

The last ten years have witnessed a massive increase in the performance level of PC network workstations and servers. Electronic advances have enabled CPU and video performance to improve 50 to 100 times. However, mechanically bound disk I/O performance has become an ever increasing bottleneck. Disk I/O performance has only improved by about five times over the same period. This performance mismatch will only worsen as we implement ever more demanding applications such as image processing, CAD, database, and data acquisition.

Even more importantly, data reliability and availability must be assured as more and more mission critical applications migrate to LANs. Drive manufacturers have made great advances in disk reliability. The MTBF (Mean Time Between Failure) for these drives has also increased (although perhaps not as much as the marketing arms of the drive makers might like to claim). Even though the likelihood of a drive failure has decreased, many critical applications cannot afford any system downtime. Many corporations have found that implementing some form of data redundancy can help to guard against the risk of a drive failure.

Network administrators are continually seeking ways to improve system performance and reliability. One method of achieving these dual and often opposing goals is to use RAID (Redundant Array of Independent Disks) technology.

Why RAID?
Disk I/O is relatively slow because it is mechanical. A disk read or write involves two processes. First positioning the R/W head, and second transferring the information to/from the disk. Head positioning is limited by seek time and disk rotation to the start of the data (rotational latency). Data transfer occurs one bit at a time and is limited by the speed of rotation and the density of the data. One method that can be used to speed the transfer of data is to use many disks in parallel. For example, if a disk is capable of a given number of I/O transactions per second, then two disks are theoretically capable of twice that many. Similarly, if one disk can transfer a certain amount of data, then two disks acting together can transfer twice as much data. Additional disks would continue this increase in I/O capability until some other component of the computer system became the limiting factor.

System managers often try to accomplish this by manually spreading data among several disks so that each disk receives a somewhat equal share of the system load. 
This I/O tuning process can yield good results but is limited by two factors:
(1) It doesn’t speed the transfer of data for a single file; it only increases the number of files being accessed concurrently. And 
(2) system I/O demands change minute-to-minute; it is rarely perfectly balanced and certainly won’t stay that way over time.

A disk array can provide better performance because it automatically divides a read/write request among its member disks. For example, if a read/write request involved four 4KB blocks of data, then four disks operating in an array could theoretically provide four times the transfer rate of a single drive because each drive would only need to handle one block of data and they could each operate at the same time. In practice the total throughput would not be quite that high due to the overhead of managing four drives. Additionally, data redundancy can be built into a disk array, which protects against drive failure. It is this redundancy which creates a RAID array. And the different ways in which this redundancy can be achieved results in different levels of RAID. Each RAID level has benefits and tradeoffs, explained below.  

Parallel vs. Independent Access Arrays
Parallel Access Arrays. Parallel access arrays are arrays in which every member disk participates in every I/O operation. They provide a high data transfer rate because the data for any given read/write operation is spread among the member disks and is accessed simultaneously. The data transfer rate will be approximately equal (within 5%) to the sum of the transfer rates of the member disks. The disk I/O rate (number of individual read/writes per second) is similar to the I/O rate for a single disk, because the disks in a parallel access array work in unison to access only one block of data at a time. In other words, a parallel access array will access only one file at a time, but will do so at a very high transfer rate. Some implementations of parallel access arrays also require synchronized rotation of member disks. Disk synchronization requires disks that support this feature. RAID levels 2 and 3 are parallel access arrays.

Independent Access Arrays. Independent Access Arrays are arrays in which the member disks operate independently, even to the extent of satisfying multiple I/O requests concurrently. They provide a high disk I/O rate because each disk can be servicing a separate I/O request. The disk I/O rate will be approximately equal (within 5%) to the sum of the I/O rates of the member disks. The data transfer rate for a given block is the same as the transfer rate for a single disk because each block is stored on only one member disk. The total system transfer rate for an independent access array is similar to a parallel access array but may be split between several unrelated I/O requests. RAID levels 4 and 5 are independent access arrays. RAID levels 0 and 1 may be either parallel or independent but are usually implemented as independent arrays.

Which level is best
The best implementation depends on many factors, including cost, I/O transfer load, I/O transaction rate, and the ratio of reads to writes for you system. The following chart summarizes the characteristics of each level:

RAID Level 0
Very high transfer rate, but an increased risk of data loss
RAID Level 1
Very high data availability but incurs a 50% cost in storage space.
RAID Level 0 & 1
Both the benefits of level 0 and level 1—high transfer rate and high data availability—but incurs a 50% cost in storage space
RAID Level 2
not commonly used
RAID Level 3
Very high data transfer rate, I/O rate similar to that of a stand-alone disk at a cost of 1 drive
RAID Level 4
The read/modify/write cycle for the dedicated parity drive induces such a performance penalty that RAID level 5 is always a better choice for an independent access array
RAID Level 5
Transfer rate higher than that of a single device but lower than that of level 3, very high I/O transaction rate at a cost of 1 drive

A redundant storage system does not lessen the necessity for adequate system backups.
RAID levels greatly improve performance of disk storage systems. At the same time, greater data reliability and availability can be achieved. All at a reasonable cost.



Wednesday, January 12, 2011

August 2008 - Comp Org & Soft Sys

------------------------------------------------------------------------------------------------------------------

In the context of RAID what is the distinction between parallel access and independent access?
Parallel Access Arrays. Parallel access arrays are arrays in which every member disk participates in every I/O operation. They provide a high data transfer rate because the data for any given read/write operation is spread among the member disks and is accessed simultaneously. The data transfer rate will be approximately equal (within 5%) to the sum of the transfer rates of the member disks. The disk I/O rate (number of individual read/writes per second) is similar to the I/O rate for a single disk, because the disks in a parallel access array work in unison to access only one block of data at a time. In other words, a parallel access array will access only one file at a time, but will do so at a very high transfer rate. Some implementations of parallel access arrays also require synchronized rotation of member disks. Disk synchronization requires disks that support this feature. RAID levels 2 and 3 are parallel access arrays.

Independent Access Arrays. Independent Access Arrays are arrays in which the member disks operate independently, even to the extent of satisfying multiple I/O requests concurrently. They provide a high disk I/O rate because each disk can be servicing a separate I/O request. The disk I/O rate will be approximately equal (within 5%) to the sum of the I/O rates of the member disks. The data transfer rate for a given block is the same as the transfer rate for a single disk because each block is stored on only one member disk. The total system transfer rate for an independent access array is similar to a parallel access array but may be split between several unrelated I/O requests. RAID levels 4 and 5 are independent access arrays. RAID levels 0 and 1 may be either parallel or independent but are usually implemented as independent arrays.

------------------------------------------------------------------------------------------------------------------

What is the difference between EPROM, EEPROM and Flash memory? Explain in brief.

------------------------------------------------------------------------------------------------------------------

What are the advantages of memory mapped I/O over isolated I/O?
A memory mapped peripheral device is connected to the CPU's address and data lines exactly like memory, so whenever the CPU reads or writes the address associated with the peripheral device, the CPU transfers data to or from the device. This mechanism has several benefits and only a few disadvantages.


The principle advantage of a memory-mapped I/O subsystem is that the CPU can use any instruction that accesses memory to transfer data between the CPU and a memory-mapped I/O device. The MOV instruction is the one most commonly used to send and receive data from a memory-mapped I/O device, but any instruction that reads or writes data in memory is also legal. For example, if you have an I/O port that is read/write, you can use the ADD instruction to read the port, add data to the value read, and then write data back to the port. 

Of course, this feature is only usable if the port is a read/write port (or the port is readable and you've specified the port address as the source operand of your ADD instruction). If the port is read-only or write-only, an instruction that reads memory, modifies the value, and then writes the modified value back to memory will be of little use. You should use such read/modify/write instructions only with read/write ports (or dual I/O ports if such an operation makes sense). 

Nevertheless, the fact that you can use any instruction that accesses memory to manipulate port data is often a big advantage since you can operate on the data with a single instruction rather than first moving the data into the CPU, manipulating the data, and then writing the data back to the I/O port. 

The big disadvantage of memory-mapped I/O devices is that they consume addresses in the memory map. Generally, the minimum amount of space you can allocate to a peripheral (or block of related peripherals) is a four kilobyte page. Therefore, a few independent peripherals can wind up consuming a fair amount of the physical address space. Fortunately, a typical PC has only a couple dozen such devices, so this isn't much of a problem. However, some devices, like video cards, consume a large chunk of the address space (e.g., some video cards have 32 megabytes of on-board memory that they map into the memory address space). 

The advantage of an I/O address space is that peripheral devices mapped to this area do not consume space in the memory address space. This allows you to fully expand the memory address space with RAM or other memory. On the other hand, you cannot use arbitrary memory instructions to access peripherals in the I/O address space, you can only use the IN and OUT instructions. 


------------------------------------------------------------------------------------------------------------------

In virtually all systems that include DMA modules, DMA access to main memory is given higher priority than CPU access to main memory. Why?
Because the DMA runs slower than the processor and therefore potentially starves the processor of data which in turn wastes the processor resources (i.e. the processor becomes under utilised) and slows down the whole application. Furthermore, DMA requests are much less frequent than the CPU.  If the CPU were given priority, it would hog the access, preventing the DMA from ever making a request.  Secondly, I/O requests may have no buffer and data may be lost if the transfer is delayed.
------------------------------------------------------------------------------------------------------------------

Draw the state diagram of an instruction cycle with interrupts. Label all states clearly.



------------------------------------------------------------------------------------------------------------------

Tuesday, January 11, 2011

Cache Mapping and Associativity

A very important factor in determining the effectiveness of the level 2 cache relates to how the cache is mapped to the system memory. What this means in brief is that there are many different ways to allocate the storage in our cache to the memory addresses it serves. Let's take as an example a system with 512 KB of L2 cache and 64 MB of main memory. The burning question is: how do we decide how to divvy up the 16,384 address lines in our cache amongst the "huge" 64 MB of memory?

There are three different ways that this mapping can generally be done. The choice of mapping technique is so critical to the design that the cache is often named after this choice:

Direct Mapped Cache:
The simplest way to allocate the cache to the system memory is to determine how many cache lines there are (16,384 in our example) and just chop the system memory into the same number of chunks. Then each chunk gets the use of one cache line. This is called direct mapping. So if we have 64 MB of main memory addresses, each cache line would be shared by 4,096 memory addresses (64 M divided by 16 K).

Fully Associative Cache:
Instead of hard-allocating cache lines to particular memory locations, it is possible to design the cache so that any line can store the contents of any memory location. This is called fully associative mapping.

N-Way Set Associative Cache:
"N" here is a number, typically 2, 4, 8 etc. This is a compromise between the direct mapped and fully associative designs. In this case the cache is broken into sets where each set contains "N" cache lines, let's say 4. Then, each memory address is assigned a set, and can be cached in any one of those 4 locations within the set that it is assigned to. In other words, within each set the cache is associative, and thus the name.
This design means that there are "N" possible places that a given memory location may be in the cache. The tradeoff is that there are "N" times as many memory locations competing for the same "N" lines in the set. Let's suppose in our example that we are using a 4-way set associative cache. So instead of a single block of 16,384 lines, we have 4,096 sets with 4 lines in each. Each of these sets is shared by 16,384 memory addresses (64 M divided by 4 K) instead of 4,096 addresses as in the case of the direct mapped cache. So there is more to share (4 lines instead of 1) but more addresses sharing it (16,384 instead of 4,096).

Conceptually, the direct mapped and fully associative caches are just "special cases" of the N-way set associative cache. You can set "N" to 1 to make a "1-way" set associative cache. If you do this, then there is only one line per set, which is the same as a direct mapped cache because each memory address is back to pointing to only one possible cache location. On the other hand, suppose you make "N" really large; say, you set "N" to be equal to the number of lines in the cache (16,384 in our example). If you do this, then you only have one set, containing all of the cache lines, and every memory location points to that huge set. This means that any memory address can be in any line, and you are back to a fully associative cache.

Comparison of Cache Mapping Techniques
There is a critical tradeoff in cache performance that has led to the creation of the various cache mapping techniques described in the previous section. In order for the cache to have good performance you want to maximize both of the following:

Hit Ratio: You want to increase as much as possible the likelihood of the cache containing the memory addresses that the processor wants. Otherwise, you lose much of the benefit of caching because there will be too many misses.

Search Speed: You want to be able to determine as quickly as possible if you have scored a hit in the cache. Otherwise, you lose a small amount of time on every access, hit or miss, while you search the cache.

Now let's look at the three cache types and see how they fare:

Direct Mapped Cache:
The direct mapped cache is the simplest form of cache and the easiest to check for a hit. Since there is only one possible place that any memory location can be cached, there is nothing to search; the line either contains the memory information we are looking for, or it doesn't.
Unfortunately, the direct mapped cache also has the worst performance, because again there is only one place that any address can be stored. Let's look again at our 512 KB level 2 cache and 64 MB of system memory. As you recall this cache has 16,384 lines (assuming 32-byte cache lines) and so each one is shared by 4,096 memory addresses. In the absolute worst case, imagine that the processor needs 2 different addresses (call them X and Y) that both map to the same cache line, in alternating sequence (X, Y, X, Y). This could happen in a small loop if you were unlucky. The processor will load X from memory and store it in cache. Then it will look in the cache for Y, but Y uses the same cache line as X, so it won't be there. So Y is loaded from memory, and stored in the cache for future use. But then the processor requests X, and looks in the cache only to find Y. This conflict repeats over and over. The net result is that the hit ratio here is 0%. This is a worst case scenario, but in general the performance is worst for this type of mapping.

Fully Associative Cache:
The fully associative cache has the best hit ratio because any line in the cache can hold any address that needs to be cached. This means the problem seen in the direct mapped cache disappears, because there is no dedicated single line that an address must use.
However (you knew it was coming), this cache suffers from problems involving searching the cache. If a given address can be stored in any of 16,384 lines, how do you know where it is? Even with specialized hardware to do the searching, a performance penalty is incurred. And this penalty occurs for all accesses to memory, whether a cache hit occurs or not, because it is part of searching the cache to determine a hit. In addition, more logic must be added to determine which of the various lines to use when a new entry must be added (usually some form of a "least recently used" algorithm is employed to decide which cache line to use next). All this overhead adds cost, complexity and execution time.

N-Way Set Associative Cache:
The set associative cache is a good compromise between the direct mapped and set associative caches. Let's consider the 4-way set associative cache. Here, each address can be cached in any of 4 places. This means that in the example described in the direct mapped cache description above, where we accessed alternately two addresses that map to the same cache line, they would now map to the same cache set instead. This set has 4 lines in it, so one could hold X and another could hold Y. This raises the hit ratio from 0% to near 100%! Again an extreme example, of course. As for searching, since the set only has 4 lines to examine this is not very complicated to deal with, although it does have to do this small search, and it also requires additional circuitry to decide which cache line to use when saving a fresh read from memory. Again, some form of LRU (least recently used) algorithm is typically used.

Here's a summary table of the different cache mapping techniques and their relative performance:


Cache Type
Hit Ratio Search Speed
Direct Mapped Good Best
Fully Associative Best Moderate
N-Way Set Associative Very Good, Better as N Increases Good, Worse as N Increases