জাভা Synchronization কি? এটী কিভাবে কাজ করে? কোড সহ উদাহরন দিলে ভাল হয়।

asked 21 Oct '16, 19:03

Emranul%20haque%20Rakib's gravatar image

Emranul haque Rakib
33915


-3

Synchronization is the process of allowing threads to execute one after another.

Synchronization control the access the multiple threads to a shared resources. Without synchronization of threads, one thread can modify a shared variable while another thread can update the same shared variable, which leads to significant errors.

Java supports multiple threads to be executed. This may cause two or more threads to access the same fields or objects. Synchronization is a process which keeps all concurrent threads in execution to be in synch. Synchronization avoids memory consistence errors caused due to inconsistent view of shared memory. When a method is declared as synchronized; the thread holds the monitor for that method's object If another thread is executing the synchronized method, your thread is blocked until that thread releases the monitor.

Example:

Public synchronized void increment()

{

X++;

}

Thank you

permanent link

answered 22 Oct '16, 02:42

Sikder%20Emran's gravatar image

Sikder Emran
(suspended)

2

ইংরেজিতেই যদি উত্তর লেখা হয়, তাহলে প্রোগ্রামাবাদ কেন?

(22 Oct '16, 06:52) Tamim Shahriar Subeen ♦♦

sorry vai..and thanks for your suggestion ... next time banglai ans devo

(22 Oct '16, 12:51) Sikder Emran
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×68

question asked: 21 Oct '16, 19:03

question was seen: 906 times

last updated: 22 Oct '16, 13:13