File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Multitasking and Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Multitasking and Threads" Watch "Multitasking and Threads" New topic
Author

Multitasking and Threads

Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
I cam across following question about threads in Marcus site:
Are threads equivalent to multi-tasking?
a) True
b) False

According to me the answer should be a) but the answer is false.
Can anybody explain why? Any help will be appreciated.

Regards
Abhijit
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
Where did you find this question? I always try to give a reasonably detailed explanation of the thought behind my questions.


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
Hi Marcus,
Extremly sorry for the miscommunication. The question was from some other mock test.
Chandrahas Tore
Greenhorn

Joined: Oct 05, 2005
Posts: 6
Hi Abhijit,

To answer this question you first need to know what is multitasking. It means a multiple tasks can be runned in a single process/program. It's different from multiprogrammimg. To achieve multitasking a process creates multiple threads. These threads then do a particular job/task. So at a time a thread can do a single task. Hence threads are not multitasking.

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979



To answer this question you first need to know what is multitasking. It means a multiple tasks can be runned in a single process/program. It's different from multiprogrammimg. To achieve multitasking a process creates multiple threads. These threads then do a particular job/task. So at a time a thread can do a single task. Hence threads are not multitasking.






Surmise:

Threads can be used for implementing multi tasking ..?

Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
One of the reasons I asked was that it did look very much like a version of a question I used to have. I think I changed the text to read "is the same as" rather than equivalent to. The problem is that I have about 800 odd questions in various pages and databases and it gets hard to trace them. Of course I often see question "by other people" that look very very similar to mine. This is why some of my questions have some very odd variable names in them that match up to various people, places, cats, dogs I have known ....

But to give an analogy that illustrates the point behind the question.

Windows 3.x supported multi tasking but not multi threading. You could have multiple tasks or programs running but it did not support multiple paths of execution within one program. This was one of the reasons why it would have been very difficult to port Java to windows 3.x. I don't think you will get that type of overall conceptual question on the exam, but if you understand that concept then you will be more likely to understand the questions that do come up.

One other important feature of threading vs multi tasking is that threads can directly share data whereas multiple executing programs do not directly have access to each others data.

The SCJP exam does like to test you knowlege of Threading, and it is a fairly difficult topic so write plenty of practice code. Note that some Thread behaviour is "non deterministic", meaning you cannot know for certain what will happen, even if the same sequence of events run on 100 times on your machine it might not give the same result on attempt 101. So this is one area where it is very, very important to understand the ideas behind the code.

Marcus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multitasking and Threads