What is thread synchronization?
Submitted by: AdministratorIn multithreading, the shared resources are allocated to one thread at a time.
multiple thread ensuring that the shared resources will be allocated to only one thread at a time is called thread synchronization.
The synchronized keyword is used to define the critical block in which every Java object get a lock to enter.
Syntax:
Synchronized(object) // object is reference of the object to be synchronized
{
// statement to be synchronized.
}
The synchronized keyword provides locking which maintain the mutual exclusive access of shared resource and race of objects for data.
Submitted by: Administrator
multiple thread ensuring that the shared resources will be allocated to only one thread at a time is called thread synchronization.
The synchronized keyword is used to define the critical block in which every Java object get a lock to enter.
Syntax:
Synchronized(object) // object is reference of the object to be synchronized
{
// statement to be synchronized.
}
The synchronized keyword provides locking which maintain the mutual exclusive access of shared resource and race of objects for data.
Submitted by: Administrator
Read Online Java Multi-Threading Job Interview Questions And Answers
Top Java Multi-Threading Questions
☺ | Explain deadlock? |
☺ | What is the sleep() method Data type for the parameter? |
☺ | Explain the difference between preemptive scheduling and time slicing? |
☺ | How many threads at a time can access a monitor? |
☺ | Name the default thread at the time of starting the program? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |