![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Hobbyist Programmer
|
Quote:
![]() After that they will translated them to machine language. Finaly the Kernel send instructions to Computer hardware/computer devices. To understand full concept of programming and all the computer architecture are very complex structure. Please correct me if there any mistake in my explanations. Thanks, Harry
__________________
-- pr0gm3r |
|
|
|
|
|
|
#12 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
At its most basic level, the "code" is a set of logic signals connected to hardware logic devices. These gate binary patterns here and there, including into and out of the ALU (arithmetic logic unit). One can easily build an adder and provide its code with switches and its output with lighted devices. As the industry has grown, this has progressed from a reasonably comprehensible handful of components to several zillion transistors. The basic premise is the same; you just need to lay your hands on the right material. As mentioned previously, a few posts aren't gonna getcha there.
Interesting sig, this: Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#13 |
|
Newbie
Join Date: Sep 2005
Posts: 4
Rep Power: 0
![]() |
Alright, thanks everyone! You know, I think Mr. Gates might have been on to something with the whole "computer" thing...
|
|
|
|
|
|
#14 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Son, I hate to tell you this, be we were messing with these thangys when "Mr. Gates" was still in diapers.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#15 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
![]() |
|
|
|
|
|
|
#16 |
|
Newbie
Join Date: Sep 2005
Posts: 4
Rep Power: 0
![]() |
OK wow I wasn't thinking clearly. *Slaps self*. We'll go with Zuse.
Another question though - they say high level programming languages aren't as efficient because they don't convert to machine code as fluently as lower level languages. Why is that? If they're being converted to 0s and 1s, how can it be any more efficient in one language than it is in another? Does the problem lie in an inefficient conversion process? |
|
|
|
|
|
#17 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Let me give you one brief example. If you write a procedure (function) in assembly language, you know what registers you are going to use and destroy. When you construct the call, you save those, so as not to mess up the calling code's data. Compiler writers will devise a set of things they expect to use (whether they actually wind up being used or not depends upon the things the coder does) and save all those. Some of that is wasted. Optimization is really good, these days, and it takes a good assembly coder (knowledgeable about really technical details like the operation of cache, and so forth) to beat it, but there's still waste because of the genericity of the translation.
The purpose of the higher-level languages is to put a layer of abstraction between the mind of the human and the operation of the machine. Their mechanisms are entirely different. Programming in ways tailored to the machine distracts the mind from abstract concepts to a significant degree. It's a different mindset. The problem space is human, generally, and the solution space is Von Neumann. Someone has to deal with that. Economic efficacy says it shouldn't be the day-to-day solution-deviser/coder. In the past, resources were so expensive that one couldn't actually afford to write the higher level languages that provide the abstraction, and implement them on the machine. Now, one can't afford not to except in the most stringent of circumstances.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#18 | |
|
Hobbyist Programmer
|
Quote:
__________________
-- pr0gm3r |
|
|
|
|
|
|
#19 |
|
Expert Programmer
|
Don't we all?
![]()
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#20 | ||
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
![]() Quote:
For instance, say I wished to create a list of the first 10 square numbers. In C, I suspect the most efficient way to solve this problem would be: unsigned char numbers[10]; unsigned char i; for (i = 0; i < 10; i++) numbers[i] = i * i; numbers = [i * i for i in range(10)] In C, we've told the computer to create an array of ten bytes, and a counter of one byte, so the total size of all our variables is a measly 11 bytes. In reality, it's likely to be a little more than that, since I do believe we need to factor in the references to these variables, but we're still talking less than 20 bytes on the stack. That's tiny. Python, on the other hand, doesn't bother its programmers with low level concepts of memory. And whilst in C, our array of numbers is literally just a string of 10 bytes, just 80 0s and 1s, in Python we get a list of numbers that's all singing, all dancing. We can query it's length, reverse it, sort it, expand it, shrink it; you name it. If you wanted to make this python code as efficient as C, you'd have to do all sorts of things. You'd have to recognise that none of the numbers in the list go above 255, and thus only one byte per number is needed. You have to see that the list information does not change, and thus can be represented as a fixed array. You have to realise that none of the fancy list functions are used, and thus we can remove them from our machine code. And that's just the beginning of the things that our hypothetically perfect compiler would have to work out. Computers aren't sophisticated enough to optimise code by this amount. Thus, Python is always going to be less efficient than C. |
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|