[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squeak-vm-dev
Subject:    Re: [Vm-dev] Use less CPU (improve battery life or reduce cost in the cloud)
From:       Holger Freyther <holger () freyther ! de>
Date:       2017-09-08 16:24:44
Message-ID: D535F43A-7198-4405-8FFF-092BB1BCE8FF () freyther ! de
[Download RAW message or body]

 

> On 6. Sep 2017, at 05:45, John McIntosh <johnmci@smalltalkconsulting.com> wrote:
> 

Hey!



> self relinquishProcessorForMicroseconds: 1000
> 
> In ioRelinquishProcessorForMicroseconds it would call getNextWakeupUsecs() to get \
> the time when the next Process had to wake up. This always would be the Morphic \
> event loop. In Cuis Smalltalk this could be as much as 20 seconds btw. 


I think Squeak and Pharo should increase the timeout parameter for the relinquish \
primitive as well (or as proposed by Bert a new primitive to go to sleep)




> sqInt
> ioRelinquishProcessorForMicroseconds(sqInt microSeconds)
> {


> else {
> realTimeToWait = nextWakeupUsecs - utcNow;
> 		if (realTimeToWait < microSeconds)  // so wait 1000 microseconds or longer not \
> just 1000 microseconds   realTimeToWait = microSeconds;

So this is:

	timeToWait = MAX(MicroSecondsToNextDelayTimeout, microSeconds)


and it means we will sleep longer than when the next delay is due? This might be the \
reason the system is consuming less CPU? Do I understand this correctly?



> I'm sure I changed the Mac VM to signal the event semaphore on pending events about \
> 15 years ago.

Yes it does signal the semaphore but it seems that it requires the event loop to be \
"pumped" periodically? Can you confirm it? Is there a way to get a fd for the event \
loop?


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic