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
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
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
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
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
• 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
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
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