GeeCON Prague 2014*
The moose likes General Computing and the fly likes Please Help me Out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Please Help me Out" Watch "Please Help me Out" New topic
Author

Please Help me Out

Pratap Pandey
Greenhorn

Joined: Jun 27, 2007
Posts: 2
There was a question asked to me in one of my interview (although its not about a code snippet or some logic) and i want to share it with you all.

Which one is better Multiprocessing or Multithreading ? and why?


please explain me.
Shoumin Li
Ranch Hand

Joined: Jul 06, 2007
Posts: 85
It's not easy to tell which is better,they are not the same concept:
MultiProcessing refers to a computer system's ability to support more than one process (program) at the same time. Multiprocessing operating systems enable several programs to run concurrently. UNIX is one of the most widely used multiprocessing systems, but there are many others, including OS/2 for high-end PCs. Multiprocessing systems are much more complicated than single-process systems because the operating system must allocate resources to competing processes in a reasonable manner.
Multithreading means the ability of an operating system to execute different parts of a program, called threads, simultaneously. The programmer must carefully design the program in such a way that all the threads can run at the same time without interfering with each other.


Java Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
I'm not really sure that it still makes sense to use the term multiprocessing, because every OS does that these days. You can test that by writing a simple program that does nothing but print numbers to the console. Open two consoles, start the program in both, and you'll see that they are both progressing.

Are you sure the question wasn't about multi-processor systems?


Ping & DNS - my free Android networking tools app
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344


I'm not really sure that it still makes sense to use the term multiprocessing, because every OS does that these days. You can test that by writing a simple program that does nothing but print numbers to the console. Open two consoles, start the program in both, and you'll see that they are both progressing.


Thats a good answer Ulf. Of course, though almost all the processors are designed in the same way, i think the terms are still existing atleast for the sake of differentiation. Aint I?


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Raghavan Muthu:
though almost all the processors are designed in the same way,


Please correct me if I am wrong.
Operating system level multiprocessing is achieved by operation system's scheduler, nothing to do with the processor.

The microprocessor sees it just like sequential execution of instructions.Multiprocessing is achieved by time slicing , that is done by the OS scheduler.


Rahul Bhattacharjee
LinkedIn - Blog
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Though my intention was the same, but it was not expressed correctly.

Thanks for correcting Rahul.
 
GeeCON Prague 2014
 
subject: Please Help me Out