SlideShare ist ein Scribd-Unternehmen logo
1 von 4
ICS 313 - Fundamentals of Programming Languages 1
13. Concurrency
13.1 Introduction
Concurrency can occur at four levels:
1. Machine instruction level
2. High-level language statement level
3. Unit level
4. Program level
Because there are no language issues in instruction and program-level
concurrency, they are not addressed here
The Evolution of Multiprocessor Architectures
Late 1950s - One general-purpose processor and one or more special-
purpose processors for input and output operations
Early 1960s - Multiple complete processors, used for program-level
concurrency
Mid-1960s - Multiple partial processors, used for instruction-level
concurrency
Single-Instruction Multiple-Data (SIMD) machines. The same instruction
goes to all processors, each with different data - e.g., vector processors
Multiple-Instruction Multiple-Data (MIMD) machines - Independent processors that
can be synchronized (unit-level concurrency)
ICS 313 - Fundamentals of Programming Languages 2
13.1 Introduction (continued)
A thread of control in a program is the sequence of program points
reached as control flows through the program
Categories of Concurrency
Physical concurrency - Multiple independent processors
(multiple threads of control)
Logical concurrency - The appearance of physical concurrency is
presented by time-sharing one processor
(software can be designed as if there were multiple threads of control)
Coroutines provide only quasi-concurrency
Reasons to Study Concurrency
It involves a different way of designing software that can be very useful
- many real-world situations involve concurrency
Computers capable of physical concurrency are now widely used
13.2 Intro to Subprogram-Level Concurrency
A task is a program unit that can be in concurrent execution with other
program units
Tasks differ from ordinary subprograms in that:
A task may be implicitly started
When a program unit starts the execution of a task, it is not necessarily
suspended
When a task’s execution is completed, control may not return to the caller
Tasks usually work together
A task is disjoint if it does not communicate with or affect the execution
of any other task in the program in any way
Task communication is necessary for synchronization
Task communication can be through:
Shared nonlocal variables
Parameters
Message passing
ICS 313 - Fundamentals of Programming Languages 3
13.2 Intro to Subprogram-Level Concurrency (continued)
Kinds of synchronization
Cooperation
Task A must wait for task B to complete some specific activity before task A can continue its execution e.g., the
producer-consumer problem
Competition
When two or more tasks must use some resource that cannot be simultaneously used e.g., a shared counter
Competition is usually provided by mutually exclusive access
Providing synchronization requires a mechanism for delaying task execution
Task execution control is maintained by a program called the scheduler, which
maps task execution onto available processors
Tasks can be in one of several different execution states:
New - created but not yet started
Runnable or ready - ready to run but not currently running (no available processor)
Running
Blocked - has been running, but cannot now continue (usually waiting for some
event to occur)
Dead - no longer active in any sense
13.2 Intro to Subprogram-Level Concurrency (continued)
Liveness is a characteristic that a program unit may or may not have
In sequential code, it means the unit will eventually complete its execution
In a concurrent environment, a task can easily lose its liveness
If all tasks in a concurrent environment lose their liveness, it is called
deadlock
Design Issues for Concurrency
How is cooperation synchronization provided?
How is competition synchronization provided?
How and when do tasks begin and end execution?
Are tasks statically or dynamically created?
Methods of Providing Synchronization:
Semaphores
Monitors
Message Passing
ICS 313 - Fundamentals of Programming Languages 4
13.7 Java Threads
The concurrent units in Java are run methods
The run method is inherited and overriden in subclasses of
the predefined Thread class
The Thread Class
Includes several methods (besides run)
start, which calls run , after which control returns immediately to
start
yield, which stops execution of the thread and puts it in the task
ready queue
sleep, which stops execution of the thread and blocks it from
execution for the amount of time specified in its parameter
Early versions of Java used three more Thread methods
suspend, which stops execution of the thread until it is restarted with resume
resume, which restarts a suspended thread
stop, which kills the thread
13.7 Java Threads (continued)
Competition Synchronization with Java Threads
A method that includes the synchronized modifier disallows any
other method from running on the object while it is in execution
If only a part of a method must be run without interference, it can be
synchronized
Cooperation Synchronization with Java Threads
The wait and notify methods are defined in Object, which is the root
class in Java, so all objects inherit them
The wait method must be called in a loop
Example - the queue
See Queue class (pp. 549-550) and the Producer and Consumer
classes (p. 550)

Weitere ähnliche Inhalte

Was ist angesagt?

Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)
Sri Prasanna
 

Was ist angesagt? (20)

Multi Processors And Multi Computers
 Multi Processors And Multi Computers Multi Processors And Multi Computers
Multi Processors And Multi Computers
 
Hci Prototype Report
Hci Prototype ReportHci Prototype Report
Hci Prototype Report
 
Cognitive models unit 3
Cognitive models unit 3Cognitive models unit 3
Cognitive models unit 3
 
HOSPITAL MANAGEMENT SYSTEM PROJECT
HOSPITAL MANAGEMENT SYSTEM PROJECTHOSPITAL MANAGEMENT SYSTEM PROJECT
HOSPITAL MANAGEMENT SYSTEM PROJECT
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Memory consistency models and basics
Memory consistency models and basicsMemory consistency models and basics
Memory consistency models and basics
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 
Communications is distributed systems
Communications is distributed systemsCommunications is distributed systems
Communications is distributed systems
 
Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)
 
Software Requirements Specification for restaurant management system
Software Requirements Specification for restaurant management systemSoftware Requirements Specification for restaurant management system
Software Requirements Specification for restaurant management system
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Distributed Operating Systems
Distributed Operating SystemsDistributed Operating Systems
Distributed Operating Systems
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411
 
program flow mechanisms, advanced computer architecture
program flow mechanisms, advanced computer architectureprogram flow mechanisms, advanced computer architecture
program flow mechanisms, advanced computer architecture
 
Data communication and network Chapter - 2
Data communication and network Chapter - 2Data communication and network Chapter - 2
Data communication and network Chapter - 2
 
HCI 3e - Ch 6: HCI in the software process
HCI 3e - Ch 6:  HCI in the software processHCI 3e - Ch 6:  HCI in the software process
HCI 3e - Ch 6: HCI in the software process
 
Railway Reservation System - Software Engineering
Railway Reservation System - Software EngineeringRailway Reservation System - Software Engineering
Railway Reservation System - Software Engineering
 
Transport layer
Transport layerTransport layer
Transport layer
 
Problems of cooperative system
Problems of cooperative systemProblems of cooperative system
Problems of cooperative system
 
Human Computer Interaction - INPUT OUTPUT CHANNELS
Human Computer Interaction - INPUT OUTPUT CHANNELSHuman Computer Interaction - INPUT OUTPUT CHANNELS
Human Computer Interaction - INPUT OUTPUT CHANNELS
 

Ähnlich wie 13 concurrency

operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
gezaegebre1
 
ch13 here is the ppt of this chapter included pictures
ch13 here is the ppt of this chapter included picturesch13 here is the ppt of this chapter included pictures
ch13 here is the ppt of this chapter included pictures
PranjalRana4
 
distributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxdistributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptx
lencho3d
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
Ashesh R
 

Ähnlich wie 13 concurrency (20)

Java multi thread programming on cmp system
Java multi thread programming on cmp systemJava multi thread programming on cmp system
Java multi thread programming on cmp system
 
Chapter05 new
Chapter05 newChapter05 new
Chapter05 new
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
 
ch13 here is the ppt of this chapter included pictures
ch13 here is the ppt of this chapter included picturesch13 here is the ppt of this chapter included pictures
ch13 here is the ppt of this chapter included pictures
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Process Management Operating Systems .pptx
Process Management        Operating Systems .pptxProcess Management        Operating Systems .pptx
Process Management Operating Systems .pptx
 
Concurrency in c#
Concurrency in c#Concurrency in c#
Concurrency in c#
 
Interactive debugging system
Interactive debugging systemInteractive debugging system
Interactive debugging system
 
Chapter 3 chapter reading task
Chapter 3 chapter reading taskChapter 3 chapter reading task
Chapter 3 chapter reading task
 
Threads
ThreadsThreads
Threads
 
Spr ch-01
Spr ch-01Spr ch-01
Spr ch-01
 
distributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxdistributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptx
 
parallel programming models
 parallel programming models parallel programming models
parallel programming models
 
UNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptxUNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptx
 
Mulitthread
MulitthreadMulitthread
Mulitthread
 
Multi t hreading_14_10
Multi t hreading_14_10Multi t hreading_14_10
Multi t hreading_14_10
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Task communication
Task communicationTask communication
Task communication
 
Operating system concepts ninth edition (2012), chapter 2 solution e1
Operating system concepts ninth edition (2012), chapter 2 solution e1Operating system concepts ninth edition (2012), chapter 2 solution e1
Operating system concepts ninth edition (2012), chapter 2 solution e1
 
Parallel Processing (Part 2)
Parallel Processing (Part 2)Parallel Processing (Part 2)
Parallel Processing (Part 2)
 

Mehr von jigeno

Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
jigeno
 
16 logical programming
16 logical programming16 logical programming
16 logical programming
jigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
jigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
jigeno
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
jigeno
 
12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programming
jigeno
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
jigeno
 
9 subprograms
9 subprograms9 subprograms
9 subprograms
jigeno
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
jigeno
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
jigeno
 
6 data types
6 data types6 data types
6 data types
jigeno
 
5 names
5 names5 names
5 names
jigeno
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysis
jigeno
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semantics
jigeno
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languages
jigeno
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminaries
jigeno
 
Access2007 m2
Access2007 m2Access2007 m2
Access2007 m2
jigeno
 
Access2007 m1
Access2007 m1Access2007 m1
Access2007 m1
jigeno
 

Mehr von jigeno (20)

Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
 
Bsit1
Bsit1Bsit1
Bsit1
 
16 logical programming
16 logical programming16 logical programming
16 logical programming
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programming
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 
9 subprograms
9 subprograms9 subprograms
9 subprograms
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
 
6 data types
6 data types6 data types
6 data types
 
5 names
5 names5 names
5 names
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysis
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semantics
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languages
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminaries
 
Access2007 m2
Access2007 m2Access2007 m2
Access2007 m2
 
Access2007 m1
Access2007 m1Access2007 m1
Access2007 m1
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

13 concurrency

  • 1. ICS 313 - Fundamentals of Programming Languages 1 13. Concurrency 13.1 Introduction Concurrency can occur at four levels: 1. Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Because there are no language issues in instruction and program-level concurrency, they are not addressed here The Evolution of Multiprocessor Architectures Late 1950s - One general-purpose processor and one or more special- purpose processors for input and output operations Early 1960s - Multiple complete processors, used for program-level concurrency Mid-1960s - Multiple partial processors, used for instruction-level concurrency Single-Instruction Multiple-Data (SIMD) machines. The same instruction goes to all processors, each with different data - e.g., vector processors Multiple-Instruction Multiple-Data (MIMD) machines - Independent processors that can be synchronized (unit-level concurrency)
  • 2. ICS 313 - Fundamentals of Programming Languages 2 13.1 Introduction (continued) A thread of control in a program is the sequence of program points reached as control flows through the program Categories of Concurrency Physical concurrency - Multiple independent processors (multiple threads of control) Logical concurrency - The appearance of physical concurrency is presented by time-sharing one processor (software can be designed as if there were multiple threads of control) Coroutines provide only quasi-concurrency Reasons to Study Concurrency It involves a different way of designing software that can be very useful - many real-world situations involve concurrency Computers capable of physical concurrency are now widely used 13.2 Intro to Subprogram-Level Concurrency A task is a program unit that can be in concurrent execution with other program units Tasks differ from ordinary subprograms in that: A task may be implicitly started When a program unit starts the execution of a task, it is not necessarily suspended When a task’s execution is completed, control may not return to the caller Tasks usually work together A task is disjoint if it does not communicate with or affect the execution of any other task in the program in any way Task communication is necessary for synchronization Task communication can be through: Shared nonlocal variables Parameters Message passing
  • 3. ICS 313 - Fundamentals of Programming Languages 3 13.2 Intro to Subprogram-Level Concurrency (continued) Kinds of synchronization Cooperation Task A must wait for task B to complete some specific activity before task A can continue its execution e.g., the producer-consumer problem Competition When two or more tasks must use some resource that cannot be simultaneously used e.g., a shared counter Competition is usually provided by mutually exclusive access Providing synchronization requires a mechanism for delaying task execution Task execution control is maintained by a program called the scheduler, which maps task execution onto available processors Tasks can be in one of several different execution states: New - created but not yet started Runnable or ready - ready to run but not currently running (no available processor) Running Blocked - has been running, but cannot now continue (usually waiting for some event to occur) Dead - no longer active in any sense 13.2 Intro to Subprogram-Level Concurrency (continued) Liveness is a characteristic that a program unit may or may not have In sequential code, it means the unit will eventually complete its execution In a concurrent environment, a task can easily lose its liveness If all tasks in a concurrent environment lose their liveness, it is called deadlock Design Issues for Concurrency How is cooperation synchronization provided? How is competition synchronization provided? How and when do tasks begin and end execution? Are tasks statically or dynamically created? Methods of Providing Synchronization: Semaphores Monitors Message Passing
  • 4. ICS 313 - Fundamentals of Programming Languages 4 13.7 Java Threads The concurrent units in Java are run methods The run method is inherited and overriden in subclasses of the predefined Thread class The Thread Class Includes several methods (besides run) start, which calls run , after which control returns immediately to start yield, which stops execution of the thread and puts it in the task ready queue sleep, which stops execution of the thread and blocks it from execution for the amount of time specified in its parameter Early versions of Java used three more Thread methods suspend, which stops execution of the thread until it is restarted with resume resume, which restarts a suspended thread stop, which kills the thread 13.7 Java Threads (continued) Competition Synchronization with Java Threads A method that includes the synchronized modifier disallows any other method from running on the object while it is in execution If only a part of a method must be run without interference, it can be synchronized Cooperation Synchronization with Java Threads The wait and notify methods are defined in Object, which is the root class in Java, so all objects inherit them The wait method must be called in a loop Example - the queue See Queue class (pp. 549-550) and the Producer and Consumer classes (p. 550)