Relative Content

Tag Archive for concurrency

Java BufferedReader vs Separate Producer consumer thread

I have a very big file delimited by some sequence of characters ‘*L*I*N*E’. The file will be of the order of 250G. And each line comes around 600bytes to 1000 bytes. I will be performing the following operations on the file,

How could one make a reasonably efficient, pointer-sized mutex?

I have my own ideas about how a pointer-sized mutex could be made: The integer is used as a set of flags, counter, index, and a spinlock that guards an entry in a table of pre-allocated kernel objects given to mutexes only when threads are contending, and released afterward (only need at most N table entries for N threads).

Conceptually what does it mean when it is said that each thread gets its own stack?

I have been reading Java Concurrency in Practice by Brian Goetz and inside the section Stack Confinement it is mentioned that each thread gets its own stack and so local variables are intrinsically confined to the executing thread; they exist on the executing threads stack, which is not accessible to other threads. What does he mean that each thread has its own execution stack ?