1.8 Problems

 < Day Day Up > 



1.8 Problems

  1. Consider two programs running on the same computer, but running in totally separate processes. To the programmers implementing them, are these programs concurrent?

  2. Consider the same two programs as in Problem 1 but this time consider them from the point of view of the programmer implementing the operating system. Are these two programs now concurrent or not? Is your answer the same as before? Why or why not?

  3. Two programs are being run on two separate computers, but both access the same database on a common server. Consider the programs from the point of view of the programmers writing the programs that access the servers. Are these two programs concurrent? What about from the point of view of the programmer implementing the server?

  4. If the activities of making the crust and the filling for a pie can occur in either order, but one must be started and completed before the other can begin, are the two activities concurrent? What questions could you ask that might affect your answer?

  5. The java.util.vector class is described in the Java API as being "synchronized." According to the definition of a component given in this chapter, is a vector then a component?

  6. If something is thread safe it means that a call to a method on that object can be run safely in a program with many threads. Is a thread-safe object a component?

  7. Describe some of the mechanisms of operating systems for implementing asynchronous activities in a computer program. Does the mechanism used for implementing these activities affect the definition of an asynchronous activity? Do the same for languages other than Java that support asynchronous activities (Ada, Modula2, OCCAM, Concurrent C, Co-Pascal, etc.).

  8. Describe some mechanisms used in other languages or operating systems for implementing synchronization. Does the mechanism used for implementing synchronization affect the definition of an asynchronous activity?

  9. Describe several problems where concurrency could be used effectively. What type(s) of concurrency would you use to implement such a program? How would that affect the design of the program?

  10. Consider the following types of objects. Are any components? Why or why not?

    • Integer

    • Vector

    • Socket

    • Array of primitives

    • Array of objects

    • TextField

    • Button

    • Servlet

    • Enterprise Java Bean

  11. Show that a JButton can indeed be linked to many objects by having the button notify multiple objects when it is pressed. Show that the button is independent of the GUI thread by adding and removing it from more than one frame.

  12. What happens if the same ActionListener object is added to a JButton twice? Does this seem to be reasonable behavior?

  13. In a single-tasking operating system, such as DOS, buttons were often displayed on the terminal and the program would then simply poll (busy wait) until something happened on the screen. Because this represents a type of GUI, are these buttons components? Why or why not?

  14. Can a component contain a thread? Explain.



 < Day Day Up > 



Creating Components. Object Oriented, Concurrent, and Distributed Computing in Java
The .NET Developers Guide to Directory Services Programming
ISBN: 849314992
EAN: 2147483647
Year: 2003
Pages: 162

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net