Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
What makes NodeOS better than other traditional operating systems? #200
General purpose operating systems are extremely complex. First they have to provide an extensive HAL (Hardware Abstraction Layer) that can support the wide range of different devices they can be installed on. Second, they need to provide functionality as well as protection for multiple users and many programs/services that support those users.
Web servers require none of that functionality. They generally run off of VMs (Virtual Machines) that abstract away all of the hardware-specific details and they're generally designed for single-purpose usage.
Lets say you decided to build an OS from scratch. Start by stripping everything down to the bare essentials. HAL isn't required because the VM already takes care of abstracting away the hardware. V8 already provides memory/filesystem sandboxing so the separation of user/kernel space (and all of the processing overhead it requires) is no longer necessary.
What you get is an OS that takes up less than 10MB of space, boots up in seconds, requires zero maintenance (other than pushing new updates), requires minimal memory overhead, and runs as fast or faster than the fastest C implementations running on a general purpose OS.
If you've ever used IaaS, you've probably had to deal with the pains of deployment. Deploying a complete general-purpose OS image is a PITA. Docker makes things easier by making it so you only have to deploy your application-specific differences but it adds yet another layer of abstraction, including more complexity and space/memory overhead. Plus, you still have to manage updating the underlying OS for security vulnerabilities and bug fixes.
Here are the layers of abstraction for a Docker deployment:
And for an application specific system in NodeOS:
Fewer layers, means less bloat and drastically reduced surface area for security vulnerabilities.
Use case - Building a Load Balancer:
Run the build step which packages everything (incl a minimal Linux kernel and Node/V8) as a VM. Then deploy the VM using git or some other deployment tool.
Occasionally, you may need to update dependencies (npm update) and/or modify the config. Run the build step again and it's ready for deployment.
In most setups, the OS lives on the server and changes/updates are either managed remotely via provisioning tools (ex ansible/puppet) or pushed as Docker containers.
In a Unikernel. The setup, dependency management, build process can all be automated using NPM and existing libraries. The builds are small enough that they can be versioned using git.
Theoretically, you could do a whole system setup with 4 commands:
omg you're right!
How do you do a directory listing from the REPL?
---- On Wed, 06 Jan 2016 04:43:55 +1000 Hans Jorgensen <email@example.com>wrote ----
The thought of having a NodeJS REPL as my command line / operating system reminds me (very fondly) of playing with my Apple //e, with BASIC right at the command line.
Reply to this email directly or view it on GitHub.
@jwulf in nsh (the command prompt in NodeOS) the commands are the same as a standard Linux terminal. "ls" lists the folders and files in a directory. If you're talking about the default JS REPL, it evaluates JS so you'd actually have to pop a node script in there to read and print the directly files and folders.