0

I wonder if there is any way of adding thread to specific process just to prove that number of thread which are assigned to process can be changed by user. If so, how could I do that ?

[root@195689 ttyid:0 pią maj 29 11:03:05 ~]# ps -o pid,lwp,nlwp,comm -L -p 1969
PID   LWP NLWP COMMAND
1969  1969    8 midori
1969  1970    8 gdbus
1969  1971    8 midori
1969  1973    8 midori
1969  1976    8 dconf worker
1969  1979    8 gmain
1969  1984    8 midori
1969  1985    8 midori
[root@195689 ttyid:0 pią maj 29 11:03:32 ~]# ps -o  pid,lwp,nlwp,comm -L -p 1969
PID   LWP NLWP COMMAND
1969  1969    9 midori
1969  1970    9 gdbus
1969  1971    9 midori
1969  1973    9 midori
1969  1976    9 dconf worker
1969  1979    9 gmain
1969  1984    9 midori
1969  1985    9 midori
**1969  2025    9 pool**
[root@195689 ttyid:0 pią maj 29 11:03:53 ~]# ps -o pid,lwp,nlwp,comm -L -p 1969
PID   LWP NLWP COMMAND
1969  1969    8 midori
1969  1970    8 gdbus
1969  1971    8 midori
1969  1973    8 midori
1969  1976    8 dconf worker
1969  1979    8 gmain
1969  1984    8 midori
1969  1985    8 midori

How could I add thread 'pool' like in the second listing ?

4

Adding a thread to a process is something that only the process itself can do. (Or a debugger, but then it's up to you to specify what that other thread will do.) Threads are not assigned by the operating system, they're created by the program.

A thread executes code. “Adding a thread” will not magically create some code for the thread to execute.

just to prove that number of thread which are assigned to process can be changed by user

You won't be able to prove it because that's not the case at all, it doesn't make any sense.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.