Thread: Need better explanation of how computers work?

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    67

    Need better explanation of how computers work?

    I understand computers store memory in bits/bytes through the use of circuits and switches, and the computer reads it through machine code a.k.a. "binary". But I still don't understand how the computer knows what to put on the screen? So it sees a bunch of switches that are on and off.. How is the computer able to know that 01000001 means "A" and how does it display that on the screen, or even know what point to put it on the screen. I know the screen is like a grid, but I just don't understand.

    I've tried researching the topic and I've found vast amount of explanations about how the microprocessor works and how memory is stored, but not what I'm looking for.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    The computer doesn't know what to put on the screen.

    There is no magic here; the computer has been told what to put on the screen. Well, I suppose you could say the driver tells the processor how to act, the processor tells the video controller how to act, and the video controller tells the monitor how to act. The point, there is no magic in what computers do. They've only been programmed.

    It doesn't know that the value "01000001" should be the character "A".

    It is just part of how character sets work.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    01000001 is just the value of a byte. As phantomotap said, there's no magic. Somebody somewhere told (programmed) the computer to do something specific with that byte value in a certain context. That is, the byte value 01000001 doesn't always have to be the letter A. It could simply be the number 65, used to store how many widgets you have in your inventory program. Or it could be the value read in from some sensor (like a temperature sensor) hooked up to your computer-controlled whatever. The parts of the software that are responsible for displaying stuff on the screen get a value like 01000001, and know that in that context, it should represent a letter in the ASCII code table, and they go and look up that letter, getting back a glyph (or "picture" of the letter), and display that in the right location on the screen.

    The value 01000001 is the letter A in the ASCII character set. That is just one (but probably the most common*) character set. You can see all the mappings for 0-127 (anything more than that is not true ASCII) and find more info here: ASCII - Wikipedia, the free encyclopedia. Compare that to EBCDIC (another relatively common character set): EBCDIC - Wikipedia, the free encyclopedia, where the value 01000001 is a non-breaking space, and A has the value 11000001.

    * I say the most common. Nowadays, UTF-8 might be more common than ASCII, but UTF-8 has the same mappings as ASCII for values 0-127. UTF-8 has a lot more mappings than ASCII though, to encompass non-Latin-alphabet languages, like Greek, Russian, Arabic, Chinese, etc.

  4. #4
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Thanks guys, but again, I already know all that. What I'm asking is WHAT reads the bits/bytes and from there HOW does the computer know what to do. Someone had to preprogram the computer to know what "A" even looks like?

    @anduril462 you said,
    Or it could be the value read in from some sensor (like a temperature sensor) hooked up to your computer-controlled whatever. The parts of the software that are responsible for displaying stuff on the screen get a value like 01000001, and know that in that context, it should represent a letter in the ASCII code table, and they go and look up that letter, getting back a glyph (or "picture" of the letter), and display that in the right location on the screen.
    This is what I was looking for.. but could you direct me to a link that speaks about this certain process?

  5. #5
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612

  6. #6
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    You could try browsing around brain://anduril462/computers/displaying-text, but I think the link is broken . I can't help you with a link since I didn't look that stuff up anywhere, at least not in answering your question. It's stuff I acquired, that "seeped in", over the last 15+ years of being a computer nerd. There probably were some links at one point, but they're long forgotten.

    What "certain process" are you referring to exactly (you actually quoted the part about temp sensors, but I'm guessing you are still after text display)? What level of detail are you after and why? You need to be more specific in your question. Generic questions = generic answers.

  7. #7
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Quote Originally Posted by whiteflags View Post
    Thanks for taking the time to look for a link whiteflags, I really do appreciate it, but that video covers nothing about what I'm asking.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So click a few of the "see related article" links and see where it takes you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Well thank you for commenting, I appreciate the help. And, it's a pretty laid out question. I stated already I understood how memory is stored in the computer, but what I don't get is how the computer reads a group of bytes and knows what it means. How did the creators of the processor define the ASCII characters, or numbers, to machine language?

  10. #10
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Quote Originally Posted by Salem View Post
    So click a few of the "see related article" links and see where it takes you.
    Yeah, I did that.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Processor manufacturers don't give a hoot about ASCII (or characters in general).

    Lookup how video memory works.

    Simply, each pixel on your screen is backed by 3 bytes. You write 0xff0000 you see a red pixel. Write 0x00ff00 and it's green (guess what blue is).
    Fill in the right pixels with the correct colours, and what you see illuminated on screen is a pattern you might recognise as 'A'.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I think essentially what you are asking about is the operating system kernel.

    Kernel (computing) - Wikipedia, the free encyclopedia

    The kernel is an executable program that is loaded by the bootloader; the bootloader is a much smaller executable program that is loaded by the hardware BIOS when you turn the computer on. The purpose of the bootloader is to get the kernel loaded and running.

    Once running, the kernel is the final authority on almost everything. It contains drivers for all the hardware and controls access to it. It runs a scheduler which manages all "user space" processes. User space process are all your normal programs. The only way to start a program is via some kernel mechanism, meaning all programs interface with the kernel and are managed by it.

    So, WRT your example of how something gets to the screen, the scheduler determines if and when and for how long a particular process/program gets to run; generally they alternate very quickly, which creates the illusion of "multi-tasking". When you input something on hardware, your input goes directly to the kernel, which as mentioned monitors and controls all hardware. It passes the input on to the appropriate running process. The process, eg, your web browser, may now make an 'A' appear in the editing box on the page displayed. It does this by using the kernel interface. Actually, there are more layers in user space WRT GUI applications, but one of them interfaces -- perhaps, a user space video driver -- with the kernel video driver, and that tunnel ultimately leads to the stuff on the screen.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    @MK27 Thank you, that was very helpful!

  14. #14
    Registered User
    Join Date
    Sep 2007
    Posts
    131
    Quote Originally Posted by cplusplusnoob View Post
    Thanks guys, but again, I already know all that. What I'm asking is WHAT reads the bits/bytes and from there HOW does the computer know what to do. Someone had to preprogram the computer to know what "A" even looks like?
    This is old info pre-dating Windows, but the stuff is still there, it's just not used anymore: There are tables setup in a computer's ROM(Read Only Memory) that define 256 characters (enough to be indexed by one byte). The 'A' you're referring to is numerically 0x0041 (hex)/ 65 (dec). They are then further defined as an 8x8 matrix of 0s and 1s that tell what bits on the screen to light up (1 is on, 0 is off). I believe this is also in the BIOS, but it may have been the providence of the display subsystem.

    In the days pre-dating Windows, we used BIOS and DOS interrupts. If I recall correctly, they were interrupts 10 (BIOS) and 21(DOS). These did a lot of various functions, to include disk/tape I/O, getting/setting time, etc. It depended on what vectors you fed them and where you told them to get their info. I'll put money down that MS-Windows still makes use of the interrupts in some capacity, but not to the level we used back in the 80s.
    Last edited by Cynic; 03-29-2012 at 11:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning assembly language really helps understanding how computers work
    By movl0x1 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 05-15-2007, 01:30 AM
  2. I don't get >8 bit computers
    By jrahhali in forum Tech Board
    Replies: 7
    Last Post: 02-09-2006, 11:15 AM
  3. Program doesn't work after changing computers.
    By RealityFusion in forum C++ Programming
    Replies: 7
    Last Post: 08-29-2005, 05:17 PM
  4. Can Computers Think?
    By Ben_Robotics in forum A Brief History of Cprogramming.com
    Replies: 78
    Last Post: 07-04-2003, 12:14 PM
  5. First computers
    By itld in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 11-15-2001, 08:30 AM