This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does the OS has any knowledge about threads ?  RSS feed

 
Ramalingam Vijayakumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have got a doubt..
Will the Operating Sysytem knows that there are threads inside a process???
If so ...from where it gets the information ??
thanx in advance..
bye
ram.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Solaris, the answer is no. User-level threads run from a library that looks no different to the kernel than a single-threaded process.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Ken Savela
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Ernest:
In Solaris, the answer is no. User-level threads run from a library that looks no different to the kernel than a single-threaded process.


Technically speaking, this is a true statement but only because Solaris supports light-weight processes (LWPs) which are known to the OS and look very much like what we would generally call a "thread". From a native application (C, C++, etc.) perspective, a thread may be either bound to an LWP or not. Unbound threads are run, as needed, from a pool of LWPs that do not have a thread bound to them and whose reason for living is to run unbound threads. For more information, see Mauro, Jim and Richard McDougall. Solaris Internals: Core Kernel Architecture

Windows NT/2000/etc. threads are more analogous to Solaris LWPs in that the OS "knows" about them. Windows also supports something called "fibers" which are application-scheduled threads but I've only read about them - I've never used them.

A Linux thread is actually yet another process (each of them have their own pid) that shares address space, etc. with the original thread.

Now, since this is the Java Ranch, I'm pretty sure the original poster was referring to Java threads. I'm just guessing but I'm pretty sure that this depends on the implementation of the VM that you're running. I think that early versions of the Java VM for Linux implemented their own threading due to a lack of support for threads under really early versions of Linux (forgive me if my recollection is incorrect). I'm pretty sure, however, that the later VMs use native threads so the question of whether the OS knows about your Java threads depends on whether the OS knows about native threads.
I know that, when I run something like Forte for Java under Linux, a "ps -ef" listing shows dozens of threads so I think you can be pretty sure that the OS will know about threads or, in the case of Solaris at least, LWPs.
Ken Savela
kensavela@hotmail.com
[This message has been edited by Ken Savela (edited September 19, 2001).]
[This message has been edited by Ken Savela (edited September 19, 2001).]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!