WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: >how to run shell scripts and commands from each core.  (Read 2071 times)

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
>how to run shell scripts and commands from each core.
« on: January 22, 2023, 03:53:47 AM »

question in title found in this
http://forum.tinycorelinux.net/index.php/topic,26077.msg167307.html#msg167307
tc 14.0 Alpha post

Maybe this is silly question ??
Is it possible to make tc boot faster ??
I thinking of like bmarcus does with picore use the python capabilities to extract the extensions in one core each.
Have seen some problems with that because of not having control of the extractions order of the deps. 
But i think's it's work very well.

I don't know how that can be accomplished with the ordinary tc.
Maybe make some type of depending tree of how and what order the extensions extract.
I don't know how to run shell scripts and commands from each core.
What commands have the capabilities to do that.

Just having only one command in mind that spans the commands in separate cores.
Yes you are right, the make command with it's -j argument.
 
Thats all.
PS. And thx for this os


an initial forage
  • * indicated  taskset command


a little more digging [1]* found a bit more in-depth write up suggesting numactl command

iv only relay scanned through the below links to try and get the gist of possibility's


Q) >how to run shell scripts and commands from each core.
A) with numactl or taskset command's

if any one reading has any less theoretical  ;) perspectives that might be relevant ?...


1.0) https://www.glennklockwood.com/hpc-howtos/process-affinity.html
1.1) https://glennklockwood.blogspot.com/2012/07/braindead-thread-scheduling-in-linux.html

0.1) https://serverfault.com/questions/363348/how-can-i-run-command-and-select-core-to-be-used
0.2) https://serverfault.com/questions/345687/assigning-processes-to-cpu-cores



see also
https://www.kernel.org/doc/html/next/admin-guide/kernel-parameters.html
https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
https://docs.kernel.org/admin-guide/mm/numa_memory_policy.html
https://github.com/numactl/numactl
https://en.wikipedia.org/wiki/Amdahl's_law

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: >how to run shell scripts and commands from each core.
« Reply #1 on: January 22, 2023, 12:58:02 PM »
GNU parallel perhaps?
The only barriers that can stop you are the ones you create yourself.

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 278
Re: >how to run shell scripts and commands from each core.
« Reply #2 on: January 24, 2023, 08:33:35 AM »
taskset is in util-linux.tcz and works to select which core a process runs on. I'm not sure where this gets you though. If you just want to start multiple processes, Busybox ash supports subshells for starting multiple processes and the Linux kernel will pick free CPU cores to run them on by itself (I don't really see why Python was used for this on PiCore either, for that matter).

But what I've seen said before on this forum (but never got around to verifying myself) is that the main bottle neck is creating the symlinks to the mounted squashfs extension file. Maybe this means that the real issue is the time it takes for the Linux kernel to process each symlink call, in which case multi-threading the loader program won't help because it's not the part that's holding things up?

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 708
Re: >how to run shell scripts and commands from each core.
« Reply #3 on: January 24, 2023, 10:56:48 AM »
You have to ask @bmarkus for chosen mikropython to do the thread thingy.
He maybe want to test if it was possible to use that for speeding up the extracting of the extensions.

What you saying is that ash have something we can use to accomplish what we wants to do.
But maybe ash don't have great tools to control the subprocesses like mikropython have.

Some curiosity to this, is this line.
Subprocess calls Subprocess calls Subprocess calls Subprocess calls Subprocess calls ......and so on..... 
It's a fork bomb, or maybe accurate name should be pipe bomb.
The functions defines it's name as ":", and the code calls for it self and pipes it's output to it self in background, and end of function. And after it's functions code it's calls the defined function named ":".
Don't paste this code in your terminal, it's waste of your cpu cycles.
WARNING! These examples may crash your computer if executed.
Code: (bash) [Select]
:(){ :|:& };:
« Last Edit: January 24, 2023, 11:19:13 AM by patrikg »