fifo

How to work with “FIFO” in C# .NET?

白昼怎懂夜的黑 提交于 2019-11-28 11:52:29
Is there a standard collection in .NET that implements a FIFO stack? Dave Markle FIFO means first-in-first-out. The data structure you're looking for is called a Queue . FIFO means first in first out. This is as opposed to LIFO (or FILO as lucero pointed out). which is last in first out. A link comparing queues, stacks, and hashtables. You want to use a queue object for FIFO operations: http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=66 MSDN link on queues And a stack is used for LIFO operations: Stack Link LukeH Are you looking for the Queue<T> class? 来源: https://stackoverflow

FIFO pipe is always readable in select()

ε祈祈猫儿з 提交于 2019-11-28 07:20:31
问题 In C pseudo-code: while (1) { fifo = open("fifo", O_RDONLY | O_NONBLOCK); fd_set read; FD_SET(fifo, &read); select(nfds, &read, NULL, NULL, NULL); } The process sleeps as triggered by select() until another process writes into fifo . Afterwards it will always find fifo as a readable file descriptor. How to avoid this behavior (that is, after fifo has been read once, how to make it be found as unreadable until it gets another write?) 回答1: You opened that FIFO as read only (O_RDONLY), whenever

Reading a file in real-time using Node.js

自古美人都是妖i 提交于 2019-11-28 06:33:49
I need to work out the best way to read data that is being written to a file, using node.js, in real time. Trouble is, Node is a fast moving ship which makes finding the best method for addressing a problem difficult. What I Want To Do I have a java process that is doing something and then writing the results of this thing it does to a text file. It typically takes anything from 5 mins to 5 hours to run, with data being written the whole time, and can get up to some fairly hefty throughput rates (circa. 1000 lines/sec). I would like to read this file, in real time, and then, using node

kfifo

只愿长相守 提交于 2019-11-28 04:13:10
kfifo 的一些伪代码 kfifo_len() out = LOAD fifo->out smp_rmb() len = LOAD fifo->in - out kfifo_in() kfifo_out() kfifo_len() kfifo_len() smp_mb() smp_rmb() off = LOAD fifo->in + off off = LOAD fifo->out + off /* memcpy */ /* memcpy */ smp_wmb() smp_mb() STORE fifo->in += off STORE fifo->out += off kfifo_in 只修改 fifo->in 的值,含一个 STORE 指令,及若干 fifo->out fifo->in 的 LOAD 指令 kfifo_out 相反,只修改 kfifo->out 的值,同样含一个 STORE 指令及若干 LOAD 指令 把代码中的内存屏障去掉 kfifo_len() out = LOAD fifo->out /* smp_rmb() */ len = LOAD fifo->in - out kfifo_in() kfifo_out() kfifo_len() kfifo_len() /* smp_mb() */ /* smp_rmb() */ off = LOAD fifo-

异步FIFO结构及FPGA设计 ---跨时钟域设计

心已入冬 提交于 2019-11-28 02:34:21
http://hi.baidu.com/hieda/blog/item/e8f8752465afb337c895593c.html 异步FIFO 结构及FPGA 设计 吴自信,张嗣忠. 单片机及嵌入式系统应用,2000 摘要 :首先介绍异步FIFO的概念、应用及其结构,然后分析实现异步FIFO的难点问题及其解决办法;在传统设计的基础上提出一种新颖的电路结构并对其进行综合仿真和FPGA实现。 1、异步FIFO介绍 在现代的集成电路芯片中,随着设计规模的不断扩大,一个系统中往往含有数个时钟。多时钟域带来的一个问题就是,如何设计异步时钟之间的接口电路。异步 FIFO(First In First Out)是解决这个问题一种简便、快捷的解决方案。使用异步FIFO可以在两个不同时钟系统之间快速而方便地传输实时数据。在网络接口、图像处理等方面, 异步FIFO得到了广泛的应用。 异步FIFO是一种先进先出的电路,使用在需要产时数据接口的部分,用来存储、缓冲在两个异步时钟之间的数据传输。在异步电路中,由于时钟之间周期和相位完全独立,因而数据的丢失概率不为零。如何设计一个高可靠性、高速的异步FIFO电路便成为一个难点。本文介绍解决这一问题的一种方法。 由图1可以看出:整个系统分为两个完全独立的时钟域——读时钟域和写时间域;FIFO的存储介质为一块双端口RAM,可以同时进行读写操作。在写时钟域部分

Interfacing Two Clock Domains

笑着哭i 提交于 2019-11-28 02:34:14
http://hi.baidu.com/hieda/blog/item/e40402f0cfabc7c77931aa8a.html There are times when a designer needs to interface two systems working at two different clocks. This interfacing is difficult in the sense that design becomes asynchronous at the boundary of interface, which results in setup and hold violation, metastability and unreliable data transfers. So we need to go out for special design and interfacing techniques. Any two systems are considered asynchronous to each other: When they operate at two different frequency When they operate at same frequency, but at two different clock phase

Redirecting input of application (java) but still allowing stdin in BASH

北战南征 提交于 2019-11-28 01:52:52
问题 I'm a little confused, I had this working yesterday, but it just stopped accepting the redirected stdin, almost magically. set -m mkfifo inputfifo mkfifo inputfifo_helper ((while true; do cat inputfifo; done) > inputfifo_helper)& trap "rm -f inputfifo inputfifo_helper java.pid; kill $!" EXIT exec 3<&0 (cat <&3 > inputfifo)& NOW=$(date +"%b-%d-%y-%T") if ! [ -d "logs" ]; then mkdir logs fi if [ -f "server.log" ]; then mv server.log logs/server-$NOW.log fi java <inputfifo_helper -jar $SERVER

How do you design FIFO queue with variable data size?

混江龙づ霸主 提交于 2019-11-28 01:39:25
问题 I'm just working on the FIFO queue (the simple one, just what's pushed first, pops at first) with the variable data size but I'm not sure with the way I'm designing it. The data types I will store there will be known in advance and let's say will be the same for each instance of this class. I was thinking about using TList where the records with the following definition will be stored (@David - it's for D2007, so I have no Generics.Collections available :) type PListItem = ^TListItem;

Hadoop的三种调度器FIFO、Capacity Scheduler、Fair Scheduler(转载)

浪子不回头ぞ 提交于 2019-11-27 21:48:22
目前Hadoop有三种比较流行的资源调度器:FIFO 、Capacity Scheduler、Fair Scheduler。目前Hadoop2.7默认使用的是Capacity Scheduler容量调度器。 一、FIFO(先入先出调度器) Hadoop1.x使用的默认调度器就是FIFO。FIFO采用队列方式将一个一个job任务按照时间先后顺序进行服务。比如排在最前面的job需要若干maptask和若干reducetask,当发现有空闲的服务器节点就分配给这个job,直到job执行完毕。 二、Capacity Scheduler(容量调度器) Hadoop2.x使用的默认调度器是Capacity Scheduler。 1、支持多个队列,每个队列可配置一定量的资源,每个采用FIFO的方式调度。 2、为了防止同一个用户的job任务独占队列中的资源,调度器会对同一用户提交的job任务所占资源进行限制。 3、分配新的job任务时,首先计算每个队列中正在运行task个数与其队列应该分配的资源量做比值,然后选择比值最小的队列。比如如图队列A 15个task,20%资源量,那么就是15%0.2=70,队列B是25%0.5=50 ,队列C是25%0.3=80.33 。所以选择最小值队列B。 4、其次,按照job任务的优先级和时间顺序,同时要考虑到用户的资源量和内存的限制

FIFO class in Java

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 18:40:42
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 don't know if such a package even exists. paxdiablo You're looking for any class that implements the Queue interface , excluding PriorityQueue and PriorityBlockingQueue , which do not use a FIFO algorithm. Probably a LinkedList using add (adds one to the end) and removeFirst (removes one from the front and returns it) is the easiest one to use. For