weird C happenings ......
Hi. I am fairly new to C. I am messing around with really simple stuff right now trying to get a grip on the basics. Anyways ... I observed something that confused me in Linux after making a simple (really simple) program that just prints a series of '*' to standard out over and over 10000 times creating a line that just runs down the screen until LIMIT 10000 iterations is complete. It worked as it should, but executing the program in an xterm the program finishes its 10000 prints of 'printf("* *\n");' (using a 'for' loop of course) to standard out 'much' quicker in seconds than out of x windows just at the prompt .
Just wondering why this is?
new to C and linux and in Love with them both!! :)
When you are in a non-graphical console, on charter is represented by one byte in the memory of the graphics card (2 bytes if you count the colour too). The videocard's bios then draws the corresponding character on the screen. When you are in xwindow (graphic mode) then each charter must be drawn by a program pixel by pixel, and this is much more time consuming than changin two bytes... If you make a console program than scrolls alot, a large section of the screen must be redrawn often. That is why it's so slow....
thank you very much ... that quenches my curiousity. The video card has a BIOS that draws to the screen?? Didn't know that. How do I find out such things? google search? ' video chip design' or similiar? There's really alot I don't know about computers such as the internal workings of the CPU and what's 'really' happening. Learning programming will hopefully be a first step in a simplistic understanding of the 'inner workings' and assembly will hopefully help me get a little closer too. But I really think that my interest in computing has and always will be whats happening inside the chips and stuff. I find that to be the amazing part of computing rather that the top layer we call programming. That's probably a whole different field though ... electricity, logic gates, algorithims, . and microscience. That's what im really interested in. Thanks for the help on my questions.
Man ... 3 years ago when I first got my computer and turned it on staring at Windows 98 SE I had no idea that Windows wasn't 'part' of the computer embedded somehow into the board. After spending countless hours on my comp in the last years I've figured out that the OS has nothing to do with the computer really. It's just somebod's program sitting on top of hardware. How 'they' want the system to do things etc. Since Linux and beginning programming I've seen that computing is really in our hands and not Bill Gates or Microsofts or some company telling us THIS is how it will be done.
The you should consider an education in the field of electrical engineering or computer science, if it is possible.;)
Designing logical circuits is alot like programming. There isn't a clear boundary between what's software or hardware. Both have their anvantages and disadvantages.
It's is a good idea too learn C, as you are doing now. A good understanding of C, will also give you insight in how the computer works.
You can read more about the GNU C library at:
You could also look at some of the smaller projects at freshmeat.net, to see how usable applications are created.
i would also recommend learning datapaths, a good start is the single cycle data path, it will help you understand the inner workings of the CPU, learning datapaths also includes learning some assembly (not 2 hard if you dont try to go too deep). Also learing how things are stored in memory helps. Getting some idea of how things are stored in memory during the life cycle of a program will help when you start dealing with pointers and storage classes (static, register, volatile, extern) i'll give a link to some lecture slides after i stop rambling.
Note: using register isnt really needed, its a suggestion to the compiler to store a variable in a register for faster access but todays compilers are much smarter than the programmer and know weather or not a value needs to be kept in a register.
here is a link to the lecture slides used in a CS class i took:
some of these slides are vague and frustrating, kinda had to be in class to get it and i missed a few lectures but anyway if you notice hardware is one of the 1st lectures. Enjoy, oh....the stuff at the end was on lex and yacc which is more compiler related.
|All times are GMT -5. The time now is 03:12 AM.|