亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ctask.doc

?? 一個嵌入式實時操作系統(tǒng)源碼
?? DOC
?? 第 1 頁 / 共 5 頁
字號:
        same time by switching the processor between the tasks you de-
        fine. And since most of the time your program is waiting for some
        slow device (like the human hand) to provide feedback, this
        switching is completely transparent, and will not noticeably slow
        your program down.


                              Switching the Context

        So what is needed to allow the user to edit a file while at the
        same time downloading another and printing a third? First, you
        have to have some form of "context switching". This means that
        you have to be able to interrupt the processing of the download
        when the user presses a key, process the key, and return to the
        download "task" at the exact same point it was interrupted. One
        solution to this would be to include a poll for the keyboard at
        several points in the download routine, and call the editor task
        when a key is available.  But apart from cluttering your code
        with lots of unrelated calls, there is another problem. What if
        the operation the user requested is more involved than just
        putting the character on the screen, like writing the file to
        disk? This might take so long that your download times out. There
        must be a way to pass control back and forth between the two
        tasks, such that no task is delayed for an extended period of
        time, and also to activate the print spooler task at some defined
        interval to output the data to the printer. This context
        switching is called "scheduling" in CTask. The "scheduler" is
        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -              Page 2


        invoked on every system timer tick, and will save the context of
        the current task. The scheduler then takes the first element from
        the queue of tasks that are eligible to be run, and restores the
        context of this task, returning to the point where the task was
        interrupted. This switching is completely automatic, and requires
        no special programming in the tasks itself. All you have to do is
        to tell CTask that there are three tasks, the download task, the
        spooler task, and the editor task.


                                  You have Mail

        All you have to do for context switching, that is. There's a bit
        more to multitasking than meets the eye. How do you tell the
        spooler task what files to spool, and the download task what
        files to download? You can't call a task like an ordinary func-
        tion, so what you need for this is "inter-task communication".
        There must be a way to pass a message containing the filename to
        be printed to the spooler task, and there are several in CTask,
        one of them the "mailbox". The spooler can use a CTask call,
        wait_mail, to wait for a message to arrive at its mailbox. As
        long as nothing arrives, the spooler task will no longer be
        scheduled, so if there is nothing to print, it will not use any
        processor time. When you send a message with send_mail to the
        mailbox, the spooler will wake up, and process the file. You can
        also send more file name messages to the spooler while it still
        prints a file, leaving the messages in the mailbox until the
        spooler is ready to process the next file.


                             Reentrancy and Resources

        This last example seems innocent enough, but there's a big stumb-
        ling block hidden in it. You allocate the file name messages in
        the controlling task with malloc, and you free them in the
        spooler with free, no problem, right? Wrong, there is a big
        problem, "reentrancy". Reentrancy means that you can re-enter a
        routine while another task is already using it, and that this
        will not disturb the operation of the interrupted task. But
        malloc and free share and modify global data, the chain of free
        memory blocks. Imagine the following: You just called malloc from
        the controlling task. Malloc has loaded the address of a free
        element into a local variable, and is about to write back the
        pointer to the next free element into the last. At exactly this
        moment, the timer ticks, and the spooler is activated. It has
        just finished printing, so it calls free. Free steps through the
        chain of free blocks to find the right place to insert the block.
        According to Murphy's law, it will find just the place where
        malloc is about to write back the pointer. Free coerces the
        elements, points the next pointer to the element malloc just
        wants to take off the chain, and returns. Malloc writes its next
        pointer into the middle of the newly coerced block, and now re-
        turns an element which is still in the free list. Compared to the
        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -              Page 3


        job of finding this kind of bug, stepping in for Tantalus may
        feel like a vacation. This kind of problem code is called a
        "critical region". There must be a way to make sure that no two
        tasks simultaneously enter such a region, and, you guessed it,
        CTask provides one, the "resource". When you request a resource
        in one task, all other tasks trying to request the same resource
        after that are put to sleep until you call release_resource. Only
        then will the highest priority task that waits for the resource
        wake up, and get access to the protected region. So you would
        have to substitute malloc and free calls in your routines with
        calls to functions that first request a resource, execute the
        function, and then release the resource.


                                    DOS Access

        But, you might ask, isn't there another reentrancy problem in
        this example, since both the spooler and the download task might
        simultaneously call DOS to do their file-I/O, and DOS is not
        reentrant? Do I have to substitute all my calls to fread and
        fwrite, too? The answer to this, luckily, is no. CTask traps all
        your DOS calls, and automatically encloses them in the necessary
        resource request and release calls, so you don't have to worry
        about trashing your disk by simultaneous DOS requests. The
        limited multitasking capabilities of DOS are exploited to allow
        some parallel processing in DOS, and CTask will also detect and
        handle DOS calls by resident background programs like the DOS
        PRINT utility.


                              Handling the Keyboard

        CTask also allows you to circumvent DOS for keyboard input, so
        that waiting for the keyboard will not block other tasks from
        access to DOS functions. Previous versions of CTask used a "pipe"
        to store all keyboard input. Starting with version 1.2, CTask
        uses a "flag" to signal that keyboard input might be available. A
        "flag" is another form of inter-task communication that just sig-
        nals that some event occurred, without passing any specific data.
        The reason for using flags in the keyboard handler is compati-
        bility to TSR's. If a keyboard interrupt occurs, the interrupt
        handler just sets a flag, and passes on the interrupt. The key-
        board routines wait for this flag to be set, and then check the
        keyboard buffer if a character has arrived. If the keyboard buf-
        fer is empty, the flag is again cleared, and the keyboard rou-
        tines put the waiting task to sleep again, so the processor is
        free to do more interesting things than to loop waiting for the
        user to press a key.





        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -              Page 4


                             Serial I/O and Timeouts

        The "pipe" is similar to the mailbox in that you can wait for
        items to be sent to a pipe. But unlike mailboxes, pipes use their
        own buffer to store the items (which are limited to bytes and
        words), so you don't have to allocate mail blocks for each item.
        When waiting on the pipe, your task is put to sleep, freeing the
        processor. Pipes are used for the serial I/O handler included
        with CTask that makes some of the work you've put into your
        communications package obsolete. When outputting data to the
        serial port via the CTask routines, the data is buffered in a
        pipe, and incoming data is also placed in a pipe. All interrupt
        handling, and the processing of modem status and XON/XOFF proto-
        cols, is done by CTask, so you can concentrate on implementing
        the higher level protocols. Since CTask allows all calls that
        wait for pipes, mail, and other events, to specify a timeout that
        is based on the system tick, you do not have to resort to timed
        waiting loops to detect communication line faults. You simply
        give a time limit on the wait call, and if that limit expires,
        the wait routine will return with an error indication.


                                    Priorities

        If the protocol you implement requires fast responses to incoming
        blocks, you can influence the response of CTask to your comm
        task's needs by giving this task a higher priority. CTask allows
        65535 different priority levels, and tasks having higher priority
        are scheduled before tasks with lower priority. Also, high prio-
        rity tasks will get access to mail, pipes, and resources, before
        other tasks. It might even be sensible to split the comm task
        into two separate tasks, one of high priority that assembles the
        incoming bytes into blocks and handles the protocol, and a lower
        priority task that reads the received blocks from a mailbox and
        stores them on the disk. In extremely time critical applications,
        you can even turn off task preemption, so the timer tick will no
        longer cause a task switch.


                              Change to your liking

        CTask provides all basic building blocks for implementing
        concurrent programs in an easy and comprehensible way. Since
        CTask is mainly implemented in C, it may not be the fastest
        possible system, but due to the straightforward design which uses
        few shortcuts, modifying the sources to suit your needs and taste
        can be done without weeks of studying assembler code that
        squeezes every microsecond from the processor. CTask is public
        domain code, and there are no restrictions on its use. It is
        distributed in source form, so you are free to change all aspects
        of the package. Multitasking programs, especially in embedded
        applications, tend to be very diverse in their needs for specific
        constructs. So although CTask is ready to run under DOS, and is
        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -              Page 5


        easily adaptable for embedded applications, you should see CTask
        more as a starting point for your own thoughts, and as a toolbox
        from which you can pick the instruments you need, than as a
        finished and fixed block of code you simply plug into your
        application.
















































        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -              Page 6


                                  General Notes


                         What can CTask NOT be used for?

        CTask is not intended to provide for multitasking on the command
        level of MS-DOS. Although version 1.2 of CTask added the ability
        to TSR and spawn other programs, and to communicate between
        multiple copies of CTask, a full DOS-process management (which
        would have to include keeping track of memory allocation and DOS
        process control blocks) is not included. Adding this functio-
        nality would not be trivial (although certainly worthwhile).

        CTask also is not a true "Real-Time" multitasking system. Due to
        the completely dynamic structure of tasks and events, and the
        minimal restrictions on what interrupt handlers may do, it is
        nearly impossible to calculate a maximum interrupt or task switch
        latency. If you have critical timing requirements, you should
        consider getting a professional package like AMX. CTask has been
        used successfully in embedded control applications, and if your
        timing requirements are not that critical, or you're ready to
        take up the task of measuring and calculating latencies with your
        specific task setup, CTask may be useful even for Real-Time
        applications. However, you're more or less on your own in this
        field.

        And, there is no warranty that CTask does perform without errors,
        or does exactly what you or I intended. So CTask should not be

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久久无码国产精品| 91天堂素人约啪| 亚洲午夜一区二区三区| 2023国产精品| 欧美视频在线不卡| voyeur盗摄精品| 麻豆成人久久精品二区三区红 | 日本一区二区三区在线不卡| 91福利国产精品| 成人永久aaa| 久久99久久精品| 亚洲国产综合人成综合网站| 国产欧美日韩在线| 欧美大片一区二区| 欧美区视频在线观看| 91在线国产观看| 国产aⅴ综合色| 国产一区三区三区| 日韩av不卡在线观看| 亚洲国产一区在线观看| 中文字幕亚洲成人| 国产日韩欧美一区二区三区乱码| 欧美日本一道本在线视频| 91国在线观看| 色综合中文字幕国产 | 久久精品一区二区三区不卡| 日韩精品中文字幕在线一区| 色久优优欧美色久优优| 成人黄色777网| 国产精品88av| 国产成人综合在线播放| 极品销魂美女一区二区三区| 蜜桃视频免费观看一区| 免费人成精品欧美精品 | 一区二区三区四区av| 综合久久综合久久| 中文字幕日韩av资源站| 国产精品国产馆在线真实露脸| 精品国产一区a| 亚洲精品一区二区在线观看| 日韩写真欧美这视频| 91精品国产色综合久久ai换脸 | 五月天一区二区三区| 亚洲国产婷婷综合在线精品| 亚洲激情中文1区| 亚洲精品视频在线看| 亚洲视频在线一区观看| 亚洲精品视频免费观看| 一区二区三区视频在线看| 亚洲午夜一区二区三区| 婷婷中文字幕综合| 久久电影国产免费久久电影 | 99久久久久免费精品国产| 91在线观看视频| 在线观看国产91| 欧美精品在线观看一区二区| 日韩三级高清在线| 久久久精品tv| 亚洲精品国产一区二区三区四区在线| 亚洲欧美日韩中文播放 | 国产精品一区二区你懂的| 成人黄色综合网站| 欧美日韩在线播放一区| 宅男噜噜噜66一区二区66| 亚洲色图制服诱惑| 亚洲va欧美va天堂v国产综合| 日韩av一区二| 成人教育av在线| 欧美视频一区二区三区四区| 日韩欧美中文字幕一区| 国产亚洲va综合人人澡精品| 亚洲三级在线观看| 免费成人在线观看| 成年人午夜久久久| 欧美日韩国产一区| 国产人伦精品一区二区| 中文字幕一区视频| 三级欧美在线一区| 不卡免费追剧大全电视剧网站| 欧美视频一区在线观看| 国产亚洲综合在线| 亚洲午夜一区二区三区| 国产一区视频网站| 欧洲一区在线电影| 国产日韩高清在线| 日本成人在线网站| aaa亚洲精品| 欧美成人vr18sexvr| 悠悠色在线精品| 国产在线精品免费av| 欧美三级中文字幕| 国产精品看片你懂得| 日韩av中文字幕一区二区三区| av在线不卡电影| 精品国产一区二区精华| 亚洲成人1区2区| 成人av动漫在线| 久久久久久免费网| 日韩高清电影一区| 在线观看国产精品网站| 国产精品麻豆一区二区| 看电视剧不卡顿的网站| 中文字幕一区二| 九一九一国产精品| 欧美丝袜丝交足nylons| 综合欧美一区二区三区| 国产精品18久久久久久久久 | 欧美日韩免费高清一区色橹橹 | 亚洲国产成人午夜在线一区 | 老司机午夜精品| 91高清在线观看| 中文字幕一区二区三中文字幕| 极品少妇xxxx精品少妇| 欧美高清精品3d| 一二三区精品视频| 91麻豆福利精品推荐| 国产精品久久久久久久浪潮网站| 韩日欧美一区二区三区| 欧美一级午夜免费电影| 亚洲成a人片综合在线| 91九色02白丝porn| 亚洲欧美福利一区二区| 成人av先锋影音| 国产欧美精品一区二区色综合 | 成人手机电影网| 久久精品在这里| 国产成人在线看| 国产亚洲美州欧州综合国| 国产一区二区三区美女| 久久夜色精品国产噜噜av| 麻豆精品蜜桃视频网站| 欧美videossexotv100| 免费高清视频精品| 精品久久国产字幕高潮| 激情欧美日韩一区二区| 日韩美女在线视频| 精品一区二区免费| 久久久www成人免费毛片麻豆| 国产乱码精品一区二区三区五月婷| 精品国产百合女同互慰| 国产一区二区在线影院| 中文无字幕一区二区三区| 成熟亚洲日本毛茸茸凸凹| 国产欧美日韩不卡免费| 99热在这里有精品免费| 一区二区三区自拍| 欧美日韩黄色影视| 久久机这里只有精品| 久久这里只有精品视频网| 国产91精品精华液一区二区三区 | 亚洲欧美激情在线| 欧美日韩一区二区三区高清 | 亚洲精品欧美激情| 精品视频123区在线观看| 免费看欧美女人艹b| 国产午夜精品一区二区三区视频 | 激情文学综合丁香| 久久久五月婷婷| 97久久精品人人爽人人爽蜜臀| 一区二区三区在线观看动漫| 91精品国产一区二区| 国产麻豆视频一区二区| 综合久久久久综合| 91超碰这里只有精品国产| 国产一区二区看久久| 亚洲青青青在线视频| 91精品国产综合久久久久| 国产一区二区三区精品视频| 亚洲婷婷在线视频| 欧美一区二区私人影院日本| 国产盗摄精品一区二区三区在线| 国产精品美女久久久久久久网站| 欧美三级日韩三级国产三级| 久久69国产一区二区蜜臀| 综合久久一区二区三区| 日韩一区二区在线免费观看| 成人午夜免费av| 婷婷夜色潮精品综合在线| 欧美极品少妇xxxxⅹ高跟鞋 | 91在线免费视频观看| 亚洲成人av免费| 国产女主播在线一区二区| 欧美猛男gaygay网站| 岛国精品一区二区| 日本aⅴ免费视频一区二区三区| 中文字幕欧美日本乱码一线二线| 欧美精品自拍偷拍动漫精品| 国产91清纯白嫩初高中在线观看| 五月激情六月综合| 中文字幕免费观看一区| 7777精品伊人久久久大香线蕉最新版| 国产成人免费在线观看不卡| 午夜精品爽啪视频| 亚洲欧洲精品成人久久奇米网| 日韩亚洲欧美在线| 欧美亚洲国产怡红院影院| 国产久卡久卡久卡久卡视频精品| 午夜久久久久久电影| 亚洲精品视频在线看| 国产精品污污网站在线观看|