[NBLUG/talk] Java v. C++ in Linux
Chad Krsek
ckrsek at yahoo.com
Tue May 6 22:36:01 PDT 2003
--- "William L. Thomson Jr."
<support at obsidian-studios.com> wrote:
> On Wed, 2003-05-07 at 00:16, Chad Krsek wrote:
> >
> > That is not necesarily true. Depending on the
> thread
> > library you use, a c++ can made to run at the
> kernel
> > level. Therefore it will be scheduled like any
> other
> > process (i.e. the term lightweight process). This
> is
> > the main benefit of multi-threading, in my
> opinion.
>
> Can you provide an example of this? What is the
> difference between a
> normal C++ thread and a kernel level C++ thread?
"Kernel threads are known to the scheduler."
"User level threads, or coroutine threads, are not
known to the scheduler"
This and a larger explanation is at
http://www.cs.ucsd.edu/classes/fa97/cse30/lec15/
I learned about it in an operating systems class at
Sonoma State U.
> Are you speaking of the priority level of the
> thread?
>
> > There is no specification as to how Java threads
> are
> > to be implemented. They may map 1 to 1 to a
> kernel
> > level thread, or they may be confined to a single
> user
> > process. If that is the case, that means n threads
> > simply split the time allocated to the one user
> > process.
>
I read it on pg145, section "Java Threads" in the book
"Operating System Concepts".
> In my experience when ever I create a thread in Java
> I end up with two
> or more processes depending on how many threads I am
> creating.
>
> Same thing goes for every multi-threaded Java app I
> have worked with?
>
> What do you mean by 1 to 1 mapping?
One thread you create, mapped to one process the CPU
can see and will schedule, versus n threads mapped to
one process.
>
> I have never seen the JVM running say 10 threads but
> only 5 showing up
> as processes in the system.
>
> For every thread I create in Java I have a process
> to go with that
> thread. I have never tried to adjust the priority of
> the thread, and I
> am not sure if you can with Java. I would imagine
> you could though.
>
> > I wasn't clear about the variablity of Java
> threads,
> > as dependent on the OS, but I think this unknown
> makes
> > the C++ option better.
>
> I still do not understand what you mean by
> variability of the threads. I
> think I know what you mean but I have not read
> anything about this, nor
> have I seen that to be the case.
>
> Can you provide links?
>
Here's further explanantion of how the Java VM handles
threads.
"About Linux Threads"
http://developer.java.sun.com/developer/technicalArticles/Programming/linux/
And an explanantion of the kernel level vs user level.
"What's the diffence between green threads and native
threads?"
http://developer.java.sun.com/developer/qow/archive/97/index.html
I'm just an undergrad with little experience, so I'll
shut up and go to bed now. Goodnight.
> --
> Sincerely,
> William L. Thomson Jr.
> Support Group
> Obsidian-Studios, Inc.
> 3548 Jamestown Ln.
> Jacksonville, FL 32223
> Phone/Fax 904.260.2445
> http://www.obsidian-studios.com
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/mailman/listinfo/talk
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
More information about the talk
mailing list