• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Does the OS has any knowledge about threads ?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Not so fast naughty spawn! I want you to know about
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic