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

CSC364 Lecture 12

Avatar for Javier Gonzalez-Sanchez Javier Gonzalez-Sanchez PRO
February 16, 2026
51

CSC364 Lecture 12

Introduction to Networked, Distributed, and Parallel Computing
Connecting the Dots
(202602)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

February 16, 2026
Tweet

Transcript

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

    CSC 364 Introduction to Networked, Distributed, and Parallel Computing Lecture 10. Connecting the Dots 1
  2. • Producers • They run on it own thre a

    d - Cre a te one worker per CPU core. • Gener a tes Jobs consisting of a rithmetic oper a tions with r a ndomly gener a ted integers. • Let us a gree th a t + is 1, - is 2, * is 3 a nd / is 4 • Sleep 10 seconds jobObject System story :: Producer 2 1 5 7 #0 producerObject #0
  3. • Local workers • They run on it own thre

    a d - Cre a te one worker per CPU core. • E a ch worker repe a tedly t a kes a job a nd “solves” it, then gets paid 1 coin. • Sleep 10 seconds System story :: LocalWorker + 5 7 #3 #0 #3 1 jobObject 1 5 7 #0 = 12 +1
  4. • JobRepository: • A f ixed-c a p a city

    job bu ff er of size NCPU, protected with Semaphores a nd a ReentrantLock. System story :: JobRepository
  5. System story :: JobRepository Use the cl a ssic bounded-bu

    ff er p a ttern: - EmptySlots sem a phore st a rts a t c a p a city - Av a il a bleItems sem a phore st a rts a t 0 - A Reentr a ntLock protects the queue itself put(job) 1. EmptySlots. a cquire() 2. Lock → enqueue 3. Unlock 4. Av a il a bleItems.rele a se() t a ke() 1. Av a il a bleItems. a cquire() 2. Lock → dequeue 3. Unlock 4. EmptySlots.rele a se() 5
  6. • Treasury • The tre a sury rew a rds

    1 coin for e a ch completed job, independent of which worker solved it. • The tre a sury h a s a limited budget. • For this experiment, the initi a l b a l a nce will be set to 1,000 coins. System story :: Treasury
  7. System story :: Treasury • Producer deposits 2 coins per

    job into the tre a sury. • When job is completed: 2 coin is p a id to the solver (Worker or Outsourcer) • Outsourcer sent 1 coin to extern a l solvers a fter receiving the job done • C a n a n outsourcer “m a ke more money” by processing more jobs per minute? 7
  8. System story :: Outsourcer (contractor) • Outsourcer (contr a ctor)

    • Also consumes jobs from the repository. • It forw a rd the job to a n extern a l solver a nd w a it for the result. • Sleep 2 seconds • How the hiring process will work? 8
  9. Distributed Computing • Multiple independent computers (often c a lled

    nodes) work together over a network to solve a problem th a t would be di ff icult, slow, or impossible for a single m a chine to h a ndle a lone. • T a sks a re divided into sm a ller pieces a nd distributed a cross di ff erent m a chines, which process them concurrently a nd coordin a te through mess a ge p a ssing or sh a red d a t a protocols. • Addresses ch a llenges such a s synchroniz a tion, f a ult toler a nce, consistency, communic a tion l a tency, a nd resource m a n a gement. • Distributed computing underlies m a ny modern technologies, including cloud computing pl a tforms, l a rge-sc a le web services, distributed d a t a b a ses, blockch a in networks, a nd p a r a llel scienti f ic simul a tions. 9
  10. CSC 364 Introduction to Introduction to Networked, Distributed, and Parallel

    Computing Javier Gonzalez-Sanchez, Ph.D. [email protected] Winter 2026 Copyright. These slides can only be used as study material for the class CSC 364 at Cal Poly. They cannot be distributed or used for another purpose. 15