PAUSE Command

Post Reply
User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

PAUSE Command

Post by rbytes »

To Mr. Kibernetik:

How fast does the processor work during a PAUSE command? Does the processor slow down during the pause to the same speed as it does with a SLOWDOWN command?
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: PAUSE Command

Post by Mr. Kibernetik »

PAUSE command does not affect CPU load and does not slow it down.

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: PAUSE Command

Post by GeorgeMcGinn »

So if I put a PAUSE in a loop, it doesn't affect CPU load?

Wouldn't it stop the loop, thus relieving the CPU From executing all those clock cycles?

I guess it would depend on where the PAUSE was placed. I would agree all memory used will not be released.



Mr. Kibernetik wrote:
Wed Jan 30, 2019 5:34 am
PAUSE command does not affect CPU load and does not slow it down.
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: PAUSE Command

Post by Henko »

GeorgeMcGinn wrote:
Wed Jan 30, 2019 7:54 am
So if I put a PAUSE in a loop, it doesn't affect CPU load?

Wouldn't it stop the loop, thus relieving the CPU From executing all those clock cycles?

I guess it would depend on where the PAUSE was placed. I would agree all memory used will not be released.



Mr. Kibernetik wrote:
Wed Jan 30, 2019 5:34 am
PAUSE command does not affect CPU load and does not slow it down.
Like mr.K. says, the PAUSE statement does not render the processor inactive, but the SLOWDOWN statement does for a short periot of time. On my iPad 2018, each execution of SLOWDOWN halts the cpu for about 54 millisec. Hence, in a loop waiting for an user response, the SLOWDOWN staement must be placed inside the loop (where the battery saving effect is needed).

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: PAUSE Command

Post by rbytes »

If a PAUSE does not slow or stop the processor, it seems that Mr. K did not see the need for it. We all use PAUSE commands whenever we need them, with no concern over the processor being overworked. Why then is there so much concern among my fellow users about stressing the processor? I don't recall one of mine ever failing from overwork (unlike humans!) 😱

Unless I hear otherwise from Mr. K, I will continue to fearlessly use PAUSE in my various routines. ⏱
The only thing that gets me down is gravity...

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: PAUSE Command

Post by Henko »

It's the battery savings. I once had a SB program that made contract calculations. When i left it kind of active in the background, the battery would deplete very quickly. After inserting SLOWDOWNS in some placed, this was repaired.

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: PAUSE Command

Post by rbytes »

Yes, I have the same experience.

But I have many programs that use PAUSEs to create delays of a few seconds in such programs as slide shows, quizzes, speech, music, etc. I have not noticed any increase in battery consumption compared to other programs.

If battery consumption during PAUSEs was an issue, I believe that Mr. K would have incorporated the slowdown effect within them.
The only thing that gets me down is gravity...

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: PAUSE Command

Post by GeorgeMcGinn »

When a processor runs at max for extended period of times, heat builds up and can melt components on the motherboard. That happened with my last PC. The repair shop said the circuitry inside the processor melted. I've had memory cards also melt when running production at Verizon as well as motherboards.

It happens. That is why I turn all my equipment off every night.



rbytes wrote:
Wed Jan 30, 2019 3:00 pm
If a PAUSE does not slow or stop the processor, it seems that Mr. K did not see the need for it. We all use PAUSE commands whenever we need them, with no concern over the processor being overworked. Why then is there so much concern among my fellow users about stressing the processor? I don't recall one of mine ever failing from overwork (unlike humans!) 😱

Unless I hear otherwise from Mr. K, I will continue to fearlessly use PAUSE in my various routines. ⏱
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: PAUSE Command

Post by GeorgeMcGinn »

Like I said. A pause will free up the CPU cycles the loop was using, but I never said the CPU stops completely. Items stored in memory the CPU needs to protect the addresses so no other process overwrites them.

I never said the CPU stops or is rendered inactive – just frees up the resources used by the loop. This is Computer 101, and applies to every computer, including mainframes.

PAUSE and SLOWDOWN only applies to the SmartBASIC task. It has no effect on other tasks running.

Henko wrote:
Wed Jan 30, 2019 9:42 am
GeorgeMcGinn wrote:
Wed Jan 30, 2019 7:54 am
So if I put a PAUSE in a loop, it doesn't affect CPU load?

Wouldn't it stop the loop, thus relieving the CPU From executing all those clock cycles?

I guess it would depend on where the PAUSE was placed. I would agree all memory used will not be released.



Mr. Kibernetik wrote:
Wed Jan 30, 2019 5:34 am
PAUSE command does not affect CPU load and does not slow it down.
Like mr.K. says, the PAUSE statement does not render the processor inactive, but the SLOWDOWN statement does for a short periot of time. On my iPad 2018, each execution of SLOWDOWN halts the cpu for about 54 millisec. Hence, in a loop waiting for an user response, the SLOWDOWN staement must be placed inside the loop (where the battery saving effect is needed).
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: PAUSE Command

Post by rbytes »

I just modified my pause routine and renamed the function as "sleep". I posted it in Libraries, but want to show it here too to explain the results I get. I have marked the lines that are only needed to demonstrate the function with '***

There is now a SLOWDOWN inside the loop within the function. It has a large effect on the loop. To compensate, I had to multiply line 6 of the function by .45 to shorten the PAUSE length so that the sleep time would be accurate. Try commenting out *.45 from that line and compare the actual sleep time with the number of seconds you called for.

My two screen shots show the actual sleep time (compared to the specified time of 10 seconds) with the error correction and then without it. The SLOWDOWN in my loop causes it to sleep over 1.5 times the specified length!

time reset '***
get screen size sw,sh '*** (if screen size is read at the start of the program)
sleep(10)
print time() '***
end '***

def sleep(dur)
set buttons font size 50
button "wake" text "⏰" at .sw/2-50,200
zzz=dur*10
do slowdown ! z+=1
pause (dur/zzz)*.45
until z>zzz or button_pressed("wake")
button "wake" delete
end def
Attachments
DB1FBB34-DF5A-44CF-B06D-192F9C821615.png
DB1FBB34-DF5A-44CF-B06D-192F9C821615.png (85.62 KiB) Viewed 3210 times
AA1DB5F0-7710-4306-A22F-ABE8F1A83CF2.png
AA1DB5F0-7710-4306-A22F-ABE8F1A83CF2.png (85.21 KiB) Viewed 3210 times
The only thing that gets me down is gravity...

Post Reply