Questions tagged [fifo]

Any structure in which the First object In is the First object Out. Synonyms include queue, and pipe.

Any structure in which the First object In is the First object Out.

See:

1105 questions
166
votes
15 answers

Fixed size queue which automatically dequeues old values upon new enqueues

I'm using ConcurrentQueue for a shared data structure which purpose is holding the last N objects passed to it (kind of history). Assume we have a browser and we want to have the last 100 browsed Urls. I want a queue which automatically drop…
Xaqron
  • 29,931
  • 42
  • 140
  • 205
109
votes
8 answers

Which STL container should I use for a FIFO?

Which STL container would fit my needs best? I basically have a 10 elements wide container in which I continually push_back new elements while pop_front ing the oldest element (about a million time). I am currently using a std::deque for the task…
Gab Royer
  • 9,587
  • 8
  • 40
  • 58
106
votes
17 answers

Is there a queue implementation?

Can anyone suggest Go container for simple and fast FIF/queue, Go has 3 different containers: heap, list and vector. Which one is more suitable to implement a queue?
rev
  • 1,063
  • 2
  • 8
  • 4
73
votes
7 answers

FIFO class in Java

I want to implement FIFO through a class in Java. Does such a class already exist? If not, how can I implement my own? NOTE I found a class here http://www.dcache.org/manuals/cells/docs/api/dmg/util/Fifo.html, but it doesn't contain dmg.util.*. I…
Rog Matthews
  • 3,147
  • 16
  • 37
  • 56
67
votes
1 answer

Why does a read-only open of a named pipe block?

I've noticed a couple of oddities when dealing with named pipes (FIFOs) under various flavors of UNIX (Linux, FreeBSD and MacOS X) using Python. The first, and perhaps most annoying is that attempts to open an empty/idle FIFO read-only will block…
Jim Dennis
  • 17,054
  • 13
  • 68
  • 116
48
votes
5 answers

Named Pipes (FIFOs) on Unix with multiple readers

I have two programs, Writer and Reader. I have a FIFO from Writer to Reader so when I write something to stdin in Writer, it gets printed out to stdout from Reader. I tried doing this with TWO Readers open, and I got output to stdout from only one…
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
46
votes
3 answers

How to work with "FIFO" in C# .NET?

Is there a standard collection in .NET that implements a FIFO stack?
Rella
  • 65,003
  • 109
  • 363
  • 636
43
votes
10 answers

Linux non-blocking fifo (on demand logging)

I like to log a programs output 'on demand'. Eg. the output is logged to the terminal, but another process can hook on the current output at any time. The classic way would be: myprogram 2>&1 | tee /tmp/mylog and on demand tail…
dronus
  • 10,774
  • 8
  • 54
  • 80
43
votes
10 answers

Is list better than vector when we need to store "the last n items"?

There are a lot of questions which suggest that one should always use a vector, but it seems to me that a list would be better for the scenario, where we need to store "the last n items" For example, say we need to store the last 5 items…
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190
33
votes
6 answers

Create a temporary FIFO (named pipe) in Python?

How can you create a temporary FIFO (named pipe) in Python? This should work: import tempfile temp_file_name = mktemp() os.mkfifo(temp_file_name) open(temp_file_name, os.O_WRONLY) # ... some process, somewhere, will read it ... However, I'm…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
33
votes
1 answer

FIFO serial queue using GCD

I am trying to create a (network) synchronized array for the company I work for. While the networking part works fine, I have dwelled into an issue. My wish was to create a new queue using dispatch_create_queue, to which I would add two blocks that…
Ælex
  • 14,432
  • 20
  • 88
  • 129
27
votes
2 answers

How do I properly write to FIFOs in Python?

Something very strange is happening when I open FIFOs (named pipes) in Python for writing. Consider what happens when I try to open a FIFO for writing in a interactive interpreter: >>> fifo_write = open('fifo', 'w') The above line blocks until I…
Thiago Padilha
  • 4,590
  • 5
  • 44
  • 69
27
votes
1 answer

Create Named Pipe C++ Windows

I am trying to create a simple comunication between 2 processes in C++ ( Windows ) like FIFO in linux. This is my server: int main() { HANDLE pipe = CreateFile(TEXT("\\\\.\\pipe\\Pipe"), GENERIC_READ, 0, NULL, OPEN_EXISTING, …
user3052078
  • 487
  • 1
  • 8
  • 20
25
votes
4 answers

real time scheduling in Linux

This morning I read about Linux real time scheduling. As per the book 'Linux system programming by Robert Love', there are two main scheduling there. One is SCHED_FIFO, fifo and the second is SCHED_RR, the round robin. And I understood how a fifo…
theB
  • 2,048
  • 2
  • 20
  • 29
23
votes
1 answer

How do I perform a non-blocking fopen on a named pipe (mkfifo)?

If I have a program which creates and attempts to open a named pipe using mkfifo, how can I open a pipe for reading or writing without blocking? Specifically, I'm writing a C program which can be run with or without a gui (written in Java). In the C…
Zxaos
  • 7,791
  • 12
  • 47
  • 61
1
2 3
73 74