LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-16-2002, 11:20 PM   #1
purpleburple
Member
 
Registered: Jun 2002
Location: USA
Distribution: Slackware8.1
Posts: 332

Rep: Reputation: 30
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!!
 
Old 08-17-2002, 04:51 PM   #2
TheCoffeeMug
Member
 
Registered: Aug 2002
Location: Faroe Islands
Distribution: Knoppix on hd
Posts: 54

Rep: Reputation: 15
Talking

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....
 
Old 08-17-2002, 10:40 PM   #3
purpleburple
Member
 
Registered: Jun 2002
Location: USA
Distribution: Slackware8.1
Posts: 332

Original Poster
Rep: Reputation: 30
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.

peace
 
Old 08-18-2002, 05:25 PM   #4
TheCoffeeMug
Member
 
Registered: Aug 2002
Location: Faroe Islands
Distribution: Knoppix on hd
Posts: 54

Rep: Reputation: 15
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:

http://www.delorie.com/gnu/docs/glibc/libc_toc.html

You could also look at some of the smaller projects at freshmeat.net, to see how usable applications are created.
 
Old 08-19-2002, 12:09 AM   #5
Robert0380
Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
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:

http://www.cc.gatech.edu/classes/AY2...lideindex.html

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.

Last edited by Robert0380; 08-19-2002 at 12:11 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange imap happenings karwoski Linux - Software 2 03-11-2005 06:46 PM
Strange wifi happenings nm+ Linux - Wireless Networking 1 12-21-2004 04:56 AM
Strange happenings at the terminal michapma Debian 9 10-07-2004 05:11 AM
VNCServer wierd happenings?? FunkFlex Linux - Networking 4 01-31-2002 06:50 PM
weird lib happenings. da Perp Linux - Newbie 0 12-21-2001 09:08 AM


All times are GMT -5. The time now is 03:32 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration