When look deeper into tracing what happens when print() is casted
I tried to minimize all codes – copied code of sieve into rpiinit.b, removed everything extra, so whole rpi start does only math/sieve.
Then if press ^T^Tp (Ctrl+T,Ctrl+T,p) I see in console list of processes (not dis progs, but processes):
idleticks:0
f3e148: 1: interp 0:09.580 pc 0004ef18 New/Ready qpc 00000000 pri 7
f3e5b8: 2: consdbg 0:00.080 pc 000083e4 kproc/Running qpc 00000000 pri 3
f3ea28: 3: dis 0:33.250 pc 0007b364 kproc/Ready qpc 00000000 pri 7
Additionally I implemented cpu time counting for processes so you see it in third column.
interp is rpiinit.b which starts sieve, but we see that for some reason a lot of time is spent in another dis process.
It looks like a bug with processes scheduling.
Let’s take a look deeper into the codes – for examples kwrite() syscall (where prints lead into) ends with acquire() so the execution is bypassed to next process.
In next process there is nothing todo (process number 3) so it executes execatidle() (see codes in os/port/dis.c which start garbage collection.
Because math/sieve produces a lot of prints, then every print() syscall forces garbage collection!
Performance, loop 3
When look deeper into tracing what happens when
print()
is castedI tried to minimize all codes – copied code of sieve into
rpiinit.b
, removed everything extra, so whole rpi start does only math/sieve.Then if press ^T^Tp (Ctrl+T,Ctrl+T,p) I see in console list of processes (not dis progs, but processes):
Additionally I implemented cpu time counting for processes so you see it in third column.
interp
isrpiinit.b
which starts sieve, but we see that for some reason a lot of time is spent in anotherdis
process.It looks like a bug with processes scheduling.
Let’s take a look deeper into the codes – for examples
kwrite()
syscall (where prints lead into) ends withacquire()
so the execution is bypassed to next process.In next process there is nothing todo (process number 3) so it executes
execatidle()
(see codes in os/port/dis.c which start garbage collection.Because math/sieve produces a lot of prints, then every
print()
syscall forces garbage collection!