Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% browser CPU usage even though guest OS "idle" #3

Closed
ysangkok opened this issue Apr 19, 2013 · 3 comments
Closed

100% browser CPU usage even though guest OS "idle" #3

ysangkok opened this issue Apr 19, 2013 · 3 comments

Comments

@ysangkok
Copy link

This usability issue makes jslm32 turn the fans of laptops. Some people even get afraid that their laptop breaks if the CPU fan starts spinning. So I think it's a pretty major issue since it's discouraging people from using this over jsLinux.

I don't know if the LatticeMico supports anything like the x86 HLT instruction, if it doesn't I can see how this might be very hard to prevent, as I don't know how the emulator would know if the guest is idle.

jsLinux does not consume 100% CPU time when "idle".

@ubercomp
Copy link
Owner

Yeah... This one is a bummer. Unfortunately, as far as I know (and I might very well be wrong here), the architecture doesn't give me a way to know that the guest is idle. If I were to get serious about this, i.e. build an emulator to run real applications, the 100% CPU issue would of course have to be solved, which means I would probably have to go for Intel or ARM. The reason I did LatticeMico32 was just because I wanted to know if I could and LM32 was the easiest target I could find. Also, I wanted a "dynamic recompilator" instead of just an interpreter.

@ysangkok
Copy link
Author

According to Wikipedia, the HLT instruction requires ring 0 access.

As I see it, that leaves us with two options:

  • Find the place in the Linux kernel where the HLT instruction would be called and make the emulator wait e.g. 10 ms when the instruction pointer reaches that address.
  • Modify the instruction set and use the instruction in Linux. The requires patching Linux, so I guess it's a bad idea. Though it's a bit less hackish in some aspects, especially if it could be done in a backward-compatible way.

@ysangkok
Copy link
Author

Closing this since it is unactionable (we can't know whether the guest is idle).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants