Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

assembly program...

Options
  • 18-12-2006 12:25am
    #1
    Registered Users Posts: 26,579 ✭✭✭✭


    just wondering i've just completed an assembly assignment there for college which i had to simply get my name scrolling across a single line of the screen and stop by pressing the last letter of my name, why does my program take 50% cpu usage when the program is running.

    now i'm running a core duo2 cpu and not that there's any slow down while it's running, it just seems odd to take up that much cpu usage.

    anyone have any idea why this is so?


Comments

  • Registered Users Posts: 30,269 ✭✭✭✭Ghost Train


    probably because it's a standard simple linear program accessing the cpu directly, if it was an object orientated windows app it would pass its instructions through the windows os which manages the cpu instructions and might be more efficent, sort of the same reason if youre running some old dos games they will fly along at unplayable speeds


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    probably because it's a standard simple linear program accessing the cpu directly, if it was an object orientated windows app it would pass its instructions through the windows os which manages the cpu instructions and might be more efficent
    Nope, not at all. It uses 50% because your program is single threaded. A single thread can only operate on a single core at any instant (no guarantees about which core it'll be running on though). So 50% usage is *exactly* what you'd expect on any dual core chip when your application is single threaded. If you wanted to hit 100% CPU usage on your C2D, either run two copies of your app at the same time, or (not sure how to do this myself) create two threads in assembly and make em both print your name to the screen.
    sort of the same reason if youre running some old dos games they will fly along at unplayable speeds
    Not really, being simplistic about it, dos games fly along because a lot of them work on a 1 frame = 1 tick. Old computers would manage about 20-30 frames a second, and so gameplay would be about 20-30 ticks a second. This meant the game was enjoyable and playable. New computers could churn out 200 frames a second, meaning gameplay is about 200 ticks per second which is far too fast.


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    As Mutant_Fruit says it's maxing out at 50% CPU because it's running as a single process on one core. The reason why it is getting to 50% is due to the way you have coded it. You probably have it looping flat out in core running some kind of artificial delay and the comparison.


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    cheers lads, my knowledge now is much better.


Advertisement