Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC305 Lecture 08

CSC305 Lecture 08

Individual Software Design and Development
Multithreading
(202510)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

October 09, 2025
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 305 Individual Software Design and Development Lecture 08. Multithreading
  2. De f inition • Concurrent or P a r a

    llel execution of t a sks • Improves perform a nce a nd responsiveness • Core concept in softw a re • Allows multiple t a sks to run concurrently within the s a me progr a m 2
  3. Thread vs Process Process • Independent progr a m with

    its own memory sp a ce • H a s a m a in thre a d (the “m a in” method in J a v a ) Thre a d • Runs inside a process • Sh a res process memory/resources with other thre a ds An a logy: • Process = O ff ice building • Thre a d = Employees working in the s a me o ff ice 3
  4. Java and Multithreading • Thre a d cl a ss

    • Runn a ble interf a ce 4
  5. Lab

  6. Assignment 01 • When click on Open, show a JFileChooser

    to select a folder. • Re a d a ll f ile n a mes from the folder a nd displ a y them in the JList or JTextAre a . • Use the f irst f ile in the list to: • Count lines → dr a w a box sized by line count. • Count if / switch / for / while → dr a w a nother box sized by complexity. • Comp a ring box sizes should show di ff erence. For example: 100 lines a nd 100 control st a tements → both boxes s a me size. • If f ile h a s @ a uthor a nd @version → dr a w h a ppy/serious f a ce. Otherwise → dr a w s a d f a ce. • Submit your code a nd your Cl a ss Di a gr a m 16
  7. CSC 305 Individual Software Design and Development Javier Gonzalez-Sanchez, Ph.D.

    [email protected] Fall 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.