Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Java Tutorials



Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Java Notes

Thread Questions

Name _______________________________

  1. Which areas of memory do separate threads share? Circle all that are correct.
    1. Call stack
    2. Heap
    3. Static memory
    4. They don't share any memory.
  2. If cooperative multithreading is used, which of the following causes a thread to give up use of the CPU? Circle all that are correct.
    1. Expiration of its time-slice.
    2. Blocking by an IO request.
    3. A call to yield().
    4. Call to a synchronized method which is being executed by another thread.
    5. Call to a unsynchronized method which is being executed by another thread.
  3. Which are correct statements about processes / tasks and threads? Circle all that are correct.
    1. Processes share the same virtual memory; threads do not.
    2. The communication cost is lower between threads than between processes.
    3. Multiple processes can only be run on CPUs with mulitple CPUs, but threads can be run even if there is one CPU.
    4. When you run several programs in your system (eg, a word processor, a browser, etc), they are started as separate threads (not processes).
  4. Which are true statements about calling a GUI listener (eg, on a JButton). Circle all that are correct.
    1. Java starts a separate thread for each listener.
    2. Long calculations which are performed by a listener will block the GUI from responding to user actions.
    3. The user should start a separate thread for long CPU-intensive listener calculations.
    4. There is no need to create a separate thread for a long listener calculation if the calculation performs operations that frequently allow other threads to use the CPU.
  5. Which classes can be used to create new threads? Circle all that are correct.
    1. Any class which is a subclass of Thread.
    2. Any class which implements the Runnable interface.
    3. Every class because every object has its own monitor.
  6. In which situations are threads used or should be considered? Assume there is only one CPU on the machine the programming is running on. Circle all that are correct.
    1. CPU intensive operations which can be computed in parallel may be run on separate threads to improve performance.
    2. Multiple IO operations (eg, loading data from several network sources) can be performed in parallel by using separate threads to reduce the total wait time.
    3. Operations that require a timer.
    4. Long GUI calculations.
    5. Using large, slow (eg, O(N)), data structures.
Ask programming questions?



Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (post your own) View All Comments Latest 10 Comments:

please post answers along with questions

Posted by anu on Monday, 02.2.09 @ 22:26pm | #84418

i want to call a method for 100000 Parallel threads and at any instance of time only 500 threads should be running. eg if 500 parallel threads are running then 501th thread should not start, it should start only when any of the previous running thread has completed its cycle.

Posted by sagar on Monday, 12.8.08 @ 13:29pm | #82520

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.

[an error occurred while processing this directive]