Nodejs
- 11. a. Context switching between threads is faster than that between processes a. Context switching between threads is not free
- 13. b. Multiple threads within a process share state as well as memory and other resources b. Call stack associated with a thread is > 0 bytes
- 15. c. Scaling is achieved by creating a new thread per connection.
- 16. c. Scaling is achieved by creating a new thread per connection. c. For massive concurrency we can not use one O/S thread per connection.
- 19. d. Creating a thread is faster than creating a process. d. Thread creation is not really cheap, and in some systems it's costlier than forking.
- 22. 1. Using Java NIO/MQ for asynchronous calls, I/O operations. 2. Using green threads 3. Thread pooling
- 23. But it needs expert knowledge and system level hacking in some cases.
- 34. Provides a simplistic API to write extremely scalable event-driven server
- 45. // Old blocking style resultSet = database.select("something"); // wait... tap tap tap doStuff(resultSet);
- 46. // New non-blocking style database.select("something", function(resultSet) { // called on completion doStuff(resultSet); });
- 47. var sys = require('sys'), http = require('http'); http.createServer(function (req, res) { setTimeout(function () { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World!'); }, 2000); }).listen(8000); sys.puts('Server running at http://127.0.0.1:8000/'); Hello World!
- 57. var sys = require("sys"); sys.puts("Happy Hacking!");