On Wednesday 26 July 2006 11:57 am, Andrew Lentvorski wrote: > Paul G. Allen wrote: > > kelsey hudson wrote: > >> [EMAIL PROTECTED] wrote: > >>> Assembly is useful to learn. It helps you understand CPUs > >>> and ultimately what your high level code is doing under the hood. > >> > >> Agreed. Everyone should learn assembly. > > > > Everyone should learn it before learning C and other high level > > languages. > > You people are *insane*. This is like saying that you should learn a > foreign language by studying with a 3 year old. > > Everyone should learn Lisp/Haskell/Ocaml/Prolog/Erlang/etc *long* before > they learn assembly. Those languages teach you how to *think*. If we > could convert 90% of the assembly/C hackers to *anything* higher level. > The resulting productivity increase would put the Dot Com Boom to shame. > > And I taught the assembler course at SDSU this last semester. > > Assembly gives *zero* insight into modern computers. Even at the > assembly level, you are functioning too far above the hardware in > abstraction level. Basic assembler tells you nothing about the memory > subsystem, the interrupt handlers, etc. that determine what is really > going on. > > Even when dealing with something as simple <hah!> as a Nintendo DS (ARM9 > & ARM7), the programming complexity is sitting in passing memory chunks > between subsystems (graphics, sound, the other processor, etc). This > has nothing to do with the assembly itself. > > -a
At least one serious contributor seems on the surface of things to disagree with you about the relevance of machine language. =============================================== See http://www-cs-faculty.stanford.edu/~knuth/mmix.html from which I quote: Many readers are no doubt thinking, ``Why does Knuth replace MIX by another machine instead of just sticking to a high-level programming language? Hardly anybody uses assemblers these days.'' Such people are entitled to their opinions, and they need not bother reading the machine-language parts of my books. But the reasons for machine language that I gave in the preface to Volume 1, written in the early 1960s, remain valid today: One of the principal goals of my books is to show how high-level constructions are actually implemented in machines, not simply to show how they are applied. I explain coroutine linkage, tree structures, random number generation, high-precision arithmetic, radix conversion, packing of data, combinatorial searching, recursion, etc., from the ground up. The programs needed in my books are generally so short that their main points can be grasped easily. People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. Machine language is necessary in any case, as output of many of the software programs I describe. Expressing basic methods like algorithms for sorting and searching in machine language makes it possible to carry out meaningful studies of the effects of cache and RAM size and other hardware characteristics (memory speed, pipelining, multiple issue, lookaside buffers, the size of cache blocks, etc.) when comparing different schemes. Moreover, if I did use a high-level language, what language should it be? In the 1960s I would probably have chosen Algol W; in the 1970s, I would then have had to rewrite my books using Pascal; in the 1980s, I would surely have changed everything to C; in the 1990s, I would have had to switch to C++ and then probably to Java. In the 2000s, yet another language will no doubt be de rigueur. I cannot afford the time to rewrite my books as languages go in and out of fashion; languages aren't the point of my books, the point is rather what you can do in your favorite language. My books focus on timeless truths. =========================================================== For the instruction set of MMIX see http://www-cs-faculty.stanford.edu/~knuth/mmop.html It has a a few unexpected, but important, instructions, e.g. > Hey I was just thinking. Does anyone know of any Instruction Sets > that have an extra bit in the branch instruction to be used as a > "hint" for the branch prediction logic? Donald Knuth redefined his MIX assembly language: In his opcode matrix he mentions these instructions which do exactly what you are looking for: 5E PBEV probable branch if even (3) 5F PBEVB probable branch if even, backward (3) 50 PBN probable branch if negative (3) etc. =========================================================== I should not fail to mention a wonderful little book. "An Introduction to Elementary Computer and Compiler Design" by Dennis R. Steele, published in 1978. In this book, Steele starts from simple Boolean Logic and provides a very simple Fetch-Execute computer with an Instruction Register, an Accumulator, a Memory Address Generator, a Adder and not much else. He calls this toy computer WHYCO. He then presents a short chapter on High Level Langauge Design that ends with a Backus-Naur Form (BNF) description of a language PL-W that fits WHYCO. A sample program to compute the Fibonacci series is written in PL-W. The remainder of the book is devoted to a compiler for PL-W. The book is only 8 Chapters, 151 pages long, is eminently readable and is as complete a description of both the logic and software for a simple computer I have ever found in a single place. True it has no information on electronics, nothing about transistors, etc. But it is a remarkably concise and coherent overview and introduction to one important aspect of computing. This sort of overview is hard to get from a random selection of courses oriented towards point problems. One is more likely to end up with the perspective of the "wise men and the elephant" from such a common curriculum. BobLQ PS. I came upon this book in unusual circumstances. In 1991 Mt. Pinatubo in the Philippines exploded. During the next few years each summer as the typhoon season drenched northern Luzon with rain massive lahar flows of wet volcanic ash spread out across Pampanga and the neighboring provinces. I was visiting with my wife's family during one of these floods. For some odd reason I went into a bookstore that had been flooded and was browsing the upper shelves of books that had not been damaged. I ran across Steele's little gem in that strange flooded book store in San Fernando, Pampanaga, Philippines. I brought it home to our little shack in Pampanga and spent several very enjoyable days working my way through it. "For months, the ejected volcanic materials remained suspended in the atmosphere where the winds dispersed them to envelope the earth, reaching as far as Russia and North America. This phenomenon caused the world's temperature to fall by an average of 1 degree Celsius. Clearly, Pinatubo's eruption signals the world's most violent and destructive volcanic event of the 20th century." http://park.org/Philippines/pinatubo/ The world is a strange and wonderful place. B -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
