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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? ctask.doc

?? 一個(gè)可以立即使用的嵌入式操作系統(tǒng)
?? DOC
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
        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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91视频免费观看| 欧美日韩亚洲不卡| 亚洲自拍偷拍av| 久久久欧美精品sm网站| 在线观看视频一区| 成人18精品视频| 国产真实乱子伦精品视频| 亚洲综合一区二区三区| 国产精品妹子av| 亚洲精品一区二区三区影院| 欧洲色大大久久| 99热99精品| 国内国产精品久久| 青椒成人免费视频| 亚洲国产另类av| 日韩伦理av电影| 亚洲国产成人私人影院tom| 日韩一区二区三区在线观看| 欧美亚洲动漫精品| 一本一道久久a久久精品| 国产成人免费视频一区| 韩日欧美一区二区三区| 日本欧洲一区二区| 三级不卡在线观看| 亚洲高清免费一级二级三级| 亚洲精品中文在线| 国产精品国模大尺度视频| 欧美国产一区二区在线观看| 精品日韩一区二区三区免费视频| 欧美激情综合五月色丁香小说| 欧美性大战久久久久久久蜜臀 | 麻豆专区一区二区三区四区五区| 亚洲黄色性网站| 亚洲色图都市小说| 亚洲色图欧洲色图| 一区二区三区高清在线| 亚洲综合免费观看高清完整版在线| 中文字幕亚洲在| 亚洲三级小视频| 亚洲卡通欧美制服中文| 一区二区三区不卡视频在线观看 | 久久爱www久久做| 蜜桃一区二区三区在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 热久久免费视频| 美女爽到高潮91| 韩国成人在线视频| 国产精品自产自拍| 岛国精品在线播放| 99精品视频一区二区三区| 91在线视频在线| 欧美色图一区二区三区| 在线播放亚洲一区| 欧美不卡视频一区| 久久精品人人做人人综合| 国产精品看片你懂得| 亚洲同性gay激情无套| 依依成人综合视频| 日日摸夜夜添夜夜添精品视频| 蜜桃在线一区二区三区| 国产成人免费高清| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品污网站| 亚洲精品自拍动漫在线| 日韩av电影一区| 国产精品99久久久久久久女警| 福利一区在线观看| 日本道精品一区二区三区| 91超碰这里只有精品国产| 久久久久久久网| 亚洲欧美在线另类| 午夜久久久影院| 韩国一区二区三区| 91成人免费在线| 欧美成人性战久久| 亚洲男人天堂av网| 久久国产尿小便嘘嘘| 99精品久久只有精品| 制服丝袜国产精品| 亚洲国产精品成人综合色在线婷婷 | 精一区二区三区| 东方欧美亚洲色图在线| 欧美色图免费看| 国产亚洲午夜高清国产拍精品| 玉米视频成人免费看| 免费成人av资源网| 93久久精品日日躁夜夜躁欧美| 7777精品伊人久久久大香线蕉完整版| 久久精品亚洲国产奇米99| 亚洲一本大道在线| 国产成人免费视频| 日韩欧美精品在线视频| 亚洲欧美乱综合| 国产精品综合二区| 欧美日韩精品三区| 亚洲欧美在线观看| 国产在线精品一区二区不卡了 | 极品少妇一区二区| 日本精品一级二级| 国产亚洲一区二区三区| 日韩经典一区二区| 91视频一区二区| 国产女人18毛片水真多成人如厕| 亚洲aaa精品| 91色视频在线| 欧美国产精品一区二区三区| 另类小说一区二区三区| 欧美视频一区二区三区四区| 国产精品免费视频观看| 国产一区二区三区香蕉| 欧美一区二区大片| 亚洲国产精品一区二区久久恐怖片| 成人小视频在线观看| 精品福利一区二区三区免费视频| 亚欧色一区w666天堂| 91丨porny丨最新| 国产精品午夜久久| 国产91精品精华液一区二区三区| 欧美成人一区二区三区在线观看| 亚洲成人黄色影院| 欧美亚洲一区二区在线观看| 中文字幕一区二区三| 国产成人免费在线观看| 久久久久久一二三区| 九一九一国产精品| 日韩免费成人网| 热久久一区二区| 日韩精品影音先锋| 美女视频黄频大全不卡视频在线播放| 欧洲精品视频在线观看| 一二三区精品福利视频| 色妞www精品视频| 亚洲精品视频观看| 欧美性猛交xxxx乱大交退制版| 亚洲精品乱码久久久久久久久| 色综合一区二区三区| 激情文学综合网| 日韩欧美美女一区二区三区| 久久99久久99| 日韩欧美成人一区| 狠狠色狠狠色综合系列| 久久亚洲一级片| 国产精品亚洲午夜一区二区三区| 久久精品夜色噜噜亚洲a∨| 国产精品一二三四区| 中文字幕 久热精品 视频在线| 高清不卡一区二区在线| 亚洲人亚洲人成电影网站色| 色婷婷av一区二区三区软件| 亚洲电影在线免费观看| 91精品国产综合久久久蜜臀粉嫩 | 不卡视频一二三四| 成人欧美一区二区三区视频网页 | 麻豆一区二区在线| 国产日韩欧美a| 94-欧美-setu| 视频一区免费在线观看| 日韩欧美的一区二区| 国产成人免费视频精品含羞草妖精| 成人欧美一区二区三区视频网页| 91久久精品一区二区二区| 日韩电影在线一区| 久久久另类综合| 欧洲av一区二区嗯嗯嗯啊| 日韩国产一二三区| 欧美国产成人精品| 欧美性大战久久久| 国产精品一级二级三级| 亚洲综合一区二区| 精品av综合导航| 色综合色综合色综合| 免费在线观看不卡| 国产午夜精品一区二区三区嫩草| av一二三不卡影片| 日本少妇一区二区| 自拍偷拍国产亚洲| 日韩午夜激情视频| 色琪琪一区二区三区亚洲区| 捆绑紧缚一区二区三区视频| 亚洲色图清纯唯美| 日韩精品一区二区三区视频| 97超碰欧美中文字幕| 蜜臀av一区二区在线免费观看| 综合中文字幕亚洲| 日韩欧美色电影| 欧美性猛片aaaaaaa做受| 国产福利一区二区三区| 五月激情综合网| 国产精品伦理在线| 日韩美一区二区三区| 色婷婷av一区二区三区gif | 国产成人在线网站| 五月天视频一区| 成人免费视频在线观看| 日韩精品一区二区三区视频播放 | 国产精品电影院| 日韩精品一区二区在线观看| 在线欧美一区二区| 国产99久久久精品| 精品在线亚洲视频|