posts with the tag: named pipe

Posted by: bob on Wednesday July 27th 2011 2 comments
Tags: named pipe, queue

In this part of the series we will add the ability to accept input from named pipes to the queue server, an important feature so that the queue can actually be given things to do. Again, I would like to point out that it is assumed we are running on a Unixesque operating system such as Linux, BSD, or Solaris.

What are Named Pipes?

Named Pipes are special files that the kernel can create allowing for buffered byte streams. They operate on the principle of FIFO, where the first thing put into it is the first thing it spits out. This is perfect for our queue system as we want to process the first thing put into it first. To store data into a named pipe, it is as easy as `echo lol > /path/to/pipe` and reading the data back out is as easy as `cat /path/to/pipe`. An interesting note about named pipes is that by default they block until there is both a reader and a writer. This means the echo command will hang until another terminal is opened and the cat command is executed.

Here is a quick video demonstrating how the queue system will work by the end of this post. We will be able to launch the server, and send input to it from another terminal via the named pipe.

Continue reading about using Named Pipes

Posted by: bob on Tuesday July 26th 2011 no comments
Tags: daemon, fork, named pipe, queue

So to be hip, I am going to write one of these multipart blog things that describe building a simple project from start to finish. Are you ready? O.K. here we go.

What is a Queue Server?

A queue server is a server that processes a queue, which is why it is so aptly named. You send it a list of things to do and it does them over time based on your parameters, be it “as fast as possible” or “when system resources allow” or “once an hour” it is your call.

Over the course of the next week or so I am going to demonstrate building a simple queue server that will be able to fork itself off as a background daemon, accept input through a named pipe, and process things as fast as it can until it runs out of things to do – and when that happens it will sit there waiting with the upmost desire for you to provide it with more jobs.

Continue reading about this project…