• 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
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Diff. betn multithreading and multiprocessing

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello! ! !
java guys! ! !
can anybody tell what is the difference between
multithreading and multiprocessing in java.
please i want it in quiet detail.
so i am waiting for possible replys guys.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would say that multiprocessing is two or more physical, actual processors inside one computer. They are both doing work at the same time, and perhaps on the same 'jobs' or different jobs. A high powered OS would be required to utilize this sort of setup, and it also involves some hardware considerations, because now there are 2 or more processors getting in on the action.

A multithreaded program utilizes the power of one single processor to appear to be doing more than one thing at a time, while in fact, each job is merely time-sharing the processor. The processor only does one thing at at time, but because it only spends 20 milliseconds on each job at any given time, it appears to slow humans that it does multiple things at once. This is also implemented by the OS (and different ones do it differently), but also, programming languages either support or do not support individual 'threads' of operations within a single program!
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... I would have thought that multiprocessing involved multiple processes, not necessarily multiple processors. Multiple processes can run on a single processor because the processor does the work of switching from one process to another, very similar to the way the JVM switches between threads in a multi-threaded situation. The differences are:
Multiprocessing Multithreading
OS controls switching JVM controls switching
Different processes can use different languages Threads all use the same language (e.g. Java)*
Each process has its own JVM All threads share a single JVM (running in a single process)

However I may be misinterpreting the terminology here - I trust someone will speak up if this is the case.
* This is excluding the use of the Runtime exec() command, which of course allows you to use all sorts of other non-Java programs and languages. Still, those other languages are being accessed through Java.
[This message has been edited by Jim Yingst (edited June 25, 2001).]
 
parimal patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank u very much! ! !
to both of you ! ! !
Mike and Jim ! ! !
This will really help me in understanding the concept.
But still what makes me confused is the concept of Multiprocessing.
Mulrithreading is quite clear.
In multiprocessing , the concept of two processors is quite confusing to me as both of these process are quite complicated to understand.
And I also know this is the question which everyone asks.
But your answers are really great.
so, thanks to both of u again.
Parimal
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, this sort of thing always gets me confused as well. Helped by the fact that different people call the same thing by different names. Multi-processor, multiprocessing, multithreading...

If Unix forks, is that not another 'thread' of excecution, but not the same kind of 'thread' as we think of when we implement the Runnable interface in Java, because perhaps the fork is for a separate program.

A single program written in a language that supports threads is different than an OS that supports multitasking (yet another word), whether it be preemptive or time-shared.

If I have a Java program running that takes a VERY long time to process a certain data chunk, i'll thread that process. So that when I click the "cancel" button on my GUI, it can actually hear it and react by gracefully killing the thread, and I get my program back. But what if I'm also running MS Word and Netscape Navigator... Each of these programs also has it's own thread of execution, which is possible because the OS can do multitasking (or how I maybe should have used the word... multiprocessing).
I tend to think of a single processor doing multiple things as multitasking, a single program that does multiple things as a multithreaded program, and a machine that has two or more processors as multiprocessing/multiprocessor.

But that's only my words.
 
This tiny ad is suggesting that maybe she should go play in traffic.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic