Difference between Pipe and Fifo

May 23, 2016
Pipe and Fifo both are IPC (Inter Process Communication) object.

Pipe (IPC Object)

  • Pipe does not have any name unlike Fifo.
  • Pipe is a structure of data which is contained into the memory. It is removed when existing process terminates.
  • Basically, Pipe is used to communicate between 2 or more related processes.
  • If Pipe is already in opened state, then it does not need to be opened.
  • Pipe provides simplex data flow
  • eg: pipe(int fd[2])

Fifo (IPC Object)

  • Fifo is also an IPC object, but it has its name.
  • Unlike Pipe, it is a structure of file which is created in disc.
  • It is also used for communication but only between unrelated processes.
  • It should be opened every time when it needs to write and read.
  • Fifo provides half duplex data flow.
  • eg: mkfifo(const char * path_name, mode_t mode)

Inter Process Communication Objects - pipe()

May 21, 2016

  • In unix system, pipe is known as an inter process communication mechanism.
  • A process can write data to pipe, and that data can be read by another process.
  • In pipe IPC, the data is handled in fifo i.e first in first out order.
  • Pipe does not have any name, it is only created for one use and both ends must be inherited from the single process which created the pipe.
  • Since it is a IPC object, it is used to communicate between two process i.e parent and child.
  • Pipe is created using pipe function (pipe()). Pipe also creates description pair which can be denoted as fd[0], fd[1]. Primarily fd[0] for reading and fd[1] for writing.
  • As pipe sets up, the data can be passed using read and write functions.

Elementary System Calls - Wait() and Waitpid()

May 21, 2016
Wait function suspends the execution of the calling process until one of its children terminates.

Waitpid suspends execution of the calling process until a child specified by pid argument has changed state.

Wait():

  • Wait() continues to block the caller until a child process terminates.
  • If there are more than one child running, wait() returns the first time one of the parent's offspring exists
  • It doesn't support job control.

Waitpid():

  • It can be either blocking or non-blocking:
if 0, blocking
if WNOHANG, non-blocking
It is flexible
It waits for child process if pid is -1
It waits for child of greater process id if pid>0
It waits for any child whose process group ID equals that of the calling process if pid equals to 0.
It waits for any child whose process group ID equals that absolute value of pid. 
  • It supports job control. 

Elementary Operating System Call - Fork()

May 20, 2016

What is system call ?

Karnel is the heart of Computer System. In computer system, a request has to be made by operating system to the Karnel in order to get the service, and it is only done in programmatic way, which is known as system call.

Program is a collection of instructions that is made to complete a particular task. And a process is a particular program which is currently in running status.

Thread includes in process i.e process has some properties of thread - a single sequence stream within process is called thread.


Fork() 



  • In UNIX system, we use Fork() to create duplicate of a process by creating address space for duplicate one.
  • The process from which fork method is called, known as parent process. And child process is the new created process. Child and Parent, both processes return from the system call and execute the next instruction. 
  • Child process has all the features and ability of parent process i.e all memory segments of parent process are consumed by child process also. Parent and Child both processes execute independently whereas there is same code for both processes.
  • Parent and Child both process have different process IDs. They are executed at different memory address. 
  • As fork method executes, it returns twice - 0 and process ID to parent process if fork is successfully executed and it returns -1 if it is failed.
Synopsis
#include<unistd.h>
pid_t fork(void);

The Reason Why Everyone Love Blogging

May 18, 2016
Why is blogging important
A lot of people worldwide proudly call their self a blogger, even i, I used to hate blogging at first because it frustrate me all those things about SEO, Backlinks, Meta tags, etc. I never thought that blogging would be this fun so I would list down some of the highlighted reason why most of people stick and love being a blogger

SHARING IDEAS

Blogging is essential way to share your idea and thoughts with everyone else, at first when I start blogging I really don’t know how to start , what topic would I choose but then after hard thinking i got myself an idea on blogging about Android because I love android and I know a lot about it, so i stick with that topic, and after years passed by I got more experience and knowledge about blogging so I started sharing my ideas about blogging too, that’s why blogging is one of the best way to share idea on our fellow netizen.


EARN ONLINE

I think every blogger knows this, if you’re a blogger you can earn money with your content that’s why many people spending a lot of hard work in their blog for it to earn more, Adsense is one of the Ad Network where in millions of website and blog used to monetize to their site/blog , So you can earn money by just sitting down your chair writing a good article and drives traffic to your blog, 

BUILDING COMMUNITIES

Many blogger, enter the world of blogging to connect with others to be part of something, meet new people to connect relatives and friends and to discuss on a certain topics

PROMOTING YOUR SELF

What is the best way to be known about your skills, talent or your creativity, many people blogging to share their self for example (Soccer Tutorial by you, or ARTS you made) By that you get exposes to other people.

HELPING INEED 

I think you already know this , I know you get a lot of knowledge in other blog sharing helpful importation for example before starting a blog I know that you search about how to start a blog first right? So other we are thankful that other blogger share their ideas and knowledge to others, that’s why they blog because they’re good on something to help other who don’t.

TO BE HEARD

Many writers engage them self to blog because as you know millions and millions of people now a days is connected to internet and spend a lot of their time in it. So that’s why writer start blogging to so that many people will notice his/her work.