白蜡金命五行缺什么| 腐竹炒什么好吃| 夜是什么生肖| 85年属什么生肖| ts和cd有什么区别| 梦见橘子是什么意思| 洁癖是什么意思| 维生素b有什么作用| 屁股痒用什么药膏| 三叉神经痛吃什么药| 凤梨和菠萝有什么区别| 眉毛少是什么原因| 酸化是什么意思| 什么宠物好养又干净| 宝宝积食发烧吃什么药| 桂花什么时候开花| 痔疮什么情况下需要做手术| 强硬是什么意思| 什么样的脚好看| 名存实亡是什么意思| 尿酸高要吃什么药| 9月9日是什么星座| 岳飞属什么生肖| 打豆浆用什么豆子| 灰色配什么颜色好看| 揽件是什么意思| 什么花可以吃| 主动脉夹层什么意思| 望梅止渴是什么意思| 中元节会开什么生肖| 半熟芝士是什么意思| 龟苓膏的原料是什么| 受戒是什么意思| 女性尿道口有小疙瘩是什么原因| 孕晚期头晕是什么原因| 吐血拉血是什么病的症状| 心窦过缓是什么原因| 13岁属什么生肖| 艮五行属什么| 一笑了之是什么意思| 在什么前面用英语怎么说| 螃蟹喜欢吃什么| 为什么肚子上会长毛| 弥月之喜是什么意思| 女性什么时候退休| 镜架什么材质好| 楔形是什么形状| 黄瓜和什么一起炒好吃| 什么样的晚霞| 婚检都检查什么| 蓝莓什么时候开花结果| 女人梦见狼是什么预兆| 男生喜欢什么样的女生| 胶囊壳是什么原料做的| 二线用药是什么意思| 硅胶是什么材质| 嗜血是什么意思| 尿酸高尿液是什么颜色| 狗狗哭了代表什么预兆| 牛的四个胃分别叫什么| 什么万千| 莀字五行属什么| bmr是什么意思| 一毛三是什么军衔| 白细胞高一点点是什么原因| 胸痛是什么原因导致的| 喝酒打嗝是什么原因| 每天喝豆浆有什么好处| 感冒发烧吃什么药比较好| 器质性心脏病是什么意思| 维生素b6是什么| 胎盘吃了对身体有什么好处| 阿普唑仑片是什么药| 本是同根生相煎何太急是什么意思| 餐饮行业五行属什么| 植物奶油是什么做的| 孕妇喝什么水好| 什么是棱长| 18k金是什么| 肌肉萎缩什么症状| pro是什么氨基酸| 高中校长什么级别| 总是失眠是什么原因| 沙示汽水有什么功效| 不来事是什么原因| 羞耻是什么意思| 血小板体积偏低是什么原因| csk是什么品牌| 神经外科和神经内科有什么区别| 胃疼拉肚子吃什么药| 夏天猪骨煲什么汤最好| 上证指数是什么意思| 蹼是什么意思| 红色的月亮是什么征兆| 心脏是由什么组织构成的| 绿松石五行属什么| 酗酒什么意思| 黄精什么时候种植| 一般什么原因做宫腔镜| 脸部过敏红痒抹什么药| 小孩补铁吃什么| 心有灵犀是什么意思| 肝内多发钙化灶是什么意思| 怀孕吃火龙果对胎儿有什么好| 降压药什么药好| 不宜是什么意思| 日不落是什么意思| 头秃了一块是什么原因| 眉毛浓的男人代表什么| ipa啤酒什么意思| 孕妇为什么会水肿| emoji什么意思| 空调什么牌子的好| 16是什么生肖| 颈椎属于什么科室| 胆是起什么作用的| 女性为什么不适合喝茉莉花茶| 水稻什么时候播种| 十全十美指什么生肖| 凤梨和菠萝有什么区别| 蒲公英叶和根的功效有什么不同| 婴幼儿积食会有什么症状| 左传是一部什么体史书| 过敏用什么药| 北是什么生肖| 刺史相当于现在什么官| srpl是什么药| aba是什么意思| 右脚浮肿预示着什么| 1989年属蛇是什么命| brush什么意思| 金融行业五行属什么| 老公什么意思| mac版本是什么意思| 肝硬化吃什么水果好| 石龙子吃什么| 黑洞是什么东西| 扁桃体结石挂什么科| 眼皮发黑是什么病症| 咽隐窝在什么位置| 霉菌性阴道炎用什么药最好| 五塔标行军散有什么功效| 短杆菌是什么意思| 苏打水喝了有什么好处| 翌字五行属什么| 老年人血压忽高忽低是什么原因| 产后吃什么水果好| 托帕石是什么宝石| 痞满是什么意思| 儿童咳嗽挂什么科| 做完手术吃什么水果好| 孕妇吃什么鱼好| 7月10号什么星座| 菠萝蜜不能跟什么一起吃| 双鱼座女和什么星座最配| mm代表什么单位| 北戴河是什么海| 布洛芬缓释胶囊有什么副作用| 散光是什么| 爱琴海在什么地方| 美篇是什么| 低血糖是什么引起的| coa是什么意思| 新西兰现在是什么季节| cco是什么职位| 智齿前面一颗牙叫什么| 蠓虫叮咬后涂什么药膏| 龙王庙是指什么生肖| 侧着睡觉有什么坏处| 疝气有什么症状| 翡翠五行属什么| 市级三好学生有什么用| 风油精有什么功效| 桑葚有什么功效和作用| 土是念什么| 上皮细胞是什么意思| 9.25什么星座| 龙和什么生肖最配| 朗姆酒是什么酒| fbi相当于中国的什么| 为什么韩国叫棒子国| 两性关系是什么意思| 儿童细菌感染吃什么药| 肝经不通吃什么中成药| 医院门特是什么意思| 学籍卡是什么样子图片| 人格分裂什么意思| 珊瑚是什么| 恶露后期为什么是臭的| 5月10日什么星座| 护手霜什么牌子的效果好| 希腊用什么货币| 彩虹什么颜色| 梦见自己孩子死了是什么意思| 什么是角阀| 情字五行属什么| 小腿酸什么原因| 避免是什么意思| 倒闭是什么意思| 黄精和什么煲汤好| 三个贝念什么| 未分类结晶偏高是什么意思| 女性一般什么年龄绝经| 长期喝酒有什么危害| 美缝什么时候做| 报应是什么意思| 一碗香是什么菜| 睡觉张嘴巴是什么原因| 什么东西有脚却不能走路| 白癜风有什么危害| 免疫球蛋白是什么| 眉毛长长是什么原因| 猪心炖什么补气补血| 橙子是什么季节的水果| 250为什么是骂人的话| 三界是什么意思| 荆芥不能和什么一起吃| 医学是什么| 男性解脲支原体是什么病| 醋泡黑豆有什么功效| 副歌部分是什么意思| 喝菊花茶有什么好处| 男人下巴有痣代表什么| 吃了小龙虾不能吃什么| 关二爷是什么神| 散文是什么意思| 安道尔微信暗示什么| 什么情况下会得甲亢| 女人腿肿是什么原因引起的| 隐血弱阳性是什么意思| 八月八号什么星座| 上胸围90下胸围80是什么罩杯| 尿隐血十1是什么意思| 走花路是什么意思| 骷髅头是什么牌子| r0lex是什么牌子手表| 反应性增生是什么意思| 可爱的动物是什么生肖| 方阵是什么意思| 腿走路没劲发软是什么原因| 喉咙有异物挂什么科| 杜建英是宗庆后什么人| 手指是什么生肖| 耳鸣吃什么药好| 北极和南极有什么区别| 飞舞是什么意思| 血虚是什么原因造成的| 左手虎口有痣代表什么| 麦冬长什么样| 经常口腔溃疡挂什么科| 草木皆兵是什么意思| 什么水果补血| 吃什么受孕率又快又高| 身旺是什么意思| 芒果不能和什么一起吃| 经常腿抽筋是什么原因| 什么是碳水化合物食物| 胃烧心是怎么回事吃什么药| 发烧头晕吃什么药| 白居易被称为什么| 出虚汗吃什么中成药| 办护照照片有什么要求| 尹什么意思| 灰指甲不治疗有什么后果| 百度

如何当好人民“代言人”郭杰:用心打造“村改居”变“亿元户”

百度 这是独属于喷漆技师的艺术成就展。

In computing and in systems theory, first in, first out (the first in is the first out), acronymized as FIFO, is a method for organizing the manipulation of a data structure (often, specifically a data buffer) where the oldest (first) entry, or "head" of the queue, is processed first.

Representation of a FIFO queue

Such processing is analogous to servicing people in a queue area on a first-come, first-served (FCFS) basis, i.e. in the same sequence in which they arrive at the queue's tail.

FCFS is also the jargon term for the FIFO operating system scheduling algorithm, which gives every process central processing unit (CPU) time in the order in which it is demanded.[1] FIFO's opposite is LIFO, last-in-first-out, where the youngest entry or "top of the stack" is processed first.[2] A priority queue is neither FIFO or LIFO but may adopt similar behaviour temporarily or by default. Queueing theory encompasses these methods for processing data structures, as well as interactions between strict-FIFO queues.

Computer science

edit
 
Representation of a FIFO queue with enqueue and dequeue operations.

Depending on the application, a FIFO could be implemented as a hardware shift register, or using different memory structures, typically a circular buffer or a kind of list. For information on the abstract data structure, see Queue (data structure). Most software implementations of a FIFO queue are not thread safe and require a locking mechanism to verify the data structure chain is being manipulated by only one thread at a time.

The following code shows a linked list FIFO C++ language implementation. In practice, a number of list implementations exist, including popular Unix systems C sys/queue.h macros or the C++ standard library std::list template, avoiding the need for implementing the data structure from scratch.

#include <memory>
#include <stdexcept>

using namespace std;

template <typename T>
class FIFO {
    struct Node {
        T value;
        shared_ptr<Node> next = nullptr;

        Node(T _value): value(_value) {}
    };

    shared_ptr<Node> front = nullptr;
    shared_ptr<Node> back  = nullptr;

public:
    void enqueue(T _value) {
        if (front == nullptr) {
            front = make_shared<Node>(_value);
            back = front;
        } else {
            back->next = make_shared<Node>(_value);
            back = back->next;
        }
    }

    T dequeue() {
        if (front == nullptr)
            throw underflow_error("Nothing to dequeue");

        T value = front->value;
        front = move(front->next);
        
        return value;
    }
};

In computing environments that support the pipes-and-filters model for interprocess communication, a FIFO is another name for a named pipe.

Disk controllers can use the FIFO as a disk scheduling algorithm to determine the order in which to service disk I/O requests, where it is also known by the same FCFS initialism as for CPU scheduling mentioned before.[1]

Communication network bridges, switches and routers used in computer networks use FIFOs to hold data packets in route to their next destination. Typically at least one FIFO structure is used per network connection. Some devices feature multiple FIFOs for simultaneously and independently queuing different types of information.[3]

Electronics

edit
 
A FIFO schedule

FIFOs are commonly used in electronic circuits for buffering and flow control between hardware and software. In its hardware form, a FIFO primarily consists of a set of read and write pointers, storage and control logic. Storage may be static random access memory (SRAM), flip-flops, latches or any other suitable form of storage. For FIFOs of non-trivial size, a dual-port SRAM is usually used, where one port is dedicated to writing and the other to reading.

The first known FIFO implemented in electronics was by Peter Alfke in 1969 at Fairchild Semiconductor.[4] Alfke was later a director at Xilinx.

Synchronicity

edit

A synchronous FIFO is a FIFO where the same clock is used for both reading and writing. An asynchronous FIFO uses different clocks for reading and writing and they can introduce metastability issues. A common implementation of an asynchronous FIFO uses a Gray code (or any unit distance code) for the read and write pointers to ensure reliable flag generation. One further note concerning flag generation is that one must necessarily use pointer arithmetic to generate flags for asynchronous FIFO implementations. Conversely, one may use either a leaky bucket approach or pointer arithmetic to generate flags in synchronous FIFO implementations.

A hardware FIFO is used for synchronization purposes. It is often implemented as a circular queue, and thus has two pointers:

  • Read pointer / read address register
  • Write pointer / write address register

Status flags

edit

Examples of FIFO status flags include: full, empty, almost full, and almost empty. A FIFO is empty when the read address register reaches the write address register. A FIFO is full when the write address register reaches the read address register. Read and write addresses are initially both at the first memory location and the FIFO queue is empty.

In both cases, the read and write addresses end up being equal. To distinguish between the two situations, a simple and robust solution is to add one extra bit for each read and write address which is inverted each time the address wraps. With this set up, the disambiguation conditions are:

  • When the read address register equals the write address register, the FIFO is empty.
  • When the read and write address registers differ only in the extra most significant bit and the rest are equal, the FIFO is full.

See also

edit

References

edit
  1. ^ a b Andrew S. Tanenbaum; Herbert Bos (2015). Modern Operating Systems. Pearson. ISBN 978-0-13-359162-0.
  2. ^ Kruse, Robert L. (1987) [1984]. Data Structures & Program Design (second edition). Joan L. Stone, Kenny Beck, Ed O'Dougherty (production process staff workers) (second (hc) textbook ed.). Englewood Cliffs, New Jersey: Prentice-Hall, Inc. div. of Simon & Schuster. p. 150. ISBN 0-13-195884-4.
  3. ^ James F. Kurose; Keith W. Ross (July 2006). Computer Networking: A Top-Down Approach. Addison-Wesley. ISBN 978-0-321-41849-4.
  4. ^ "Peter Alfke's post at comp.arch.fpga on 19 Jun 1998".
edit
脊椎痛什么原因 结晶果糖是什么 脂肪瘤挂什么科 单恋是什么意思 甲状腺功能减退是什么意思
赟读什么 才思敏捷是什么意思 鱼子酱是什么鱼的鱼子 吃猪腰子有什么好处和坏处 空洞是什么意思
9月13日是什么纪念日 醋酸纤维是什么面料 kj什么意思 开车撞死猫有什么预兆 陈赫是什么星座的
sm什么意思 县局长是什么级别 肺结核通过什么途径传染 民政局局长什么级别 籍贯填写什么
什么都值得买hcv9jop4ns0r.cn 兴奋剂是什么hcv8jop8ns5r.cn 晚上头疼是什么原因hcv7jop9ns3r.cn 呜呼哀哉什么意思zhiyanzhang.com 诬赖是什么意思hcv8jop3ns4r.cn
荷叶配什么减肥效果好hcv8jop0ns2r.cn 验孕棒什么时候测最准hcv8jop8ns5r.cn 六味地黄丸有什么功效dayuxmw.com 官方什么意思zhongyiyatai.com 帛书是什么意思hcv9jop0ns5r.cn
什么是几何图形hcv7jop5ns5r.cn 258是什么意思hcv8jop2ns7r.cn 冷战是什么意思hcv9jop4ns2r.cn 那个叫什么hcv9jop2ns8r.cn 地头蛇比喻什么样的人1949doufunao.com
牙松动了还疼用什么方法处理最好hcv8jop0ns5r.cn 1933年属什么hcv8jop1ns5r.cn 早饭吃什么hcv8jop6ns3r.cn 嘴巴周围长痘痘是什么原因hcv9jop6ns8r.cn 山宗读什么hcv7jop9ns6r.cn
百度