Question:
What exactly does a "Processor" do in computer?
Aditya
2012-12-22 04:46:29 UTC
I know that it processes the data and gives the output and all that, have read it lot of times. But i want to know "How"!!!.

This is what i know, (I suppose i am right)

1) When we input something in GUI in human readable language/decimal number that data is compiled and goes into assembly level where it is converted into hexadecimal numbers.

2) Then the assembler converts it into machine code (Binary numbers) which goes into machine level where there 2 are values 1 and 0. 1 and 0 both are high and low voltage of currents.

3) And these 1's and 0's are passed to the processor where it does something and gives the output!
What happens there?

Suppose i have performed a simple calculation "2 + 2 = " on p.c, how will the processor give the output "4"? Is my question.
:) :)
Five answers:
Daniel B
2012-12-22 05:02:51 UTC
As another answerer observed you would need to do a lot of study to truly understand this. With that said what you have posted is not really correct. First you mention assemblers and compilers which are only involved when you are writing software, not in the normal operation of a computer.



For you example of input into a GUI the (greatly simplified) things going on are...



1. The keys on you keyboard are switches, so he processors is constantly looking for one of these switched to be turned on.



2. The processor know which switch represents each character so it puts the binary value of that character which is stored as 1's and 0'2 somewhere in the computers memory.



3. At some point the processor generates what you see on the screen and during this process it reads the character value from memory and draws the image of that character.
?
2012-12-23 10:32:33 UTC
Depending on the language program is written, the program is compiled to machine code before (by programmer). The computer only understands machine code. Some of programs use virtual machine, the computer (CPU) doesn't understand their code, but understands the code of virtual machine (or interpreter) and that does the real work the CPU understands. Whatever you as user is doing should be understood and processed by CPU, like moving mouse, pressing key (input/output) and even the GUI is drawn by CPU (some times by help of GPU).

The thing you described is a process in a high-level language, and you didn't describe everything. Yes, the calculation is done by CPU, but the instructions were written by programmers previously and only the numbers (input data) are dynamic and the data calculated is returned to the program and is displayed (many low-level things happening in here). However, it doesn't mean that ALWAYS instructions are predetermined, this is not true specially in design of programming languages and JIT.

The Operating System runs (loads to RAM and gives the address of it to CPU and CPU has instruction pointer that is used) the code and the program is a set of instructions (of machine code) which does this.



Thanks!
anonymous
2012-12-22 12:53:59 UTC
any answer to your question will be very vague because the only way to understand how it works requires that you've taken a couple semesters worth of computer science based electrical engineering

if you really want to know, look up how logic gates work

then look up how to build a ripple carry bit adder using logic gates

then you will have some idea of what's going on, at a very basic level
Unknown
2012-12-22 12:47:17 UTC
A sequence of 1's and 0's...
Anza Power
2012-12-22 14:10:48 UTC
Hi...



Take this course: https://www.coursera.org/course/comparch or this course http://www.nand2tetris.org/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...