Skip to content

Latest commit

 

History

History
151 lines (135 loc) · 7.3 KB

Unit03.md

File metadata and controls

151 lines (135 loc) · 7.3 KB

Unit 3: Threading in Java   *In this unit, you will be introduced Java threads.  Some problems/tasks need to be subdivided with each piece running concurrently without being visible to the end-user until all of the subtasks finish.  This simultaneous processing is accomplished by the multi-threading feature in Java.  *

Unit 3 Time Advisory
This unit should take you approximately 6 hours to complete.

☐    Subunit 3.1: 3 hours

☐    Subunit 3.2: 3 hours

Unit3 Learning Outcomes
Upon successful completion of this unit, the student will be able to:

  • Code problems using the fundamental concepts of object-oriented programming in Java.
  • Explain the usage of threads in Java.
  • Compare and contrast multitasking and multi-threading.

3.1 Threads in Java  

  • Reading: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.1: Introduction to Threads” Link: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.1: Introduction to Threads” (PDF)
     
    Instructions: Please read Section 12.1 in its entirety.  Compile and run the examples in this lesson to enhance your understanding of threads.  Note the discussions of synchronization and volatility of threads.

    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.

3.1.1 The Importance of Multiprocessing  

  • Reading: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.2: Programming with Threads and Multiprocessing” Link: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.2: Programming with Threads” (PDF)
     
    Instructions: Please read all of Section 12.2.  As you read, take advantage of the opportunity to compile and run the sample code.  How is multiprocessing accomplished with threads?
     
    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.

3.1.2 Parallel Processing  

  • Reading: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.3: Threads and Parallel Processing” Link: Hobart and William Smith Colleges: David J. Eck's: Introduction to Programming Using Java: “Section 12.3: Threads and Parallel Processing” (PDF)
     
    Instructions: Please read all of Section 12.3.  As you read, take advantage of the opportunity to compile and run the code examples.  Explain how synchronization is used in threads for parallel processing.

    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.

3.2 Threads and Networking  

  • Reading: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.4: Threads and Networking” Link: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.4: Threads and Networking” (PDF)
     
    Instructions: Please read all of Section 12.4.  As you read, take advantage of the opportunity to compile and run the code examples.  What is the role of threads in network programming?

    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.

3.2.1 Network Programming  

  • Reading: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.5: Network Programming Example: A Networked Game Framework” Link: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Section 12.5: Network Programming Example: A Networked Game Framework” (PDF)
     
    Instructions: Please complete Section 12.5.  Follow the steps in this section to compile, and run a network programming application.  Compare and contrast the code used for the three multiplayer games you ran in this section.

    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.

3.2.2 Threads Checkpoint  

  • Assessment: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Programming Exercises for Chapter 12” Link: Hobart and William Smith Colleges: David J. Eck's Introduction to Programming Using Java: “Programming Exercises for Chapter 12” (PDF)
     
    Instructions: Please complete all of the exercises.  Each exercise identifies the subsection it is based on.  Review that subsection if you need more information before completing that exercise.  When you have finished, solutions are found at the link to the right of the question.
     
    Terms of Use: The article above is released under a Creative Commons Attribution-Non-Commercial-Share-Alike License 3.0.  It is attributed to David Eck and the original version can be found here.