Categories
computer architecture

Synchronous processors

Imagine a processor with no interrupts. We can do a lot better and get rid of most exceptions (e.g. system calls, page faults etc.), most peripheral devices/buses, and even cache misses, but let’s start with interrupts. Modern micro-processors are bloated with circuitry that is designed to allow the precious CPU to switch back and forth between streams of code because cpu cycles were the scarcest resource. That was a great idea in the 1950s. But interrupts are expensive in compute time, circuit complexity, and chip area. Interrupts  take microseconds to start processing – which is an eternity on a Ghz processor.  And they solve a problem that does not exist anymore: we have a lot of processor cores. In fact, one problem faced by computer architects is that it’s not easy to exploit parallel processing if you keep thinking in terms of 1950s computer architecture.

Suppose you have 32 cores and you make one or two of them poll I/O devices and the other 30 never get I/O interrupts, never run interrupt handling code, never have to save and restore state or context switch due to I/O interrupts.  What they do is run application code to completion or for a specified number of cycles or clock ticks. The cores reserved for the operating system manage all devices and even they don’t need interrupts because they can run a real-time OS that polls devices.

Suppose we have 100 devices and flags on device registers to indicate whether the device needs attention. We’d probably want devices to be able to do DMA (but see below). The polling software might just cycle through in arbitrary order or in order of priority or to optimize some function.

For an x86 type processor: throw away the IOAPIC,  IOAPIC bus, the APIC on each core, the logic for unwinding the pipeline on an interrupt, the processor interrupt level logic. And then contemplate the layers of interrupt virtualization in modern processors. We could have a simple cycle timer switch on each core so that after the timer expires there is an interrupt-like jump to a function to see what to do next. That jump would be perfectly synchronous since predicting the next jump can be done with 100% accuracy (or nearly 100%). (added 2022 note. One method as noted in Ycombinator discussion is to have the core do a pseudo-fetch of a jump to some designated place – maybe the OS scheduling code in some protected memory or even to the new co-routine/process. There could be multiple such timers with different jump targets or even different flavors of jump ).

Once I/O interrupts go away, radical redesign of peripheral devices starts to seem sensible. Instead of putting an embedded computer on an Ethernet adapter card or chip, let’s use one of our I/O cores which already can access memory and knows how to get data to the right processes or OS components. Current OS offload ends up recreating the same bottlenecks on the adapter, but the OS cores don’t have the same problems.  The adapter can be simplified and optimized for speed and error correction.  A hardware fifo of addresses for TX and RX queues perhaps: header, payload start, payload end, condition code. The OS core software has to keep TX queue from sitting idle and the RX queue from overflowing. RDMA is reasonably simple in this environment and can be used to do something more interesting than traditional “os bypass” because the OS knows where the data should go or come from. Do nanosecond work in the devices.

Do we need system calls with all the complex context and permission level change? I don’t see why. A system call could queue a request for the OS and then either call code to voluntarily switch or keep going – which might allow the same application to respond to the result on a second core or speed up the event model or coroutines.  For some application loads we’d maybe need to steal a few more cores for OS functions, but the OS is now much simplified without all these weird asynchronous operations and code flow can be optimized for smarter caching (and this leads to a simplified cache design without all the expensive circuitry for snooping and cache coherency)

Getting rid of page faults/memory faults  seems like it needs a slightly bigger change to programming models, but not all that radical.

Categories
systems

Apple’s A5 chip made in Austin

Although I think it might have been designed here too.

The A5 processor – the brain in the iPhone 4S and iPad 2 – is now made in a sprawling 1.6 million square feet factory in Austin owned by Korean electronics giant Samsung Electronics, according to people familiar with the operation.
One of the few major components to be sourced from within the United States, the A5 processor is built by Samsung in a newly constructed $3.6 billion non-memory chip production line that reached full production in early December

http://www.reuters.com/article/2011/12/16/us-apple-samsung-idUSTRE7BF0D420111216

 

Categories
systems

Why computers are more and more devices for generating heat from electricity

Why is it that the hardware interfaces of disk drives 30 years ago were simple and clear and they currently require enormously elaborate drivers? Imagine if one could provide a command consisting of

(read/write, diskaddress, buffer_address, count, notification_address)

so that the disk drive controller wrote a completion code in the notification_address when done.  Would that be hard? Why is it that virtualization hardware on modern processors devotes tens of millions of transistors to functionality that is not useful in any sensible virtual machine kernel but makes interrupt emulation into a nightmarish mish mash. Why are obvious bottlenecks in multi-core performance, like snooping caches made more an more elaborate and non-deterministic in operation when it’s been known for 30 years that they don’t scale at all?  Why is it that the painfully obvious design flaws of USB can never be corrected even as it becomes more and more unavoidable?

Eventually, we’ll reach a breaking point where someone builds a Corolla or a Tesla and the manufacturers of power guzzling, unreliable, legacy hardware have to scramble to catch up.

Categories
computer architecture systems

Processor architecture

Bill Gates and Paul Allen as infants

I wish that processor architecture was not so committed to a obsolete model of software. For example, it has become clear over the last few years that the sloppy shared memory thread model of programming has multiple drawbacks. Sharing of data, in particular, should be tightly controlled. Yet processor architectures are “optimized” for unstructured sharing of data between threads with enormously complex “snooping” caches running at high speed to inspect all transactions on what have become essentially cache buses, and initiating complex transactions when conflicts are detected.  I put “optimized” in quotes because the performance is terrible for the reason that violations of locality cannot easily be cured. That is, caches are designed to permit totally random sharing of memory without software action. Performance gets hammered by cache locality anyways. Essentially what we have is an expensive (both in transistors and power) fix for poorly designed software that really does not get much advantage out of it, but gets protected from the logical (but not temporal) consequences of  sloppy data sharing by the hardware. In point of fact, most threads do not share much memory and the ones that do could be rewritten to explicitly pass control of memory to each other.

Sadly, we are in a situation where processor architectures are constrained to run obsolete software, and then software is constrained to try to take advantage of obsolete hardware. All of this is especially good only for electric power utilities and manufacturers of air conditioning equipment.

A second, related, area of obsolete designs is in memory mapping and paging. This is treated as a problem that has been solved for all time by a hierarchical paging model that was finalized in the 1980s.  Is the paging model designed for machines with 10 meg of memory and a 100megabyte swap partition on a slow disk a good model for machines with 1G or 10G of memory and couple of hundred spare gigabytes on disk, or maybe 40 spare on solid state drives? Well, if you give it a little thought, you can see a lot of potential problems. In the good old days, paging in 512 byte blocks or 4k byte blocks from a disk drive organized around such block, to and from  a highly constrained memory where you really wanted to be able to avoid wasting even a couple of kilobytes required one design. But what happens when the entire concept of disk blocks disappears on the drive and a system with 10M of unused memory is almost certainly stalled? What kinds of memory use patterns are good for LAMP type systems where jobs do not appear and disappear ? You can look at processor design/operating systems sometimes and think that, just maybe, 1970s computer science departments are not the ultimate final inspiration for all architecture.

 

See also a synchronous processor

Categories
software business

Virtualization versus Physicalization

Data on the overhead of virtualization is hard to come by. Rackable proposes an interesting alternative that they call physicalization. I wonder whether the CPU is the most important resource to multiplex and I remain totally puzzled by the motivation of Intel/AMD in this area.