Wednesday, May 26, 2010

Some notes on Rocks and how Ruby cycle is bumped

end_cycle()  in bx_ruby_main.cc gives up the control from the current cpu and then the system calls choose_next_thread and setup the stack for the next cpu to run.

choose_next_thread in bx_ruby_main.cc try to find a cpu that is not stalled and has some work to do.

cur_ruby_cycle in bx_ruby_main.cc counts the number of ruby cycles executed.

calling end_cycle until the current_ruby_cycle is the same as the some future time, this allows a particular operation to take 10 cycles. Shown in the following:
    int new_time = cur_ruby_cycle + 10;
    while(new_time != cur_ruby_cycle) {
      BX_INFO(("waiting the current ruby cycle %ld", cur_ruby_cycle));
      end_cycle();
    }

No comments: