Bochs working very slow

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yee1
Member
Member
Posts: 42
Joined: Sun Feb 10, 2013 4:02 pm

Bochs working very slow

Post by yee1 »

Hey,
I have prepared floppy image with boot sector that prints message at screen.

After message print is done then bochs starts using much CPU and my main os (linux) is working very slow. It used to take up to 22% CPU usage (of Intel i3).

I have run this image with virtualbox and all was working fine, with no high cpu usage!

What may cause it ? How to deal with it ? - no errors in bochs's console! -
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Bochs working very slow

Post by iansjack »

So, what does your boot sector do after it has printed the message? I hope that you issue a "hlt" instruction rather than just looping.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Bochs working very slow

Post by Nable »

yee1 wrote:I have run this image with virtualbox and all was working fine, with no high cpu usage!
...
What may cause it ? How to deal with it ? - no errors in bochs's console! -
That's by design. You are trying to compare two different tools.
Virtual Box is a quick&dirty emulator + nowdays it uses HW virtualization assistance.
Bochs is a very thorough simulator that tries to be as accurate as possible. So, it introduces a significant slowdown, about 10**{2..3} (btw, this is very good result among architecture emulators). For real-time simulation one shouldn't specify more than 50-100M emulated ticks per second (and that'll take 100% of the time of one of you CPU cores).
yee1 wrote:It used to take up to 22% CPU usage (of Intel i3).
...
my main os (linux) is working very slow.
(Vanga mode) that's ~25% -> 100% of one of 4 Hyper-Threads. Just as predicted. Although, I wonder why your main OS works too slow when less than a half of the CPU power is occupied. You should configure your OS better or use smth less bloated.
iansjack wrote:So, what does your boot sector do after it has printed the message? I hope that you issue a "hlt" instruction rather than just looping.
+1, IIRC Bochs won't consume much CPU time when you use HLT instead of busy-loop. Although this thing has nothing to do with the speed of emulation.
Post Reply