Skip to content

Category: Java

Java Concurrency Basics

By using Multi-threading or concurrency we can enhance any Program’s performance in a great way. However multi-threading comes with it’s own challenges. Multi-threaded application runs all its thread in the same memory space thereby creating synchronization issues as reading and written of the same memory space is possible. For example, assume that when one thread running on one CPU Core is trying to read a memory location while another thread running on different CPU Core is trying to write it. What will happen now? Which value will the first thread read? Can it read both values partially?