Questions tagged [fifo]

0

votes
0

answer
7

Views

Why are FIFO One-quarter full, Half-full, three-quarter full interrupts provided in a UART RX FIFO? What are their use cases?

I am implementing a protocol decoder which receives bytes through UART of a microcontroller. The ISR takes bytes from the UART peripheral and puts it in a ring buffer. The main loop reads from the ring buffer and runs a state machine to decode it. The UART internally has a 32-byte receive FIFO, and...
Sreekesh Sreelal
1

votes
1

answer
792

Views

Size of named pipe? Process gets stuck

How can I find out how many bytes are in a named pipe? I want to check if there is still enough space before inserting a new object. At the moment my sending process gets stuck if the receiving process is to slow in taking the objects out of the pipe or if it is crashed. My code looks like: /*We o...
Thorsten Eggert
1

votes
1

answer
17.4k

Views

How to calculate average turnaround time - Round Robin and FIFO scheduling?

Five processes begins with their execution at (0, 0, 2, 3, 3) seconds and execute for (2, 2, 1, 2, 2) seconds. How do I calculate average turnaround time if: a) We use Round Robin (quantum 1 sec.) b) We use FIFO scheduling? I am not sure how to solve this, could you guys help me out? Here is the lin...
phantom
1

votes
1

answer
231

Views

How to make a fifo special file in C?

I have to use mkfifo in my C program in Ubuntu. But I have an error when I run the code: no such file or directory . I think the problem because I have not set the panel_fifo environment variables. But I don't know how could I do this. Here is my code I use to test this method: char *myfifo="./sock/...
1

votes
3

answer
1.3k

Views

Good approach for running Tasks synchronously with FIFO?

Currently, I do my first steps with async/await and tasks in .NET and I am very excited about how easy it is to run things asynchronously! However, at the moment I have to communicate with devices through a SerialPort. Since only one connection is possible at the same time, I just wrote a few extens...
Daniel
1

votes
2

answer
218

Views

Using dependencies to create a FIFO NSOperationQueue

I've created a NSOperationQueue subclass, set maxConcurrentOperations to 1, and have overridden the addOperation method to be the following: -(void)addOperation:(NSOperation *)op { // If there are already operations on the queue, add the last operation as a dependency to the delay. Ensures FIFO. if...
Darren Black
1

votes
1

answer
163

Views

C - writing and reading from FIFO file in parallel - unexpected behaviour

I have two pipes to FIFO file, reader and writer. I open two terminals and write on the writer, and expect the text to appear on the reader. For some reason, I am experiencing very weird behavior - sometimes a space or some chars are added and I have no idea why. can someone help me? I am attaching...
Gum Bi
1

votes
2

answer
606

Views

C fifo linked list char push

I'm currently trying to understand fifo linked list and found example here Example , and I'm trying to input char instead of int #include #include #include struct Node { char Data; struct Node* next; }*rear, *front; void delQueue() { struct Node *temp, *var=rear; if(var==rear) { rear = rear->next...
mypoint
1

votes
2

answer
728

Views

Continuous reading of FIFO using select()

I am trying to read a FIFO in the background (using a thread) while my main program is running inside an infinite loop. I want to use select() because otherwise the processor runs at 100%, but the appropriate example I found isn't working. This is the example code: #include #include #include #inc...
Vasil Kalchev
8

votes
6

answer
13k

Views

How implementation of java.util.queue uses LIFO?

In Java doc: [...] Among the exceptions are priority queues, which order elements according to a supplied comparator, or the elements' natural ordering, and LIFO queues (or stacks) which order the elements LIFO (last-in-first-out) How implementation of java.util.queue uses LIFO instead of FIFO?
celsowm
0

votes
1

answer
23

Views

Named pipe(FIFO) chat program using C (Linux)

Here is the code. (from. https://www.geeksforgeeks.org/named-pipe-fifo-example-c-program/) The following code, fifo1.c should send the message first, then fifo2.c can read it, and reply. I want to keep the pipe open, using a bidirectional channel, using O_RDWR. but i can't make it. I meaning, I want...
test_user
1

votes
2

answer
563

Views

Fifo opening issue C

I have this code: mkfifo ("bPipe", 0660); /* Create named pipe */ int fd1 = open ("bPipe", O_WRONLY|O_NONBLOCK); /* Open named pipe for writing */ perror("FD1"); int fd = open ("bPipe", O_RDONLY|O_NONBLOCK); /* Open it for reading */ perror("FD"); char*mex="Hello world\n\0"; write (fd1,mex , getStri...
mario razzu
1

votes
2

answer
3.1k

Views

VBA - How to make a queue in an array? (FIFO) first in first out

I am trying to make a queue which is able to show the first in first out concept. I want to have an array which works as a waiting list. The patients who come later will be discharged later. There is a limitation of 24 patients in the room the rest will go to a waiting list. whenever the room is emp...
Zapata
2

votes
1

answer
77

Views

FIFO programmed main thread dispatcher?

To begin with, I'm using unity. Which makes me stuck with .NET 3.5. I'm currently working on a server program which uses the Socket object's asynchronous methods (E.G. BeginReceive, BeginAccept, BeginReceiveFrom etc.). When the server receives a packet from a client, this packet is received on a wor...
None
17

votes
1

answer
32.6k

Views

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 program, I successfully create the named pipes usi...
Zxaos
1

votes
3

answer
796

Views

read the last line of a fifo

Here is the situation : Some process writes lines into a fifo file (created with mkfifo). At some point in my program, I want to read the last line in the fifo, and discard all the others. The procedure may block, only if there is less than one line in the fifo. I can't come up with a clean way to...
Ben
17

votes
3

answer
7.1k

Views

Prevent FIFO from closing / reuse closed FIFO

Consider the following scenario: a FIFO named test is created. In one terminal window (A) I run cat test. It is now possible to write in window B and get the output in window A. It is also possible to terminate the process A and relaunch it and still be able to use this setup as suspected. However i...
Shump
2

votes
2

answer
716

Views

How to implement a FIFO queue that supports namespaces

I'm using the following approach to handle a FIFO queue based on Google App Engine db.Model (see this question). from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.ext.webapp import run_wsgi_app class QueueItem(db.Model): created = db.DateTimeProperty(r...
systempuntoout
18

votes
2

answer
14.1k

Views

How to read named FIFO non-blockingly?

I create a FIFO, and periodically open it in read-only and non-blockingly mode from a.py: os.mkfifo(cs_cmd_fifo_file, 0777) io = os.open(fifo, os.O_RDONLY | os.O_NONBLOCK) buffer = os.read(io, BUFFER_SIZE) From b.py, open the fifo for writing: out = open(fifo, 'w') out.write('sth') Then a.py will ra...
chaonin
18

votes
1

answer
43.2k

Views

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, FILE_FLAG_OVERLAPPED, NULL); ConnectNamedPipe(pipe, NULL); while(TRUE){...
user3052078
1

votes
0

answer
20

Views

Data accumulates (FIFO?) in broadcast UDP socket

I have a device that sends me a stream of monitoring data (size of 58) every second, in broadcast. I'm reading this stream with a C program. My problem is if i don't read this stream for a few seconds, the next time i read it, i got much more datas that i needed, like if i had a FIFO that keeps fil...
HacHac
2

votes
2

answer
1.3k

Views

I Have a problem with 2 FIFO for read and write in each

The attached code should allow the communication between 2 terminals. The communication is made through 2 FIFO, which are created in the current directory. The program has to open the 2 fifos and the son reads from STDIN and puts on the fifo1 and the father reads from the other fifo and prints on te...
Andrea
3

votes
1

answer
128

Views

How to use correctly isalnum function in C?

I tried to check if a character of a string is alnum and then if the string contains only alnum characters to print the string. When I run the program nothing happens. I have another program with whom I read from the input the text I want and I send it with FIFO. If i don;t include in the program th...
Maria Popa
1

votes
2

answer
3k

Views

In bash, how to tail a fifo that is currently being written to, and then tail the fifo again, grepping for different text?

I have a process that is writing to standard out, and I want to be able to monitor the output by grepping for various strings while running tail -f. One way to do this is to write to a normal file and then tail the file grepping for one string, then tail it grepping for another. However, I don't wan...
jonderry
6

votes
8

answer
1k

Views

How to feed information to a Python daemon?

I have a Python daemon running on a Linux system. I would like to feed information such as "Bob", "Alice", etc. and have the daemon print "Hello Bob." and "Hello Alice" to a file. This has to be asynchronous. The Python daemon has to wait for information and print it whenever it receives something....
mimipc
19

votes
4

answer
21.7k

Views

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 and a rr algorithm works. But as we have the system c...
theB
5

votes
1

answer
90

Views

Maintaining a FIFO readable across different executions

I've never used a named pipe before and recently realized that is just what I need. I'm running a program using gnu parallel which could produce tons (GB's to 1TB, hard to know right now) of output formatted for a data base on mySQL. I figured out that I can open two terminals: Terminal 1 gets so...
wbg
1

votes
2

answer
851

Views

FIFO dequeueing in python "AttributeError: Queue instance has no attribute 'front'?

I'm looking to make a functional (not necessarily optimally efficient, as I'm very new to programming) FIFO queue, and am having trouble with my dequeueing. My code looks like this: class QueueNode: def __init__(self, data): self.data = data self.next = None def __str__(self): return str(self.data...
Aaron Ramsey
2

votes
3

answer
6.1k

Views

UNIX FIFO: How to allow only one writer/reader pair to use a FIFO?

I've written two programs: the first, the "writer", creates a FIFO and writes data into it. The second one, the "reader" runs in background and looks for data in the FIFO. Once data is there, the reader reads it out. If I start e.g. two writers and two readers, they all can write/read into/from the...
Max Krug
6

votes
3

answer
2.2k

Views

a text file circular buffer in python

I need a python script implementing a circular buffer for rows in a text file limited to N rows like this: row 1 -> pop row 2 row 3 | | push -> row N What's the best solution? EDIT: This script should create and maintain the text file which only contains the latest N lines. Then it should pop the fi...
1

votes
1

answer
132

Views

Specific C fifo implementation confusion

I need to use a FIFO for a project I'm working on. I found this implementation on the internet and I can't figure out what's going on in this function; I'm hoping someone can enlighten me. /* Free an entire fifo */ void fifo_free(fifo_t *f, void (*freefn)(void *)) { fifonode_t *fn = f->f_head; fifon...
Jefferson Hudson
5

votes
5

answer
2.6k

Views

FIFOs implementation

Consider the following code: writer.c mkfifo("/tmp/myfifo", 0660); int fd = open("/tmp/myfifo", O_WRONLY); char *foo, *bar; ... write(fd, foo, strlen(foo)*sizeof(char)); write(fd, bar, strlen(bar)*sizeof(char)); reader.c int fd = open("/tmp/myfifo", O_RDONLY); char buf[100]; read(fd, buf, ??); My qu...
nunos
2

votes
1

answer
522

Views

How to write to already opened FD in golang

I have the following opened FD (lsof output): auth 11780 root 5w FIFO 0,10 0t0 72061824 pipe I need to write something in FD 5 (FIFO) in go. In C it is performed by the syscall write(): 19270 write(5, "*************", 12 Thank you in advance!
Jivko Angelov
5

votes
1

answer
394

Views

SQL First In First Out Loyalty Point

fellow developers and analysts. I have some experience in SQL and have resorted to similar posts. However, this is slightly more niche. Thank you in advance for helping. I have the below dataset (edited. Apology) Setup CREATE TABLE CustomerPoints ( CustomerID INT, [Date] Date, Points INT )...
T.Fung
4

votes
1

answer
66

Views

git merge-file fails with bash process substitution operator that uses git show

I'm trying to merge changes from a file which is in git into one which isn't under version control (more context) using a 3-way-merge. As there is a git merge-file which expects 3 files and as I don't fancy creating intermediate files and forgetting to clean them up, i used the bash foo.txt git...
Jörn Hees
1

votes
2

answer
465

Views

Fifo vs Client/Server

I'm new here... I want to premise I don't want the solution to my problem but I need to understand which is difference between a client/server program and a FIFO reader/writer program... I explain better... I have to do a project for an exam. The purpose of the project is "define script Bash and C...
Ciccio
2

votes
3

answer
5.3k

Views

Bidirectional FIFO

I would like to implement a bidirectional fifo. The code below is functioning but it is not using bidirectional fifo. I have searched all over the internet, but haven't found any good example... How can I do that? Thanks, WRITER.c: #include #include #include #include #include #include #define...
nunos
5

votes
2

answer
6.6k

Views

FIFO behavior for Array.pop in javascript? [duplicate]

This question already has an answer here: How do you implement a Stack and a Queue in JavaScript? 21 answers I want an Array method similar to Array.pop() that exhibits First In First Out behavior, instead of the native FILO behavior. Is there an easy way to do so? Imagine a javascript console: >>...
cinead
6

votes
4

answer
3.3k

Views

Can Sql Server BULK INSERT read from a named pipe/fifo?

Is it possible for BULK INSERT/bcp to read from a named pipe, fifo-style? That is, rather than reading from a real text file, can BULK INSERT/bcp be made to read from a named pipe which is on the write end of another process? For example: create named pipe unzip file to named pipe read from named pi...
Peter Radocchia
5

votes
3

answer
684

Views

Combining sorted files with fifos

I have some sorted, gzipped files in a directory. How do I combine some of them into another sorted, gzipped file? Right now I'm using explicit fifos. Is there a way to do it in bash without? I'm a bit of a bash noob, so please excuse my lack of style. #!/bin/bash # Invocation ./merge [files ... ] #...
Clark Gaebel

View additional questions