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

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

?? ctask.doc

?? 一個嵌入式實時操作系統源碼
?? DOC
?? 第 1 頁 / 共 5 頁
字號:
          2) Task1 runs up to "temp = val", then is interrupted by the
             timer. Task2 executes, and gets 14 as result. Then Task1
             continues. Return for Task1 is 14.

          3) Task2 runs up to "temp = val", then is interrupted by the
             timer. Task1 executes, and gets 6 as result. Then Task2
             continues. Return for Task2 is 6.

        add to this the effects of optimization, and a loop, and the
        outcome is completely random.

        Most routines in the C library will not explicitly do something
        like this, but all functions that

             - do file I/O (read, write, printf, scanf, etc.) or
             - change memory allocation (malloc, free, etc.)


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

        have to use some static data to do buffering, or to store the
        chain of memory blocks in. Interrupting such an operation may
        have disastrous effects. The most devilish aspect of non-
        reentrancy is that the effects are unpredictable. Your program
        may run 1000 times without any error, and then on the 1001th time
        crash the system so completely that only the big red switch will
        help.

        So what can you do about it? A lot. There are several ways to
        protect "critical regions" from being entered in parallel. The
        most simple method is to disable interrupts. This, however,
        should be used only for *very* short periods of time, and not for
        rou-tines that might themselves re-enable them (like file-I/O). A
        better method is to temporarily disable task preemption. The
        routines tsk_dis_preempt and tsk_ena_preempt allow this form of
        short-term task switch disable. Interrupts may still be
        processed, but tasks will not be preempted. The best way is to
        use a "resource". A resource is a special kind of event, which
        only one task can possess at a time. Requesting the resource
        before entering the routine, and releasing it afterwards, will
        protect you from any other task simultaneously entering the
        critical region (assuming that this task also requests the
        resource).

        It is also reasonably safe to use file-I/O without protection if
        it goes to different files. The C file control blocks for
        different files are distinct, so there will be no conflict
        between tasks. Since DOS access is automatically protected by
        CTask, concurrent file I/O is possible.

        What you may NEVER do is to use a non-reentrant routine that is
        not protected by an interrupt disable from an interrupt handler.
        An interrupt handler is not a task, and so can not safely request
        a resource or disable task preemption. This is the reason why the
        CTask routines generally disable interrupts before manipulating
        the internal queues rather than only disabling task preemption.


                                    Deadlocks

        One thing to watch out for when using resources or similar event
        mechanisms is not to get into a situation where Task 1 waits for
        a resource that Task 2 has requested, while at the same time Task
        2 waits for a resource that Task 1 already has. This situation is
        called a deadlock (or, more picturesque, deadly embrace), and it
        can only be resolved with outside help (e.g. waking up one of the
        tasks forcibly). To illustrate, consider the following example:






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

             void far task_1 ()
             {
               ...
               request_resource (&rsc1, 0L);
               request_resource (&rsc2, 0L);
               ...
             }

             void far task_2 ()
             {
               ...
               request_resource (&rsc2, 0L);
               request_resource (&rsc1, 0L);
               ...
             }

        Since interrupts are always enabled on return from a task switch,
        even if the statements are enclosed in a critical region, there
        is no guarantee that the request_resource calls will be executed
        without interruption. In this example, the problem is obvious,
        but in a more complex application, where resource requests or
        other waits might be buried in some nested routine, you should
        watch out for similar situations. One way to avoid problems would
        be in this example to change task_2 to

             void far task_2 ()
             {
                  int again;
                  ...
                  do {
                       request_resource (&rsc2, 0L);
                       if (again = c_request_resource (&rsc1))
                          {
                          release_resource (&rsc2);
                          delay (2L);
                          }
                     } while (again);
                  ...
             }

        Note that this is only one of many possible approaches, and that
        this approach favors task_1 over task_2.

        You should also take care not to kill tasks that currently own a
        resource. CTask will not detect this, and the resource will never
        be freed.







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

                                   Using CTask

        CTask comes archived with both source and binaries. The binary
        version is compiled in the large model, but since the precompiled
        kernel routines don't use any functions from the C library, you
        can use all functions in small or other model programs (except
        Turbo C's Tiny and Huge models). The include files provided
        specify all model dependencies, so you don't have to use the
        large model for your application, but always remember to include
        "tsk.h" for the type definitions and function prototypes.

        The C source files will work without changes for both Microsoft
        and Turbo C. The library files are not compatible, so use
        "ctaskms.lib" for Microsoft, and "ctasktc.lib" for Turbo C.

        In the distributed configuration (i.e. dynamic allocation of
        control blocks enabled), the file TSKALLOC.C must be added to the
        library or separately linked after compiling it *in the same
        model as the main program*. This file uses C-library routines,
        and thus must match the main program's memory model. The same
        goes for TSKSNAP.C, an optional snapshot-dump utility, and
        CONOUT.C, the sample console output handler. The provided
        "ctsupms.lib" and "ctsuptc.lib" files have been compiled in the
        large model, and may only be used with large model programs.

        Turbo C's huge model uses a different segment setup for data
        segments. This requires using a special data segment for all
        CTask data, and compilation of the CTask kernel in huge model.
        For the assembler files, the symbol TC_HUGE must be defined
        during assembly, the C files must be compiled with the Data-
        Segment and BSS-Segment naming options. Make-files for Turbo C
        Huge model are included.


                              Configuration Options

        The file TSKCONF.H contains a number of #define's that allow you
        to configure some CTask features. In general, you should
        recompile all of CTask when changing one of the flags. Version
        2.1 collects all configuration options for both Assembler and C
        in this file.

        The entries are

        CODE_SHARING
             If TRUE, the generated kernel supports code sharing. This
             requires the entry points to load DS on entry, and compi-
             lation with Large model (MSC) or Huge model (TC).

             This option is normally disabled (FALSE).



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

        NEAR_CODE
             If TRUE, all CTask routines are 'near'. Use only with small
             or compact model. You will have to change the make-files so
             the compiler model is no longer Large, and the code segment
             is not named, when turning on this flag. The default is
             FALSE. Setting this option TRUE will save code, and make
             calls faster, but the library will no longer be model
             independent.

             This option is normally disabled (FALSE).

        LOCALS_FAR
             If TRUE, internal CTask routines ar 'far'. This might be
             necessary if your compiler/linker does not allow placing all
             CTask kernel code in a common segment. Do not set this flag
             if NEAR_CODE is set.

             This option is normally disabled (FALSE).

        CALL_PASCAL
             Use Pascal calling sequence for CTask routines.  This may
             save some code, but may cause naming conflicts if your
             compiler limits external Pascal names to 8 characters.

             This option is normally disabled (FALSE).

        TC_HUGE
             (Assembler only) Define TC_HUGE for use with the Turbo C
             Huge model, and if it is desired to separate CTask's data
             from the normal data segment. This flag causes the
             CTASK_DATA segment to be defined, (class is DATA) and DS to
             be loaded with this segment on function entry. The C
             functions in the CTask kernel must be compiled to use the
             same data segment.

             This option is normally disabled (undefined).

        LOAD_DS
             (Assembler only) Define LOAD_DS to reload the data segment
             on entry to global functions. This flag must be defined for
             TC_HUGE. It can also be defined if the data segment can not
             safely be assumed to be loaded in DS on function entry, for
             example if the code sharing feature of version 2.1 is used.
             The C routines must be compiled with the necessary compiler
             switches or the _loadds keyword in this case.

             This option is normally disabled (undefined).






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

        ROM_CODE
             (Assembler only) Define ROM_CODE TRUE for embedded systems
             using ROM-based code. This option disables storing variables
             in the code segment in some modules. Note that most DOS-
             related modules are not ROMable.

             This option is normally disabled (FALSE).

        FAR_STACK
             (Assembler only) Define FAR_STACK TRUE to save some space in
             the default DGROUP. With this define TRUE, the local stacks
             for the scheduler, the timer, and the interrupt handlers,
             are allocated in a separate segment. With Turbo C, you may
             have to edit the "c0.asm" startup module to accomodate the
             new segment.

             This option is normally disabled (FALSE).

        TSK_DYNAMIC
             If TRUE, you can let CTask dynamically create task and event
             control blocks, task stacks, and pipe buffers, by passing
             NULL as the block address. Since this requires the C runtime
             allocation calls, it is not suitable for non-DOS appli-
             cations (except if you provide your own memory allocation
             routines).

             This option is normally enabled (TRUE).

        TSK_DYNLOAD
             If FALSE, this instance of the kernel does not include
             dynamic allocation routines. Setting this flag to FALSE when
             TSK_DYNAMIC is TRUE only makes sense with multiple linked
             kernels. A resident kernel might not employ dynamic
             allocation, whereas a secondary kernel needs it. In this
             situation, TSK_DYNAMIC must be set in the primary so that
             the task kill code is included and the kernel configurations
             match, but TSK_DYNLOAD may be false to prevent inclusion of

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久日产精品| 91同城在线观看| 日韩欧美国产精品一区| 免费av网站大全久久| 日韩欧美成人一区| 国产二区国产一区在线观看| 久久九九久久九九| www.在线成人| 亚洲成人7777| 精品久久人人做人人爽| 成人高清免费观看| 亚洲一区二区精品3399| 日韩免费电影网站| 成人精品鲁一区一区二区| 日本成人超碰在线观看| 精品美女一区二区三区| 高清不卡一区二区在线| 亚洲制服丝袜av| 日韩午夜激情电影| 99精品1区2区| 老司机精品视频线观看86| 自拍偷自拍亚洲精品播放| 制服.丝袜.亚洲.中文.综合| 国产不卡视频在线观看| 亚洲va欧美va人人爽| 久久免费电影网| 欧美视频精品在线| 国产美女在线观看一区| 伊人婷婷欧美激情| 久久网站热最新地址| 在线区一区二视频| 国产盗摄一区二区三区| 亚洲一二三区视频在线观看| 国产日韩欧美不卡在线| 欧美日韩一区小说| 国产·精品毛片| 日本视频中文字幕一区二区三区| 国产婷婷色一区二区三区在线| 欧美优质美女网站| 福利一区二区在线观看| 视频在线在亚洲| 亚洲视频一区二区免费在线观看| 欧美大胆一级视频| 欧美色图一区二区三区| 国产福利一区二区三区视频在线| 亚洲一区二区三区四区在线免费观看 | 日本一区二区免费在线 | 亚洲图片有声小说| 国产精品久久777777| 日韩一区二区三区视频| 日本乱人伦aⅴ精品| 国产成人精品三级| 久久99精品久久久| 午夜精品久久久久久不卡8050| 中文字幕视频一区二区三区久| 精品欧美一区二区三区精品久久| 日本道色综合久久| 97精品电影院| 99精品国产91久久久久久| 国产河南妇女毛片精品久久久| 理论电影国产精品| 日韩va亚洲va欧美va久久| 香蕉久久夜色精品国产使用方法 | 久久婷婷国产综合精品青草| 欧美日韩国产中文| 在线观看91精品国产入口| 色综合久久九月婷婷色综合| 91社区在线播放| eeuss鲁一区二区三区| 99免费精品视频| 成人免费观看男女羞羞视频| 成人免费视频视频在线观看免费 | 精品国产免费人成电影在线观看四季| 欧美日韩国产区一| 欧美一三区三区四区免费在线看 | 美国欧美日韩国产在线播放| 日韩国产欧美三级| 美腿丝袜在线亚洲一区| 狠狠色丁香婷婷综合久久片| 国产在线一区观看| 国产成人精品亚洲777人妖| 成人午夜在线免费| 91免费国产视频网站| 色8久久人人97超碰香蕉987| 欧美视频在线观看一区二区| 91麻豆精品国产91久久久更新时间| 欧美人xxxx| 26uuu精品一区二区| 久久精品网站免费观看| 国产精品乱人伦| 亚洲欧美日韩国产成人精品影院| 亚洲精品免费视频| 日韩成人免费在线| 国产一二精品视频| 91视频在线观看免费| 欧美在线看片a免费观看| 3d成人动漫网站| 久久夜色精品国产噜噜av| 日本一区二区久久| 亚洲综合在线视频| 七七婷婷婷婷精品国产| 国产毛片精品视频| 91麻豆自制传媒国产之光| 欧美福利电影网| 久久一二三国产| 一区二区三区在线视频播放| 日日摸夜夜添夜夜添国产精品 | 亚洲成av人片观看| 国模娜娜一区二区三区| 色婷婷久久久亚洲一区二区三区| 欧美一区二区在线观看| 国产欧美日韩精品a在线观看| 亚洲精品免费在线| 久久不见久久见免费视频1| 99久久精品国产一区| 日韩一级精品视频在线观看| 国产精品久久久久四虎| 免费在线观看成人| 99久久精品国产一区二区三区| 欧美三级乱人伦电影| 国产欧美日韩亚州综合| 成人aaaa免费全部观看| 717成人午夜免费福利电影| 中文字幕第一页久久| 爽好多水快深点欧美视频| 成人一区二区三区视频在线观看| 欧美美女一区二区在线观看| 一区在线播放视频| 久久不见久久见免费视频1| 欧美性videosxxxxx| 国产欧美精品一区二区色综合朱莉| 午夜精品视频在线观看| 91免费版pro下载短视频| xnxx国产精品| 天天影视网天天综合色在线播放| a在线播放不卡| 久久综合久久综合久久综合| 婷婷夜色潮精品综合在线| 91在线视频观看| 精品国产乱码久久| 日本美女视频一区二区| 欧美亚洲高清一区二区三区不卡| 亚洲国产经典视频| 久草中文综合在线| 91精品国产手机| 性做久久久久久久免费看| 色综合久久久久综合体桃花网| 国产欧美视频一区二区| 激情都市一区二区| 欧美大黄免费观看| 美女视频黄久久| 91精品国产综合久久蜜臀| 亚洲成人免费av| 91国偷自产一区二区开放时间| 国产精品毛片a∨一区二区三区| 国产一区二区在线视频| 欧美一级夜夜爽| 日本一不卡视频| 欧美一区二区国产| 久久精品国产网站| 精品电影一区二区三区| 麻豆国产欧美日韩综合精品二区| 7777女厕盗摄久久久| 日韩国产欧美在线视频| 欧美一区二区三区四区久久| 丝袜脚交一区二区| 欧美高清性hdvideosex| 青椒成人免费视频| 欧美tk丨vk视频| 国内欧美视频一区二区| 国产视频911| 欧美一级日韩一级| 日韩av网站免费在线| 日韩一区二区三区电影在线观看 | 性欧美大战久久久久久久久| 欧美三级欧美一级| 日本sm残虐另类| 丝袜美腿亚洲综合| 日韩亚洲欧美一区| 美女看a上一区| 欧美一区二区三区啪啪| 久久99久久久欧美国产| 国产午夜精品在线观看| 99在线精品观看| 久久99精品国产麻豆婷婷洗澡| 日韩欧美一卡二卡| 宅男在线国产精品| 日本va欧美va精品发布| 亚洲男人电影天堂| 国产日产亚洲精品系列| 在线播放视频一区| 91亚洲精品一区二区乱码| 国产一区在线不卡| 日韩av电影免费观看高清完整版 | 一二三四区精品视频| 国产欧美精品一区| 日韩欧美一二区| 欧美日韩免费在线视频| 99re66热这里只有精品3直播| 激情综合网最新|