SlideShare a Scribd company logo
Multiprocessor/Multicore Systems Scheduling, Synchronization
Multiprocessors ,[object Object]
Multiprocessor/Multicore Hardware (ex.1) ,[object Object]
Multiprocessor/Multicore  Hardware (ex.2)  UMA (uniform memory access)  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multiprocessor/Multicore Hardware (ex.3)  NUMA (non-uniform memory access)  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Cache-coherence
Cache coherence (cont)  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
On multicores Reason for multicores : physical limitations can cause significant  heat dissipation  and  data synchronization  problems  In addition to operating system (OS) support, adjustments to existing software are required to maximize utilization of the computing resources provided by multi-core processors. Virtual machine approach again in focus . Intel Core 2 dual core processor, with CPU-local Level 1 caches+ shared, on-die Level 2 cache.
On multicores (cont) ,[object Object]
OS Design issues (1): Who executes the OS/scheduler(s)? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Master-Slave multiprocessor OS Bus
Non-symmetric Peer Multiprocessor OS  ,[object Object],Bus
Symmetric Peer Multiprocessor OS  ,[object Object],[object Object],Bus
Scheduling in Multiprocessors ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Design issues 2:  Assignment of Processes to Processors ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multiprocessor Scheduling: per partition RQ ,[object Object],[object Object]
Multiprocessor Scheduling: Load sharing / Global ready queue ,[object Object],[object Object]
Multiprocessor Scheduling  Load Sharing: a problem ,[object Object],[object Object],[object Object]
Design issues 3: Multiprogramming on processors? ,[object Object],[object Object],[object Object],[object Object]
Gang Scheduling ,[object Object],[object Object],[object Object],[object Object],[object Object]
Gang Scheduling: another option
Multiprocessor Thread Scheduling  Dynamic Scheduling ,[object Object],[object Object],[object Object],[object Object],[object Object]
Summary: Multiprocessor Thread Scheduling ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multiprocessor Scheduling and Synchronization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Readers-Writers non-blocking synchronization (some slides are adapted from J. Anderson’s slides on same topic)
The Mutual Exclusion Problem Locking Synchronization ,[object Object],while  true  do Noncritical Section; Entry Section; Critical Section; Exit Section od ,[object Object],[object Object],[object Object],[object Object]
Non-blocking Synchronization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Locking
Non-blocking Synchronization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Readers/Writers Problem ,[object Object],[object Object],[object Object],[object Object]
Solution 1 Readers have “priority”… Reader:: P( mutex ); rc  :=  rc  + 1; if  rc  = 1 then P( w ) fi; V( mutex ); CS; P( mutex ); rc  :=  rc     1; if  rc  = 0 then V( w ) fi; V( mutex ) Writer:: P( w ); CS; V( w ) “ First” reader executes P(w).  “Last” one executes V(w).
Solution 2 Writers have “priority” … readers should not build long queue on r, so that writers can overtake  =>  mutex3 Reader:: P( mutex3 ); P( r ); P( mutex1 ); rc  :=  rc  + 1; if  rc  = 1 then P( w ) fi; V( mutex1 ); V( r ); V( mutex3 ); CS; P( mutex1 ); rc  :=  rc     1; if  rc  = 0 then V( w ) fi; V( mutex1 ) Writer:: P( mutex2 ); wc  :=  wc  + 1; if  wc  = 1 then P( r ) fi; V( mutex2 ); P( w ); CS; V( w ); P( mutex2 ); wc  :=  wc     1; if  wc  = 0 then V( r ) fi; V( mutex2 )
Properties ,[object Object],[object Object],[object Object]
Concurrent Reading and Writing [Lamport ‘77] ,[object Object],[object Object],[object Object],[object Object],[object Object]
Interesting Factoids ,[object Object],[object Object]
The Problem ,[object Object],[object Object],[object Object],[object Object]
Preliminaries ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
More Preliminaries We say:   r  reads  v [ k,l ] . Value is  consistent  if  k  =  l . write: k write: k + i write: l        read  v 3 read  v 2 read  v m -1 read  v 1 read  v m read  r: 
Theorem 1 If  v  is always written from right to left, then a read from left to right obtains a value v 1 [ k 1 , l 1 ]  v 2 [ k 2 , l 2 ]  …   v m [ k m , l m ] where  k 1      l 1      k 2      l 2     …     k m      l m . Example:   v  =  v 1 v 2 v 3  =  d 1 d 2 d 3 Read reads  v 1 [0,0]  v 2 [1,1]  v 3 [2,2] . read :  read  v 1 read  d 1  read  v 2 read  d 2  read  v 3 read  d 3 write:1    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1 write:0    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1 write:2    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1
Another Example read : write:0    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2 write:1    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2  read  v 1 r d 1  r d 2  read  v 2 r d 4  r d 3 v  =  v 1   v 2 d 1 d 2 d 3 d 4 Read reads  v 1 [0,1]  v 2 [1,2] . write:2    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2
Theorem 2 Assume that  i      j  implies that  v [ i ]     v [ j ] , where  v  =  d 1  …  d m . (a) If  v  is always written from right to left, then a read from left to right obtains a value  v [ k , l ]      v [ l ] . (b) If  v  is always written from left to right, then a read from right to left obtains a value  v [ k , l ]      v [ k ] .
Example of (a) v   =  d 1 d 2 d 3 Read obtains  v [0,2]  = 390 < 400 =  v [2] . read :  read  d 1  read  d 2  read  d 3 write:1(399)    w d 3 w d 2 w d 1 9 9 3 write:0(398)    w d 3 w d 2 w d 1 8 9 3 write:2(400)    w d 3 w d 2 w d 1 0 0 4
Example of (b) v   =  d 1 d 2 d 3 Read obtains  v [0,2]  = 498 > 398 =  v [0] . read :  read  d 3  read  d 2  read  d 1 write:1(399)    w d 1 w d 2 w d 3 3 9 9 write:0(398)    w d 1 w d 2 w d 3 3 9 8 write:2(400)    w d 1 w d 2 w d 3 4 0 0
Readers/Writers Solution :> means assign larger value.  V1 means “left to right”.  V2 means “right to left”. Writer::  V1 :> V1; write D;  V2 := V1 Reader::  repeat temp := V2 read D  until V1 = temp
Proof Obligation ,[object Object],[object Object]
Proof By Theorem 2, V2 [ k 1 , l 1 ]     V2 [ l 1 ]   and  V1 [ k 3 ]     V1 [ k 3 , l 3 ] .  (1) Applying Theorem 1 to V2 D V1, k 1      l 1      k 2      l 2      k 3      l 3  .  (2) By the writer program, l 1      k 3     V2 [ l 1 ]     V1 [ k 3 ] .  (3) (1), (2), and (3) imply V2 [ k 1 , l 1 ]     V2 [ l 1 ]     V1 [ k 3 ]     V1 [ k 3 , l 3 ] . Hence,  V2 [ k 1 , l 1 ]  =   V1 [ k 3 , l 3 ]    V2 [ l 1 ]  =   V1 [ k 3 ]    l 1  =  k 3   , by the writer’s program.    k 2  =  l 2   by (2).
Supplemental Reading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Useful Synchronization Primitives Usually  Necessary  in Nonblocking Algorithms CAS2 extends this CAS(var, old, new)    if var    old then return false fi;  var := new; return true   LL(var)    establish “link” to var; return var   SC(var, val)    if “link” to var still exists then break all current links of all processes; var := val; return true else return false fi  
Another Lock-free Example Shared Queue type  Qtype = record v: valtype; next:  pointer to Qtype end shared var  Tail:  pointer to Qtype; local var  old, new: pointer to Qtype procedure Enqueue (input: valtype) new := (input,  NIL); repeat  old := Tail until  CAS2(Tail, old->next, old, NIL, new, new)  Tail old Tail old new new retry loop
Using Locks in Real-time Systems The  Priority Inversion  Problem Uncontrolled use of locks in RT systems can result in unbounded blocking due to priority inversions . Time   Low Med High t t t 0 1 2 Shared Object Access Priority  Inversion Computation not involving object accesses Solution:  Limit priority inversions by  modifying task priorities . Time  Low Med High t 0 t 1 t 2
Dealing with Priority Inversions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Parallel architecture-programming
Parallel architecture-programmingParallel architecture-programming
Parallel architecture-programming
Shaveta Banda
 
Process coordination
Process coordinationProcess coordination
Process coordination
Sweta Kumari Barnwal
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
Haris456
 
ADVANCED COMPUTER ARCHITECTURE AND PARALLEL PROCESSING
ADVANCED COMPUTER ARCHITECTUREAND PARALLEL PROCESSINGADVANCED COMPUTER ARCHITECTUREAND PARALLEL PROCESSING
ADVANCED COMPUTER ARCHITECTURE AND PARALLEL PROCESSING
Zena Abo-Altaheen
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
Kamal Acharya
 
Scope of parallelism
Scope of parallelismScope of parallelism
Scope of parallelism
Syed Zaid Irshad
 
Aca 2
Aca 2Aca 2
Cache coherence problem and its solutions
Cache coherence problem and its solutionsCache coherence problem and its solutions
Cache coherence problem and its solutions
Majid Saleem
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2
mrbourne
 
Multiprocessor scheduling 1
Multiprocessor scheduling 1Multiprocessor scheduling 1
Multiprocessor scheduling 1
mrbourne
 
Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)
Sri Prasanna
 
The Windows Scheduler
The Windows SchedulerThe Windows Scheduler
The Windows Scheduler
Peter Shirley-Quirk
 
Parallel Processing (Part 2)
Parallel Processing (Part 2)Parallel Processing (Part 2)
Parallel Processing (Part 2)
Ajeng Savitri
 
Introduction to parallel_computing
Introduction to parallel_computingIntroduction to parallel_computing
Introduction to parallel_computing
Mehul Patel
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
AJAL A J
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processor
Mazin Alwaaly
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
sgpraju
 
Introduction To Parallel Computing
Introduction To Parallel ComputingIntroduction To Parallel Computing
Introduction To Parallel Computing
Jörn Dinkla
 
Multiprocessors(performance and synchronization issues)
Multiprocessors(performance and synchronization issues)Multiprocessors(performance and synchronization issues)
Multiprocessors(performance and synchronization issues)
Gaurav Dalvi
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed Systems
Ritu Ranjan Shrivastwa
 

What's hot (20)

Parallel architecture-programming
Parallel architecture-programmingParallel architecture-programming
Parallel architecture-programming
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
 
ADVANCED COMPUTER ARCHITECTURE AND PARALLEL PROCESSING
ADVANCED COMPUTER ARCHITECTUREAND PARALLEL PROCESSINGADVANCED COMPUTER ARCHITECTUREAND PARALLEL PROCESSING
ADVANCED COMPUTER ARCHITECTURE AND PARALLEL PROCESSING
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
 
Scope of parallelism
Scope of parallelismScope of parallelism
Scope of parallelism
 
Aca 2
Aca 2Aca 2
Aca 2
 
Cache coherence problem and its solutions
Cache coherence problem and its solutionsCache coherence problem and its solutions
Cache coherence problem and its solutions
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2
 
Multiprocessor scheduling 1
Multiprocessor scheduling 1Multiprocessor scheduling 1
Multiprocessor scheduling 1
 
Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)
 
The Windows Scheduler
The Windows SchedulerThe Windows Scheduler
The Windows Scheduler
 
Parallel Processing (Part 2)
Parallel Processing (Part 2)Parallel Processing (Part 2)
Parallel Processing (Part 2)
 
Introduction to parallel_computing
Introduction to parallel_computingIntroduction to parallel_computing
Introduction to parallel_computing
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processor
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
 
Introduction To Parallel Computing
Introduction To Parallel ComputingIntroduction To Parallel Computing
Introduction To Parallel Computing
 
Multiprocessors(performance and synchronization issues)
Multiprocessors(performance and synchronization issues)Multiprocessors(performance and synchronization issues)
Multiprocessors(performance and synchronization issues)
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed Systems
 

Viewers also liked

Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
knowdiff
 
Agile Vs Traditional Models
Agile Vs Traditional ModelsAgile Vs Traditional Models
Agile Vs Traditional Models
Sabir Ali Khuhro
 
Cache coherence
Cache coherenceCache coherence
Cache coherence
Shyam Krishna Khadka
 
Agile Architecture and Modeling - Where are we Today
Agile Architecture and Modeling - Where are we TodayAgile Architecture and Modeling - Where are we Today
Agile Architecture and Modeling - Where are we Today
Gary Pedretti
 
Design for security in operating system
Design for security in operating systemDesign for security in operating system
Design for security in operating system
Bhagyashree Barde
 
CA presentation of multicore processor
CA presentation of multicore processorCA presentation of multicore processor
CA presentation of multicore processor
Zeeshan Aslam
 
78 identify input and output devices
78 identify input and output devices78 identify input and output devices
78 identify input and output devices
Paul Gonzales
 
Coherence and consistency models in multiprocessor architecture
Coherence and consistency models in multiprocessor architectureCoherence and consistency models in multiprocessor architecture
Coherence and consistency models in multiprocessor architecture
University of Pisa
 
Agile Modeling
Agile ModelingAgile Modeling
Agile Modeling
Otavio Ferreira
 
Dma
DmaDma
Input Output Control System
Input Output Control SystemInput Output Control System
Input Output Control System
Tajul Azhar Mohd Tajul Ariffin
 
Cache coherence
Cache coherenceCache coherence
Cache coherence
Employee
 
Spiral model
Spiral modelSpiral model
Spiral model
khuram22
 
Direct memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA ControllerDirect memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA Controller
Muhammed Afsal Villan
 
V model Over View (Software Engineering)
V model Over View (Software Engineering) V model Over View (Software Engineering)
V model Over View (Software Engineering)
Badar Rameez. CH.
 
RPL : Incremental model
RPL : Incremental modelRPL : Incremental model
RPL : Incremental model
amalianuryamin
 
Multicore Processors
Multicore ProcessorsMulticore Processors
Multicore Processors
Smruti Sarangi
 
Interrupts
InterruptsInterrupts
Interrupts
Albin Panakkal
 
Comparison of different Agile Iterative process approaches
Comparison of different Agile Iterative process approachesComparison of different Agile Iterative process approaches
Comparison of different Agile Iterative process approaches
Yuval Yeret
 

Viewers also liked (20)

Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
 
Agile Vs Traditional Models
Agile Vs Traditional ModelsAgile Vs Traditional Models
Agile Vs Traditional Models
 
Cache coherence
Cache coherenceCache coherence
Cache coherence
 
Agile modeling
Agile modelingAgile modeling
Agile modeling
 
Agile Architecture and Modeling - Where are we Today
Agile Architecture and Modeling - Where are we TodayAgile Architecture and Modeling - Where are we Today
Agile Architecture and Modeling - Where are we Today
 
Design for security in operating system
Design for security in operating systemDesign for security in operating system
Design for security in operating system
 
CA presentation of multicore processor
CA presentation of multicore processorCA presentation of multicore processor
CA presentation of multicore processor
 
78 identify input and output devices
78 identify input and output devices78 identify input and output devices
78 identify input and output devices
 
Coherence and consistency models in multiprocessor architecture
Coherence and consistency models in multiprocessor architectureCoherence and consistency models in multiprocessor architecture
Coherence and consistency models in multiprocessor architecture
 
Agile Modeling
Agile ModelingAgile Modeling
Agile Modeling
 
Dma
DmaDma
Dma
 
Input Output Control System
Input Output Control SystemInput Output Control System
Input Output Control System
 
Cache coherence
Cache coherenceCache coherence
Cache coherence
 
Spiral model
Spiral modelSpiral model
Spiral model
 
Direct memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA ControllerDirect memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA Controller
 
V model Over View (Software Engineering)
V model Over View (Software Engineering) V model Over View (Software Engineering)
V model Over View (Software Engineering)
 
RPL : Incremental model
RPL : Incremental modelRPL : Incremental model
RPL : Incremental model
 
Multicore Processors
Multicore ProcessorsMulticore Processors
Multicore Processors
 
Interrupts
InterruptsInterrupts
Interrupts
 
Comparison of different Agile Iterative process approaches
Comparison of different Agile Iterative process approachesComparison of different Agile Iterative process approaches
Comparison of different Agile Iterative process approaches
 

Similar to 10 Multicore 07

CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
Kathirvel Ayyaswamy
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
mona_hakmy
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
tech2click
 
Topic 4- processes.pptx
Topic 4- processes.pptxTopic 4- processes.pptx
Topic 4- processes.pptx
DanishMahmood23
 
Processes, Threads and Scheduler
Processes, Threads and SchedulerProcesses, Threads and Scheduler
Processes, Threads and Scheduler
Munazza-Mah-Jabeen
 
Threading.pptx
Threading.pptxThreading.pptx
Threading.pptx
BalasundaramSr
 
4.Process.ppt
4.Process.ppt4.Process.ppt
4.Process.ppt
AkfeteAssefa
 
what every web and app developer should know about multithreading
what every web and app developer should know about multithreadingwhat every web and app developer should know about multithreading
what every web and app developer should know about multithreading
Ilya Haykinson
 
parallel Questions &amp; answers
parallel Questions &amp; answersparallel Questions &amp; answers
parallel Questions &amp; answers
Md. Mashiur Rahman
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
Zvi Avraham
 
Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]
Akhil Nadh PC
 
Chapter04 new
Chapter04 newChapter04 new
Chapter04 new
vmummaneni
 
Wiki 2
Wiki 2Wiki 2
Wiki 2
Sid Hegde
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
AbDul ThaYyal
 
CH04.pdf
CH04.pdfCH04.pdf
CH04.pdf
ImranKhan880955
 
Multimaster
MultimasterMultimaster
Multimaster
Stas Kelvich
 
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emptionLinux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Hemanth Venkatesh
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Kasun Gajasinghe
 
Bglrsession4
Bglrsession4Bglrsession4
Chapter 3 chapter reading task
Chapter 3 chapter reading taskChapter 3 chapter reading task
Chapter 3 chapter reading task
Grievous Humorist-Ilham
 

Similar to 10 Multicore 07 (20)

CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Topic 4- processes.pptx
Topic 4- processes.pptxTopic 4- processes.pptx
Topic 4- processes.pptx
 
Processes, Threads and Scheduler
Processes, Threads and SchedulerProcesses, Threads and Scheduler
Processes, Threads and Scheduler
 
Threading.pptx
Threading.pptxThreading.pptx
Threading.pptx
 
4.Process.ppt
4.Process.ppt4.Process.ppt
4.Process.ppt
 
what every web and app developer should know about multithreading
what every web and app developer should know about multithreadingwhat every web and app developer should know about multithreading
what every web and app developer should know about multithreading
 
parallel Questions &amp; answers
parallel Questions &amp; answersparallel Questions &amp; answers
parallel Questions &amp; answers
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
 
Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]
 
Chapter04 new
Chapter04 newChapter04 new
Chapter04 new
 
Wiki 2
Wiki 2Wiki 2
Wiki 2
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
CH04.pdf
CH04.pdfCH04.pdf
CH04.pdf
 
Multimaster
MultimasterMultimaster
Multimaster
 
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emptionLinux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emption
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
 
Bglrsession4
Bglrsession4Bglrsession4
Bglrsession4
 
Chapter 3 chapter reading task
Chapter 3 chapter reading taskChapter 3 chapter reading task
Chapter 3 chapter reading task
 

Recently uploaded

Digital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital ExcellenceDigital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital Excellence
Operational Excellence Consulting
 
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your TasteZodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
my Pandit
 
Income Tax exemption for Start up : Section 80 IAC
Income Tax  exemption for Start up : Section 80 IACIncome Tax  exemption for Start up : Section 80 IAC
Income Tax exemption for Start up : Section 80 IAC
CA Dr. Prithvi Ranjan Parhi
 
Negotiation & Presentation Skills regarding steps in business communication, ...
Negotiation & Presentation Skills regarding steps in business communication, ...Negotiation & Presentation Skills regarding steps in business communication, ...
Negotiation & Presentation Skills regarding steps in business communication, ...
UdayaShankarS1
 
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
BBPMedia1
 
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women MagazineEllen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
CIOWomenMagazine
 
How to Buy an Engagement Ring.pcffbhfbfghfhptx
How to Buy an Engagement Ring.pcffbhfbfghfhptxHow to Buy an Engagement Ring.pcffbhfbfghfhptx
How to Buy an Engagement Ring.pcffbhfbfghfhptx
Charleston Alexander
 
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
Lacey Max
 
Business storytelling: key ingredients to a story
Business storytelling: key ingredients to a storyBusiness storytelling: key ingredients to a story
Business storytelling: key ingredients to a story
Alexandra Fulford
 
The latest Heat Pump Manual from Newentide
The latest Heat Pump Manual from NewentideThe latest Heat Pump Manual from Newentide
The latest Heat Pump Manual from Newentide
JoeYangGreatMachiner
 
Chapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .pptChapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .ppt
ssuser567e2d
 
Innovative Uses of Revit in Urban Planning and Design
Innovative Uses of Revit in Urban Planning and DesignInnovative Uses of Revit in Urban Planning and Design
Innovative Uses of Revit in Urban Planning and Design
Chandresh Chudasama
 
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
taqyea
 
list of states and organizations .pdf
list of  states  and  organizations .pdflist of  states  and  organizations .pdf
list of states and organizations .pdf
Rbc Rbcua
 
Registered-Establishment-List-in-Uttarakhand-pdf.pdf
Registered-Establishment-List-in-Uttarakhand-pdf.pdfRegistered-Establishment-List-in-Uttarakhand-pdf.pdf
Registered-Establishment-List-in-Uttarakhand-pdf.pdf
dazzjoker
 
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdfGarments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
Pridesys IT Ltd.
 
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
➒➌➎➏➑➐➋➑➐➐Dpboss Matka Guessing Satta Matka Kalyan Chart Indian Matka
 
Innovation Management Frameworks: Your Guide to Creativity & Innovation
Innovation Management Frameworks: Your Guide to Creativity & InnovationInnovation Management Frameworks: Your Guide to Creativity & Innovation
Innovation Management Frameworks: Your Guide to Creativity & Innovation
Operational Excellence Consulting
 
Pitch Deck Teardown: Kinnect's $250k Angel deck
Pitch Deck Teardown: Kinnect's $250k Angel deckPitch Deck Teardown: Kinnect's $250k Angel deck
Pitch Deck Teardown: Kinnect's $250k Angel deck
HajeJanKamps
 
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian MatkaDpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
➒➌➎➏➑➐➋➑➐➐Dpboss Matka Guessing Satta Matka Kalyan Chart Indian Matka
 

Recently uploaded (20)

Digital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital ExcellenceDigital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital Excellence
 
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your TasteZodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
 
Income Tax exemption for Start up : Section 80 IAC
Income Tax  exemption for Start up : Section 80 IACIncome Tax  exemption for Start up : Section 80 IAC
Income Tax exemption for Start up : Section 80 IAC
 
Negotiation & Presentation Skills regarding steps in business communication, ...
Negotiation & Presentation Skills regarding steps in business communication, ...Negotiation & Presentation Skills regarding steps in business communication, ...
Negotiation & Presentation Skills regarding steps in business communication, ...
 
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
NIMA2024 | De toegevoegde waarde van DEI en ESG in campagnes | Nathalie Lam |...
 
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women MagazineEllen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
Ellen Burstyn: From Detroit Dreamer to Hollywood Legend | CIO Women Magazine
 
How to Buy an Engagement Ring.pcffbhfbfghfhptx
How to Buy an Engagement Ring.pcffbhfbfghfhptxHow to Buy an Engagement Ring.pcffbhfbfghfhptx
How to Buy an Engagement Ring.pcffbhfbfghfhptx
 
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
How are Lilac French Bulldogs Beauty Charming the World and Capturing Hearts....
 
Business storytelling: key ingredients to a story
Business storytelling: key ingredients to a storyBusiness storytelling: key ingredients to a story
Business storytelling: key ingredients to a story
 
The latest Heat Pump Manual from Newentide
The latest Heat Pump Manual from NewentideThe latest Heat Pump Manual from Newentide
The latest Heat Pump Manual from Newentide
 
Chapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .pptChapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .ppt
 
Innovative Uses of Revit in Urban Planning and Design
Innovative Uses of Revit in Urban Planning and DesignInnovative Uses of Revit in Urban Planning and Design
Innovative Uses of Revit in Urban Planning and Design
 
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
 
list of states and organizations .pdf
list of  states  and  organizations .pdflist of  states  and  organizations .pdf
list of states and organizations .pdf
 
Registered-Establishment-List-in-Uttarakhand-pdf.pdf
Registered-Establishment-List-in-Uttarakhand-pdf.pdfRegistered-Establishment-List-in-Uttarakhand-pdf.pdf
Registered-Establishment-List-in-Uttarakhand-pdf.pdf
 
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdfGarments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
Garments ERP Software in Bangladesh _ Pridesys IT Ltd.pdf
 
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
Dpboss Matka Guessing Satta Matta Matka Kalyan panel Chart Indian Matka Dpbos...
 
Innovation Management Frameworks: Your Guide to Creativity & Innovation
Innovation Management Frameworks: Your Guide to Creativity & InnovationInnovation Management Frameworks: Your Guide to Creativity & Innovation
Innovation Management Frameworks: Your Guide to Creativity & Innovation
 
Pitch Deck Teardown: Kinnect's $250k Angel deck
Pitch Deck Teardown: Kinnect's $250k Angel deckPitch Deck Teardown: Kinnect's $250k Angel deck
Pitch Deck Teardown: Kinnect's $250k Angel deck
 
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian MatkaDpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Indian Matka
 

10 Multicore 07

  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 8. On multicores Reason for multicores : physical limitations can cause significant heat dissipation and data synchronization problems In addition to operating system (OS) support, adjustments to existing software are required to maximize utilization of the computing resources provided by multi-core processors. Virtual machine approach again in focus . Intel Core 2 dual core processor, with CPU-local Level 1 caches+ shared, on-die Level 2 cache.
  • 9.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 22.
  • 23.
  • 24.
  • 25. Readers-Writers non-blocking synchronization (some slides are adapted from J. Anderson’s slides on same topic)
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Solution 1 Readers have “priority”… Reader:: P( mutex ); rc := rc + 1; if rc = 1 then P( w ) fi; V( mutex ); CS; P( mutex ); rc := rc  1; if rc = 0 then V( w ) fi; V( mutex ) Writer:: P( w ); CS; V( w ) “ First” reader executes P(w). “Last” one executes V(w).
  • 31. Solution 2 Writers have “priority” … readers should not build long queue on r, so that writers can overtake => mutex3 Reader:: P( mutex3 ); P( r ); P( mutex1 ); rc := rc + 1; if rc = 1 then P( w ) fi; V( mutex1 ); V( r ); V( mutex3 ); CS; P( mutex1 ); rc := rc  1; if rc = 0 then V( w ) fi; V( mutex1 ) Writer:: P( mutex2 ); wc := wc + 1; if wc = 1 then P( r ) fi; V( mutex2 ); P( w ); CS; V( w ); P( mutex2 ); wc := wc  1; if wc = 0 then V( r ) fi; V( mutex2 )
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. More Preliminaries We say: r reads v [ k,l ] . Value is consistent if k = l . write: k write: k + i write: l        read v 3 read v 2 read v m -1 read v 1 read v m read r: 
  • 38. Theorem 1 If v is always written from right to left, then a read from left to right obtains a value v 1 [ k 1 , l 1 ] v 2 [ k 2 , l 2 ] … v m [ k m , l m ] where k 1  l 1  k 2  l 2  …  k m  l m . Example: v = v 1 v 2 v 3 = d 1 d 2 d 3 Read reads v 1 [0,0] v 2 [1,1] v 3 [2,2] . read :  read v 1 read d 1  read v 2 read d 2  read v 3 read d 3 write:1    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1 write:0    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1 write:2    w v 3 w v 2 w v 1 w d 3 w d 2 w d 1
  • 39. Another Example read : write:0    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2 write:1    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2  read v 1 r d 1  r d 2  read v 2 r d 4  r d 3 v = v 1 v 2 d 1 d 2 d 3 d 4 Read reads v 1 [0,1] v 2 [1,2] . write:2    w v 2 w v 1 w d 3 w d 4 w d 1  w d 2
  • 40. Theorem 2 Assume that i  j implies that v [ i ]  v [ j ] , where v = d 1 … d m . (a) If v is always written from right to left, then a read from left to right obtains a value v [ k , l ]  v [ l ] . (b) If v is always written from left to right, then a read from right to left obtains a value v [ k , l ]  v [ k ] .
  • 41. Example of (a) v = d 1 d 2 d 3 Read obtains v [0,2] = 390 < 400 = v [2] . read :  read d 1  read d 2  read d 3 write:1(399)    w d 3 w d 2 w d 1 9 9 3 write:0(398)    w d 3 w d 2 w d 1 8 9 3 write:2(400)    w d 3 w d 2 w d 1 0 0 4
  • 42. Example of (b) v = d 1 d 2 d 3 Read obtains v [0,2] = 498 > 398 = v [0] . read :  read d 3  read d 2  read d 1 write:1(399)    w d 1 w d 2 w d 3 3 9 9 write:0(398)    w d 1 w d 2 w d 3 3 9 8 write:2(400)    w d 1 w d 2 w d 3 4 0 0
  • 43. Readers/Writers Solution :> means assign larger value.  V1 means “left to right”.  V2 means “right to left”. Writer::  V1 :> V1; write D;  V2 := V1 Reader::  repeat temp := V2 read D  until V1 = temp
  • 44.
  • 45. Proof By Theorem 2, V2 [ k 1 , l 1 ]  V2 [ l 1 ] and V1 [ k 3 ]  V1 [ k 3 , l 3 ] . (1) Applying Theorem 1 to V2 D V1, k 1  l 1  k 2  l 2  k 3  l 3 . (2) By the writer program, l 1  k 3  V2 [ l 1 ]  V1 [ k 3 ] . (3) (1), (2), and (3) imply V2 [ k 1 , l 1 ]  V2 [ l 1 ]  V1 [ k 3 ]  V1 [ k 3 , l 3 ] . Hence, V2 [ k 1 , l 1 ] = V1 [ k 3 , l 3 ]  V2 [ l 1 ] = V1 [ k 3 ]  l 1 = k 3 , by the writer’s program.  k 2 = l 2 by (2).
  • 46.
  • 47. Useful Synchronization Primitives Usually Necessary in Nonblocking Algorithms CAS2 extends this CAS(var, old, new)  if var  old then return false fi; var := new; return true  LL(var)  establish “link” to var; return var  SC(var, val)  if “link” to var still exists then break all current links of all processes; var := val; return true else return false fi 
  • 48. Another Lock-free Example Shared Queue type Qtype = record v: valtype; next: pointer to Qtype end shared var Tail: pointer to Qtype; local var old, new: pointer to Qtype procedure Enqueue (input: valtype) new := (input, NIL); repeat old := Tail until CAS2(Tail, old->next, old, NIL, new, new) Tail old Tail old new new retry loop
  • 49. Using Locks in Real-time Systems The Priority Inversion Problem Uncontrolled use of locks in RT systems can result in unbounded blocking due to priority inversions . Time Low Med High t t t 0 1 2 Shared Object Access Priority Inversion Computation not involving object accesses Solution: Limit priority inversions by modifying task priorities . Time Low Med High t 0 t 1 t 2
  • 50.