About asynchronous methods and threads
问题 What actually happens behind the scenes with asynchronous functions? Does it open a new thread and let the OS start and run it? If so, can it cause deadlocks or other thread problems? Here's an example of a async method: var fs = require('fs') var file = process.argv[2] fs.readFile(file, function (err, contents) { var lines = contents.toString().split('\n').length - 1 console.log(lines) }) 回答1: In fs.readFile(file,callback) .This is a non-blocking call which means. node's main thread stores