1.

Define libuv library?

Answer»

libuv is a multi-platform library of Node.js that SUPPORTS asynchronous I/O. It’s written in C.It was developed for Node.js, but it’s also used by Luvit, Julia, pyuv etc.libuv library handles file system, DNS, child processes, pipes, signal handling, POLLING and streaming.libuv provides the event loop to Node.js.The important features of libuv are:

  • Full-featured event loop
  • Asynchronous TCP & UDP sockets
  • Child processes
  • Thread pool or Worker Pool, that offloads work for some things that cannot be done ASYNCHRONOUSLY at the OS level.
  • Signal handling

In event-driven programming, an application follows certain EVENTS and respond to them when they occur. libuv gathers events from the operating system or other sources of events and then user registers callbacks to be called when an event occurs.

Some examples of events are:

  • The file is ready for writing
  • Time out of a timer

Libuv also provides two types of abstractions to users alongside  These are handles and requests. Handles represent long living objects like TCP server handle where its connection callback is called every time when there is a new connection. Requests are short-lived operations performed on the handle like write requests to write DATA on a handle.



Discussion

No Comment Found