LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   How a computer works? (https://www.linuxquestions.org/questions/general-10/how-a-computer-works-4175446903/)

jokar.mohsen 01-23-2013 10:07 AM

How a computer works?
 
Hello Folks.
In your opinion which one of below books is good for learning how a computer works really :

1- Digital Design and Computer Architecture, Second Edition by David Harris and Sarah Harris

2- Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture by Jon Stokes

3- Structured Computer Organization (5th Edition) by Andrew S. Tanenbaum


Thank you.

ButterflyMelissa 01-23-2013 10:49 AM

Edit

sundialsvcs 01-23-2013 02:13 PM

All of these books, while very excellent books, are all very intense. Indeed, we'd all like to know what your objective is. (And a worthy objective it is!) :) Have you explored The World Wide Web for introductory material?

dugan 01-23-2013 02:21 PM

Code, by Charles Petzold.

myzoneajay 01-24-2013 05:44 AM

I would recommend the 3rd one, Structured Computer Organization. I read it for my semesters, Good book.

ButterflyMelissa 01-25-2013 09:59 AM

I'd like to join sundialsvcs and ask just what the goal is. We could explay up to any technical level how the thing works, but...will that answer your question? :)

jokar.mohsen 01-26-2013 12:49 AM

Quote:

Originally Posted by Thor_2.0 (Post 4876198)
For me it was "From chips to systems" by Rodnay Zaks, extremely outdated by today's standards, but it thought me what computers are, what a BIOS is (I even programmed extentions to the thing once) how software ends up being executed...the works...

By the way, why stick to these? What are your goals, byt he way? Building a computer? Just understanding?

Thor

Hi.
Thanks very much for your guidance.
I want to know how a computer works really and my goal is learning assembly language. In your opinion, is "Digital Design and Computer Architecture" good?

ButterflyMelissa 01-26-2013 03:30 AM

Edit

myzoneajay 01-27-2013 01:53 AM

If you want to learn assembly lang then start with 8085 or may be 8086 microprocessors books.

ButterflyMelissa 01-27-2013 04:20 AM

Quote:

If you want to learn assembly lang then start with 8085 or may be 8086 microprocessors books.
The Intel microcontroler? Forgot about that one, and yes, the better "entry vector"...I second this one...

johnsfine 01-27-2013 08:53 AM

Quote:

Originally Posted by jokar.mohsen (Post 4877798)
how a computer works really

That is a deep hierarchy of topics, each very challenging. Consider the semi-conductor physics through which the junction in each semi-conductor component operates. A whole different set of physics is involved in the microscopic magnetic storage of data. You better know how to apply Maxwell's Equations to understand how the information flows among all those microscopic components without getting totally lost in cross talk, reflections and other capacitive and inductive effects. After all that you would have barely reached the bottom level of how computers really work.

Experts don't try to understand how something like a computer really works. An expert really understands a narrow sub topic within that, then has a general grasp of the surrounding sub topics and some vague idea about the challenges and results of the distant sub topics.

Quote:

and my goal is learning assembly language.
That is still more of a means than a goal.

How you learn assembly language depends a lot on why you want to learn it.

If you are (or intend to be) a software engineer, a very good reason to learn assembly language is to improve your abilities at designing and debugging software in high level languages. Even if you will never include any assembly source code in a final project, knowing how you could do that is very valuable for developing high level language code (especially C++).

If that is your purpose for leaning assembly language, then you should focus on learning a current CPU architecture (almost certainly X86-64) and on learning assembly programming in the form of functions called via a C interface.

Most books, tutorials, online advise, etc. on learning assembly focus on
1) Obsolete architectures, in theory because they are simpler, but really because they author's skills are obsolete.
2) Either whole programs in assembly or even stand-alone (from boot) code in assembly without benefit of an OS.
Many combine a little of (1) and (2) to focus on assembly programs in 16-bit x86 code to run under an MS-DOS emulator.

If you want to learn assembly in order to better understand current high level language software development, all the above is a massive waste.
For some other purposes for learning assembly, some of the above isn't as totally wasted, but it still isn't necessarily a good place to start.

For almost any reason for learning assembly, starting with a focus on assembly functions callable from C is a more gentle introduction without wasting time of useless side topics.

Quote:

Originally Posted by jokar.mohsen (Post 4876179)
In your opinion which one of below books is good

I haven't looked at any computer book in years, and when I did look at computer books I was never impressed.
You learn to program by programming, not by reading about it.

A good online tutorial would help, but I don't know of one. As I said above, most focus on a really stupid way of introducing assembly.

Quote:

Originally Posted by Thor_2.0 (Post 4877844)
keep in mind that there is NO safety net in pure assembly, in fact, you can easyly write straight into the OS and cripple your session, be prepared to restart often

I'm not sure what that nonsense is supposed to mean. If you write a "pure" assembly program in Windows or Linux, that program can accidentally write to exactly the same things that a C or C++ program can accidentally write to, which does NOT include the OS.
When you (a beginner) write a program, be prepared to get the program wrong many times, including sometimes hanging it in a way that needs a task manager or kill command (etc.) to stop it. But that is just the program, not the session. MS-DOS is obsolete. A real OS protects the rest of your session from almost all programming accidents and protects itself from all of them (unless you abuse root privileges).

Quote:

Originally Posted by myzoneajay (Post 4878330)
If you want to learn assembly lang then start with 8085 or may be 8086 microprocessors books.

That is clearly a very popular idea among those giving advise for learning asm. It is still a very wrong idea. If you want to learn how to design heating systems, you don't begin by learning how to start a camp fire with a flint.

I tried to get my sons (while they were in Boy Scouts) to learn to start a camp fire with a flint. I also taught them quite a bit of computer programming and never any 16-bit x86 (much less 8085). Starting a camp fire with a flint is more worthwhile to learn today than 16-bit x86 asm.

jokar.mohsen 01-28-2013 01:20 AM

Quote:

Originally Posted by johnsfine (Post 4878445)
That is a deep hierarchy of topics, each very challenging. Consider the semi-conductor physics through which the junction in each semi-conductor component operates. A whole different set of physics is involved in the microscopic magnetic storage of data. You better know how to apply Maxwell's Equations to understand how the information flows among all those microscopic components without getting totally lost in cross talk, reflections and other capacitive and inductive effects. After all that you would have barely reached the bottom level of how computers really work.

Experts don't try to understand how something like a computer really works. An expert really understands a narrow sub topic within that, then has a general grasp of the surrounding sub topics and some vague idea about the challenges and results of the distant sub topics.



That is still more of a means than a goal.

How you learn assembly language depends a lot on why you want to learn it.

If you are (or intend to be) a software engineer, a very good reason to learn assembly language is to improve your abilities at designing and debugging software in high level languages. Even if you will never include any assembly source code in a final project, knowing how you could do that is very valuable for developing high level language code (especially C++).

If that is your purpose for leaning assembly language, then you should focus on learning a current CPU architecture (almost certainly X86-64) and on learning assembly programming in the form of functions called via a C interface.

Most books, tutorials, online advise, etc. on learning assembly focus on
1) Obsolete architectures, in theory because they are simpler, but really because they author's skills are obsolete.
2) Either whole programs in assembly or even stand-alone (from boot) code in assembly without benefit of an OS.
Many combine a little of (1) and (2) to focus on assembly programs in 16-bit x86 code to run under an MS-DOS emulator.

If you want to learn assembly in order to better understand current high level language software development, all the above is a massive waste.
For some other purposes for learning assembly, some of the above isn't as totally wasted, but it still isn't necessarily a good place to start.

For almost any reason for learning assembly, starting with a focus on assembly functions callable from C is a more gentle introduction without wasting time of useless side topics.



I haven't looked at any computer book in years, and when I did look at computer books I was never impressed.
You learn to program by programming, not by reading about it.

A good online tutorial would help, but I don't know of one. As I said above, most focus on a really stupid way of introducing assembly.



I'm not sure what that nonsense is supposed to mean. If you write a "pure" assembly program in Windows or Linux, that program can accidentally write to exactly the same things that a C or C++ program can accidentally write to, which does NOT include the OS.
When you (a beginner) write a program, be prepared to get the program wrong many times, including sometimes hanging it in a way that needs a task manager or kill command (etc.) to stop it. But that is just the program, not the session. MS-DOS is obsolete. A real OS protects the rest of your session from almost all programming accidents and protects itself from all of them (unless you abuse root privileges).



That is clearly a very popular idea among those giving advise for learning asm. It is still a very wrong idea. If you want to learn how to design heating systems, you don't begin by learning how to start a camp fire with a flint.

I tried to get my sons (while they were in Boy Scouts) to learn to start a camp fire with a flint. I also taught them quite a bit of computer programming and never any 16-bit x86 (much less 8085). Starting a camp fire with a flint is more worthwhile to learn today than 16-bit x86 asm.



Hello.
I'm grateful really for your useful guidance.
I want to Learn assembly langauge for Reverse engineering, Do you have any idea?

ButterflyMelissa 01-28-2013 05:54 AM

Edit

jokar.mohsen 01-28-2013 07:36 AM

Quote:

Originally Posted by Thor_2.0 (Post 4878941)
ROFL! Ever addressed something out of the frame? Okay, granted, I'm from the era where you could "poke stuff" into the OS's memory space...
Anything above Assembler (C, C++, Java, whatever) is more or less governed by the OS, Assembly COULD bypass that... :)
Believe me, I've restarted enough to know ;)

Honesty demands that I confess that I've written my own Assembler in my time, nothing fancy as today's standards, a bare editor, that could load, edit and save (print as well) the source, and convert the code into bytes (yes, folks: BYTES, I'm that old) and pop 'em anywhere YOU wanted, including OS space...

Thor

Do you have any idea about reverse engineering?

johnsfine 01-28-2013 07:39 AM

Quote:

Originally Posted by Thor_2.0 (Post 4878941)
Anything above Assembler (C, C++, Java, whatever) is more or less governed by the OS, Assembly COULD bypass that...

You are simply wrong. In any environment, anything you can accidentally trash in asm, you could accidentally trash the same in C or C++.

In a real OS, such as Linux, the OS portion of each process's address space is protected against access. Whether you are using C or asm, you could execute an instruction telling the CPU to overwrite a byte of the OS, and that instruction would seg fault without actually overwriting any of the OS.

johnsfine 01-28-2013 07:50 AM

Quote:

Originally Posted by jokar.mohsen (Post 4878805)
I want to Learn assembly langauge for Reverse engineering, Do you have any idea?

I don't want to discourage learning asm. But reverse engineering methods that involve asm level work are an enormous amount of effort (even after you are an asm expert) for very little benefit, and even then much of the benefit would likely be illegal.

If you still want to learn asm for reverse engineering, then the choice of architecture is determined by what you want to reverse engineer. Also the choice of what approach you take to asm is influenced by what you want to reverse engineer.

If you want to reverse engineer any kind of ordinary programs, then you need to start with learning how to write asm functions callable from C (as I suggested earlier).

Some asm tutorials start from boot code, which is a very specialized topic and useless if you want to reverse engineer anything other than boot code.

Most other asm tutorials start with tiny whole programs, which also involves a lot of specialized, but otherwise useless, information. Before you understand those topics, you might imagine reverse engineering whole programs requires that knowledge. But it actually doesn't. The techniques used when the whole program must be asm don't appear anywhere in the compiled code when the main program is in a high level language. Something similar might appear in the compiled code of the basic system .so or .a files (.lib or .dll in Windows) the executable was linked against. But you don't need to reverse engineer those. You have their C source code.

I did a quick search for my previous replies to related questions that I think are relevant for you. I found this post
http://www.linuxquestions.org/questi...9/#post4661549
I found a whole lot of useful posts in this thread
http://www.linuxquestions.org/questi...rn-asm-793174/

jokar.mohsen 01-28-2013 08:11 AM

Quote:

Originally Posted by johnsfine (Post 4879013)
I don't want to discourage learning asm. But reverse engineering methods that involve asm level work are an enormous amount of effort (even after you are an asm expert) for very little benefit, and even then much of the benefit would likely be illegal.

If you still want to learn asm for reverse engineering, then the choice of architecture is determined by what you want to reverse engineer. Also the choice of what approach you take to asm is influenced by what you want to reverse engineer.

If you want to reverse engineer any kind of ordinary programs, then you need to start with learning how to write asm functions callable from C (as I suggested earlier).

Some asm tutorials start from boot code, which is a very specialized topic and useless if you want to reverse engineer anything other than boot code.

Most other asm tutorials start with tiny whole programs, which also involves a lot of specialized, but otherwise useless, information. Before you understand those topics, you might imagine reverse engineering whole programs requires that knowledge. But it actually doesn't. The techniques used when the whole program must be asm don't appear anywhere in the compiled code when the main program is in a high level language. Something similar might appear in the compiled code of the basic system .so or .a files (.lib or .dll in Windows) the executable was linked against. But you don't need to reverse engineer those. You have their C source code.

I want to do Malware analysis, Do you have any suggestion?

johnsfine 01-28-2013 08:21 AM

Quote:

Originally Posted by jokar.mohsen (Post 4879025)
I want to do Malware analysis, Do you have any suggestion?

x86-64, not 32-bit x86 nor any other (more obsolete) architecture. Use of 32-bit is declining and you are still learning.

If you learn x86-64 quickly, you can go back and learn the differences between that and 32-bit. Both are still relevant for malware analysis if you learn a lot soon.

Beyond that, what I said earlier still applies. For understanding most malware the first and most important aspect of asm to understand is the mechanism by which one function calls another, including how parameters are passed, how local variables are allocated by the new function, what registers are preserved, how results are returned, and how everything unwinds correctly (or not) during the return.

dugan 01-28-2013 09:40 AM

Reverse engineering? I haven't read this book, but gets its fair share of recommendations: http://www.amazon.com/dp/0764574817

ButterflyMelissa 01-28-2013 01:00 PM

Edited stuff out - irrelevant ranting, not usefull for OP, sorry gang... :)
(excusing myself from this thread...)

jokar.mohsen 01-29-2013 05:21 AM

Thank you So much

sundialsvcs 01-29-2013 08:05 AM

Oh, heck ... maybe I'm just an old mainframe-junkie at heart who learned IBM Assembler early-on and did a lot of work with it ... if your brain is "wire"d the right way, computer hardware architecture (seen from software's point-of-view) can be interesting.

Especially since pocket-protectors come in lots of sexy colors! (So do nerdy glasses.)

(what? what? why of course there is a "pocketprotectors.com"!) :hattip:

dugan 05-29-2013 04:05 PM

Impossible Programs: a great lecture on some of computer science's most important subjects - Boing Boing

Quote:

Here's a 40-minute video in which Tom Stuart gives a talk summarizing one of the chapters from him new book Understanding Computation, describing the halting state problem and how it relates to bugs, Turing machines, Turing completeness, computability, malware checking for various mobile app stores, and related subjects. The Halting State problem -- which relates to the impossibility of knowing what a program will do with all possible inputs -- is one of the most important and hardest-to-understand ideas in computer science, and Stuart does a fantastic job with it here. You don't need to be a master programmer or a computer science buff to get it, and even if you only absorb 50 percent of it, it's so engagingly presented, and so blazingly relevant to life in the 21st century, that you won't regret it.


All times are GMT -5. The time now is 12:08 AM.