Menu

#127 Timing is essential: bochs clock vs. real time

long_range_goal
open
None
5
2012-10-15
2002-03-28
No

Just because the emulator is not aiming for speed it
shouldn't mean it cannot take care of timing
properly, does it?

In the windows startup menu the seconds are counted
down too fast. Doesn't the emulator read the Host-
system clock?

For some reason, not explained in the documentation,
some numbers of ips works better than others. I.ex.
if you aim for 3000000 ips it shouldn't be a
disadvantage to use this number instead of 100000
ips. Least thing you can do is explain in the
documentiation how this works.

Anyway, timing is essantial, especially when playing
games in the guest-system.

Discussion

1 2 3 .. 50 > >> (Page 1 of 50)
  • R. Yannick

    R. Yannick - 2002-03-29

    Logged In: YES
    user_id=500371

    Not sure to answer but try:

    When the emulator simulate instructions it need a clock to
    synchronise all the simulate system. But in reality an
    instruction that take 3 clocks cycle in reality need a lot
    of real clock cycle of your processor to be execute in the
    simulator. So If your simulate processor do nothing
    intensive (idle), simulate time goes quick and if you do
    intensive simulation time goes slow...

    Ryann

     
  • Bryce Denney

    Bryce Denney - 2002-09-24

    Logged In: YES
    user_id=185114

    I agree, timing is essential, and Bochs doesn't do very well
    on it yet.

    > Doesn't the emulator read the Host-system clock?
    Usually, no: only at the very beginning of the simulation to
    set the initial time of the hardware clock.

    Getting one simulated second to coincide with one wall clock
    second sounds pretty easy, but in fact it is quite
    difficult. Each instruction takes a different amount of
    wall clock time to execute. Even though it's not ideal, we
    use the number of instructions executed as our unit of time
    measurement. Then we use IPS, the number of instructions in
    a simulated second, to keep track of simulated time.

    It is tempting to try to use wall clock time to decide when
    the simulated timer interrupts occur. Unfortunately this
    makes the simulation nondeterministic, so if anything goes
    wrong there is no way we can ever reproduce the simulation
    run precisely.

    You are correct that the choice of IPS can actually cause a
    program to succeed or fail. None of the authors of Linux
    ever tested it on a 0.5 Megahertz machine, so there are some
    cases where things time out too fast. Setting the IPS to
    something closer to an actual machine, like 30 megahertz,
    brings the simulated machine closer to what the authors were
    writing for, so it's more likely to succeed in those timing
    critical areas. But then the simulator time is running much
    slower than real time, so the user interaction is bad.
    Autorepeating keys take too long before the repeat starts,
    mouse clicks several seconds apart can be confused with
    double clicks, etc. So between keeping the simulation
    realistic and keeping the user interaction ok, it's very
    hard to balance.

    Anyway, enough excuses!

    Greg Alexander has added several options that you can try.
    One can be enabled by doing configure --enable-slowdown.
    This one does use the host machine's clock to try to keep
    bochs from speeding ahead when idle. There's also something
    called realtime PIT, which tries to adjust IPS in real time
    to keep the bochs clock and system clock in sync with each
    other. (Greg can explain it better, if necessary.)

    Try
    configure --enable-slowdown
    or
    configure --enable-realtime-pit

    and see if it makes a difference. Please report how it
    works for you.

     
  • Greg Alexander

    Greg Alexander - 2002-12-02

    Logged In: YES
    user_id=125806

    Bryce does a pretty good job of summing up the issues here,
    but I thought I would just add my 2 cents.

    First and foremost, bochs is useful for software developers. It
    gives you some feedback that most other programs like it
    (i.e. VMWARE) just won't give you. One of these is
    reproducible time results. This is why the default mode relies
    on IPS to keep time with real time.

    However, I recognized the problem you describe above, and
    as such have added several time options that improve timer
    behavior for the user.

    One version is the slowdown timer, which sacrifices
    performance to preserve reproducibility while allowing host-
    time correlation.

    Another version is the realtime PIT, which sacrifices
    reproducibility to preserve performance and host-time
    correlation. This still needs some work because the model
    breaks down in several places where timer behavior is
    inconsistent from the guest perspective, but in the end, it will
    behave as described above, and it currently works for most
    things.

    The default uses neither of these, and sacrifices host-time
    correlation in favor of reproducibility and performance. This is
    the correct choice when using the bochs debugger and is
    often the correct choice for OS developers.

    What it comes down to is this:

    Reproducibility, host-time correlation, performance: choose
    two.

     
  • Nobody/Anonymous

    Logged In: NO

    MjANvf tfjvicblpfxs, [url=http://ftbvomuoegsc.com/]ftbvomuoegsc[/url], [link=http://qswdfksskmso.com/]qswdfksskmso[/link], http://apqravvvvpeu.com/

     
  • Nobody/Anonymous

    Logged In: NO

    cZzhIH jourlghpqecb, [url=http://dcmeusgszcsb.com/]dcmeusgszcsb[/url], [link=http://nchkxteanwxh.com/]nchkxteanwxh[/link], http://czeteqcufkmm.com/

     
  • Nobody/Anonymous

    5ebDNE rrzfvwbjzoih, [url=http://ycmzunirhbun.com/]ycmzunirhbun[/url], [link=http://qpcfukazkopz.com/]qpcfukazkopz[/link], http://vyheixsmarmf.com/

     
  • Nobody/Anonymous

    CgaoCa hxkhzbphrnkp, [url=http://tyutvpyjlfal.com/]tyutvpyjlfal[/url], [link=http://lbclerjcpjri.com/]lbclerjcpjri[/link], http://nvaucatvzwue.com/

     
1 2 3 .. 50 > >> (Page 1 of 50)

Log in to post a comment.