Clone system call example

This is a quick article on Clone system call example without talking shit. So let’s see some pointers for the same : clone() creates a new process, in a manner similar to fork. It is actually a library function layered on top of the underlying clone()system call. Unlike fork , these calls allow the child process to share parts of its execution context with the calling process, such as the memory space, the table of file descriptors, and the table of signal handlers....

September 10, 2016 · 2 min · 419 words · Vishal Chovatiya

Dealing with Multiple file descriptor : poll() system call

Why use poll()? Suppose you have to deal with multiple clients connected at the same time. A natural question, then, is: how can you read from multiple file descriptors (sockets) at once? Do you need to make some really annoyingly multi-threaded code to handle each client that’s connected? Do you have to go into some stupid loop constantly checking each socket to see if data’s available? You can resolve this issue efficiently by polling file descriptor(Sockets here)....

September 10, 2016 · 2 min · 266 words · Vishal Chovatiya