3 ms·
"(issuing commands to hardware often has to be strictly sequential, for example)" Do they, though? I mean, yes, sure, with current hardware this is true, but i
by jerf 17y ago
"(issuing commands to hardware often has to be strictly sequential, for example)"
Do they, though? I mean, yes, sure, with current hardware this is true, but is this a true necessity, or an artifact of the fact that modern hardware is designed to be used by von Neumann machines?
Honest question, I don't know enough about hardware to have an answer. Can there be "functional hardware", or perhaps more practical, "dataflow hardware"?
- notaddicted 17y agoIf the commands don't have to be executed sequentially, then you don't have to issue them sequentially. A modern processor will look at the incoming instructions and execute whatever it can without creating a hazard, this is called out of order execution. http://en.wikipedia.org/wiki/Out-of-order_execution http://en.wikipedia.org/wiki/Out-of-order_execution
- wmf 17y agoOOO still preserves sequential semantics, so it's not that interesting from the programmer's perspective.
- wwalker3 17y agoIt would be hard to create truly "functional" hardware. A piece of hardware is a real physical object with an internal state which is shared by all accessors and which can change over time. Shared, modifiable state is the exact opposite paradigm from the one that pure functional languages use. I think this is also why pure functional languages are so hard for "normal" people to understand -- their basic premise is the opposite of the real world around us that's filled with stateful physical objects.
- dkersten 17y agoI think one other reason why von Neumann-type imperative programming was chosen over dataflow IS because sequential instructions and shared memory makes a lot of sense to us. Having said that, a lot of non-programmers use graphical dataflow languages all the time, so maybe dataflow is ACTUALLY easier (at least for non-programmers - maybe the mathematical feel of imperative code attracts us programmers to it?) - eg, graphics tools often have dataflow languages for defining animations, materials, lighting and so on. I once used a dataflow tool for generating 3D visualizations and it was very intuitive.
- michaelneale 17y agoThe way I have had it explained to me (which I still don't quite get) is that an object is immutable if there was no time. When you mutate an object, it only happens due to time passing (ie if you were to "go back in time" the object would be as it was) - so changing something creates something else (in time). Confused.
- dkersten 17y agoNot all the time, but often, yes. A very simple example is user input and output: I want to print the prompt text before I let the user type their input. The same is true for plenty of other hardware: I need to move the robot forward before I turn on the drill; I need to print page 1 before page 2 - etc etc. There are plenty of inherently sequential operations, thats all I was trying to say. ;-) But you are not incorrect - obviously there IS some hardware which is only sequential because it was designed for von Neumann machines to drive it. Dataflow hardware can exist (there are, or were, dataflow processors made) and hardware itself is inherently dataflow. In fact, VHDL and Verilog are inherently dataflow languages (possibly) running on FPGAs, which I guess could be seen as a sort of low level dataflow processor. EDIT: @scott_s: Sure, but the end effect is the same, isn't it?
- scott_s 17y agoI think it's inaccurate to characterize VHDL and Verilog as "languages running on FPGAs." FGPAs aren't designed in anyway to run those languages; they're designed to emulate hardware. Since those are the languages used to describe hardware - including modern processors - what they produce can be mapped to run on an FPGA.
- scott_s 17y agodkersten, indeed, the effect is the same. But this is a good discussion, and I wanted to make sure we all had the facts right. Meta talk: responding to my post instead of editing yours makes more sense to me. First, I'm more likely to see it, and second, now I'm in the awkward position of replying to myself. I also find it disheartening that someone downmodded your comment from 2 to 1, presumably because I corrected you, but probably unaware that I was the one who upmodded you to begin with. Your point was valid, I just wanted the record to be accurate.
- dkersten 17y agoI'm glad that you are correcting me. I like to be corrected, because it means that I'm not relying on invalid information and I very much like learning new things, especially if related to something which interests me - like dataflow. Sorry, HN wouldn't allow me to reply to your comment for some reason, so I edited mine.
- scott_s 17y agohttp://en.wikipedia.org/wiki/Dataflow_architecture http://en.wikipedia.org/wiki/Dataflow_architecture
- wmf 17y agoSee the recent discussion about Fleet dataflow hardware: http://news.ycombinator.com/item?id=723882 http://news.ycombinator.com/item?id=723882
- dkersten 17y agoI missed this! Thank you for posting the link!!