I don't understand the difference in java multithread system and Nodejs mutltithread system in terms of peformance and resource sharing. As NodeJS use event loop single thread for your program but behind the scene it assign task to different threads like file reading or db queries. so there it uses multithread and threadpool (similar to Java?). But whenever we compare the performance, NodeJS apps are far better than other multi threading system.
How actually NodeJS handle multithread programming challenges like overflow or locking thread. How does it share resources between threads for example I am accessing same file at same time with two I/O so there will be two thread accessing to one resource, does it apply in NodeJS multithreading system? Or I have misunderstood this point?