Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ced5212

Browse files
Update README.md
1 parent 6b2276d commit ced5212

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,14 @@ Every Java thread has a priority that helps the operating system determine the o
649649

650650
**isAlive():** Returns true or false based on whether Thread is alive or not. See **[Code](https://github.com/disha2sinha/Object-Oriented-Programming-in-Java/blob/master/Multithreading/MultiThreading6.java)**
651651

652+
### SYNCHRONIZATION:
653+
654+
Multi-threaded programs may often come to a situation where multiple threads try to access the same resources and finally produce erroneous and unforeseen results.
655+
656+
So it needs to be made sure by some synchronization method that only one thread can access the resource at a given point of time.
657+
658+
Java provides a way of creating threads and synchronizing their task by using synchronized blocks. Synchronized blocks in Java are marked with the synchronized keyword. A synchronized block in Java is synchronized on some object. All synchronized blocks synchronized on the same object can only have one thread executing inside them at a time. All other threads attempting to enter the synchronized block are blocked until the thread inside the synchronized block exits the block.See [code](https://github.com/disha2sinha/Object-Oriented-Programming-in-Java/blob/master/synchronization.java)
659+
652660

653661

654662

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /