When I run a multi-threaded java program, on doing a ps -eF | grep program-name I see only one process. The threads running as part of this process are sub-processes. Does the OS treat a single threaded and multi-threaded process differently in terms of scheduling?
Asked
Active
Viewed 102 times
0
-
1Maybe a duplicate question, but there are some nice resources: http://stackoverflow.com/questions/8463741/how-linux-handles-threads-and-process-scheduling – gusto2 Feb 17 '17 at 08:49
-
Thanks ! http://www.linuxquestions.org/linux/articles/Technical/Linux_Kernel_Thread This link provides a very good insight – Abhijeet Feb 20 '17 at 07:57
1 Answers
0
No, There is uniform treat for single threaded or multithreaded process. OS perceives a process as a collection of threads and schedules thread only; It is the priority of the process that changes the whole game of Scheduler's selection only if it is considered or valued (overrule)
Java does not schedule, it delegates scheduling to underlying OS. Each OS has their own prefer way of scheduling. Typically, above can be stated (There might be exception!)

The Mighty Programmer
- 1,242
- 12
- 23
-
1If the process is divided into threads such that more than one of them is runnable at the same time, more than one of them will be run. You cannot make blanket statements such as this. – user207421 Feb 17 '17 at 08:34
-
@EJP theBeacon did not claim anything else. Indeed the OS process may have multiple threads and it depends on the OS scheduler to schedule the threads. A single thread process is as well a process with threads (well - a single one). Btw - the priorities should be considered only as hints and there's no guarantee the threads with higher priority will get more CPU time – gusto2 Feb 17 '17 at 08:40