EvanED wrote:
What? I can name several reasons to learn ASM right off the top of my head:
I'll tack on lock-free programming and vector programming, where you can write it in C, but that C will basically be assembly anyway.
Moderators: phlip, Moderators General, Prelates
EvanED wrote:
What? I can name several reasons to learn ASM right off the top of my head:
Rysto wrote:JVMs, for one, compile Java bytecode to machine code for speed.
Xanthir wrote:People who like to code assembly to make their code faster? Don't know what they're talking about. The complexity of the simplest instructions on a modern processor is absolutely staggering. A well-written compiler knows how to deal with memory latency and threading and such that require you to know timings of various commands to the microsecond and how everything interacts as it busses back and forth across the processor and the cache. Sometimes your code actually gets faster when you add more instructions. Or when you swap two unrelated lines.
torne wrote:This is less common on x86 as compilers are generally better, but believing it's not useful at all upsets me a little. Our OS doesn't have a compiler to thank for its theoretical-bandwidth-limit-hitting implementation of memmov(), I can assure you(though those 500-odd instructions weren't by me *grin*)
EvanED wrote:At the same time, I suspect he's not too far off the mark for x86. Sure, there are plenty of examples where someone was able to beat the compiler, but at the same time, I suspect there are also plenty of examples where someone tried to beat the compiler, and their best effort was no improvement at all, and plenty more where their best effort was worse than what the compiler produced.
You make know instruction timings and such for the ARM, but to the best of my knowledge Intel hasn't even released descriptions of what the microoperations are that IA-32 instructions are compiled into on-chip. Without that knowledge, I suspect that predicting what a scheduling sequence will do in terms of performance is very difficult, and finding the best next to impossible.
aldimond wrote:What torne is doing probably makes perfect sense for his project though. One codebase for one specific chip for a few mass-produced products. x86 ain't the whole world.
Zanik221 wrote:I'm so sorry. I first learned assembly on a 68k processor. Not fun.b0b wrote:I hacked a lot of ... 68k back in the 80's.
taggedunion wrote:Graphics & drivers are probably always going to be in ASM & C.
Rysto wrote:You really expect microkernels to take off? I bet that we'll be seeing OSes written in a type-safe language like Java before we see microkernels in widespread use.
Rysto wrote:Yeah, but doing things in user-space is *slow*. Between the costs of context switching and copying things in and out of the process, you lose too much performance.
EvanED wrote:taggedunion wrote:Graphics & drivers are probably always going to be in ASM & C.
Careful with that statement, "always" is a long time.I give it 2 to 2 1/2 decades before OSs written in C are only for antiques. Within the decade most or all drivers will have moved into user space, giving implementers much more leeway in their choice of language.
(Also, add C++ into your list; graphics drivers on Windows I belive are typically C++.)
taggedunion wrote:Of microkernels -- they're probably used more than you might think. Mac OS X, for one, is implemented as a microkernel.
And, the slow argument against Java is total crap. That started, what, in the 90s? It's been a decade! Java is the fastest interpreted language out there,* and is not that much slower than C++. And you're trading that little speed you care so much about for development time and ease. Raise of hands: who likes managing their own memory? If you use tools like Python or shell, especially, you really shouldn't complain too much about the speed hit (maybe you could complain if you were writing drivers or kernel code, but no sane person would that in anything less than C++).
* Some Lisp implementations are pretty damn quick as well.
taggedunion wrote:Of microkernels -- they're probably used more than you might think. Mac OS X, for one, is implemented as a microkernel.
Raise of hands: who likes managing their own memory? If you use tools like Python or shell, especially, you really shouldn't complain too much about the speed hit (maybe you could complain if you were writing drivers or kernel code, but no sane person would that in anything less than C++).
taggedunion wrote:Kernels need speed, so I firmly believe that kernels will always be written in a close-to-the-machine language like C. I'm not discounting new mid-level-languages, but why reinvent the wheel when the present wheel gets the job done just fine?
Notice I say C-like language. And by that I mean a mid-level language just above assembler. One might use Lisp, O'Caml, or Haskell, but that object code would not be quite as succinct and fast as straight C (or C++ or D).
Oh, and desktop machines might evolve to higher-level languages, but embedded devices are always going to need speed and small object code. It's like how people discount RISC processors and how they "failed", but your car, your cell phone, and your game system runs on CISC processors. ARM and PPC are among the top-selling chips overall because of this (CMIIF, because IANAE).
Rysto wrote:taggedunion wrote:Of microkernels -- they're probably used more than you might think. Mac OS X, for one, is implemented as a microkernel.
Mac OS X runs a BSD variant on top of the microkernel. The microkernel is only responsible for low-level device drivers, VM and threading.
Yeah, but it's still slower than C, isn't it? I'm a big proponent of Java myself, but it doesn't give you enough performance to write a kernel in it.
b0b wrote:I thought that the JIT compiler used by modern Java VMs pretty much settled this issue. Is Java still slower than C++? Last time I looked (maybe 7 years ago) there was only a 10% difference between the two.
I'll tell you this: Java sure compiles faster than C++!!
taggedunion wrote:From my understanding, Mac OS X is for the most part implemented modularly like a microkernel, but critical pieces are given kernel rights for speed considerations. *shrug* I don't quite know how this makes things. I know it's still different than a vast, monolithic kernel. I'm thinking more of the 2nd Continental Congress.
I pointed out Lisp, Haskell, and O'Caml because they seem to be the favorites as far as converting down to machine code goes. O'Caml seems to have a good reputation, especially. My intention was not to tie them in as C-like languages. Rather, I intended to constrast them to a mid-level language like C. Sorry if I wasn't clear.
But yet nobody sane would ever consider writing, say, a video encoding in Java. I wonder why?b0b wrote:I thought that the JIT compiler used by modern Java VMs pretty much settled this issue. Is Java still slower than C++? Last time I looked (maybe 7 years ago) there was only a 10% difference between the two.
b0b wrote:I think that today, the only people who use assembly are those who write C compilers. Am I wrong?
EvanED wrote:I'm pretty sure that's "proper" behavior. Without a prototype, a function's type defaults to 'int ()(...)'. On a system with 16-bit ints, it did the right thing.
poxic wrote:You suck. And simultaneously rock. I think you've invented a new state of being.
EvanED wrote:I'm pretty sure that's "proper" behavior. Without a prototype, a function's type defaults to 'int ()(...)'. On a system with 16-bit ints, it did the right thing.
Users browsing this forum: No registered users and 16 guests