Skip to content

Instantly share code, notes, and snippets.

View srinath-imaginea's full-sized avatar

Srinath Sankar srinath-imaginea

  • Imaginea
  • Chennai
View GitHub Profile
@srinath-imaginea
srinath-imaginea / knowncircle-logo.html
Last active December 10, 2015 04:01
KnownCircle pure CSS animated logo
<!DOCTYPE html>
<html>
<head>
<title>KnownCircle logo</title>
<style>
.logo {
display: inline-block;
position: relative;
width: 36px;
height: 36px;
@srinath-imaginea
srinath-imaginea / rundown.md
Last active December 10, 2015 05:22
Node.js rundown

When we read about Nodejs on the web, everybody start to say "In Node, everything runs in parallel except your code". We have hard time understanding this. What runs in parallel and what not? How does node gets additional thread to run something in parallel ? Who manages these threads? Once we get into a situation, where we have more than one thread, how does node achieve synchronization over the shared objects?

So this is a slightly tricky part of understanding Node's architecture. For all purposes, Node.js is single threaded and runs in a single process. That is the code you type is executed in a single thread. So if you do a while(block for 1 second), the entire process will be blocked. But this obviously isn't performant - if you have a couple of I/O requests to process for each HTTP request, it will block all further execution until that is complete.

Here is where node's async bit comes into play. For everything that is I/O intensive, Node.js automagically executes it in the background us