zoukankan      html  css  js  c++  java
  • Windows 和 Linux 的IPC API对应表

    原文出处:http://blog.csdn.net/zhengdy/article/details/5485472

                                                 Windows 和 Linux 的IPC API对应表

    Table 1. Process mapping
    WindowsLinuxClassification
    CreateProcess()
    CreateProcessAsUser()
    fork()
    setuid()
    exec()
    Mappable
    TerminateProcess() kill() Mappable
    SetThreadpriority()
    GetThreadPriority()
    Setpriority()
    GetPriority()
    Mappable
    GetCurrentProcessID() getpid() Mappable
    Exitprocess() exit() Mappable
    WaitForSingleObjec()
    WaitForMultipleObject()
    GetExitCodeProcess()
    waitpid()
    ※Using Sys V semaphores, WaitForSingleObjec/MultipleObject
    can be implemented
    Context specific
    GetEnvironmentVariable()
    SetEnvironmentVariable()
    getenv()
    setenv()
    Mappable
    Table 2. Thread mapping
    WindowsLinuxClassification
    CreateThread() pthread_create
    pthread_attr_init
    pthread_attr_setstacksize
    pthread_attr_destroy
    Mappable
    ThreadExit() pthread_exit Mappable
    WaitForSingleObject() pthread_join
    pthread_attr_setdetachstate
    pthread_detach
    Mappable
    SetPriorityClass()
    SetThreadPriority()
    setpriority
    sched_setscheduler
    sched_setparam

    pthread_setschedparam
    pthread_setschedpolicy
    pthread_attr_setschedparam
    pthread_attr_setschedpolicy>

    Context Specific

    Table 3. Synchronization mapping
    WindowsLinux -- threadsLinux -- process
    Mutex Mutex - pthread library System V semaphores
    Critical section Mutex - pthread library Not applicable as critical sections are used only between the threads of the same process
    Semaphore Conditional Variable with mutex - pthreads
    POSIX semaphores
    System V Semaphores
    Event Conditional Variable with mutex - pthreads System V Semaphores
    Table 4. Semaphore mapping
    WindowsLinux -- threadsLinux -- processClassification
    CreateSemaphore sem_init semget
    semctl
    Context specific
    OpenSemaphore Not applicable semget Context specific
    WaitForSingleObject sem_wait
    sem_trywait
    semop Context specific
    ReleaseSemaphore sem_post semop Context specific
    CloseHandle sem_destroy semctl Context specific
    Table 5. Event objects mapping
    WindowsLinux -- threadsLinux -- processClassification
    CreateEvent
    OpenEvent
    pthread_cond_init
    sem_init
    semget
    semctl
    Context specific
    SetEvent pthread_cond_signal
    sem_post
    semop Context specific
    ResetEvent N/A N/A Context specific
    WaitForSingleObject pthread_cond_wait
    pthread_cond_timedwait
    sem_wait
    sem_trywait
    semop Context specific
    CloseHandle pthread_cond_destroy
    sem_destroy
    semctl Context specific
    Table 6. Mutex mapping
    WindowsLinux -- threadsLinux -- processClassification
    CreateMutex pthreads_mutex_init semget
    semctl
    Context specific
    OpenMutex Not applicable semget Context specific
    WaitForSingleObject pthread_mutex_lock
    pthread_mutex_trylock
    semop Context specific
    ReleaseMutex pthread_mutex_unlock semop Context specific
    CloseHandle pthread_mutex_destroy semctl Context specific
    Table 7. Critical section mapping
    WindowsLinuxClassification
    InitializeCriticalSection
    InitializeCriticalSectionAndSpinCount
    pthreads_mutex_init Mappable
    EnterCriticalSection
    TryEnterCriticalSection
    pthread_mutex_lock
    pthread_mutex_trylock
    Mappable
    LeaveCriticalSection pthread_mutex_unlock Mappable
    DeleteCriticalSection pthread_mutex_destroy Mappable

    Table 6. Mutex mapping
    WindowsLinux -- threadsLinux -- processClassification
    SignalObjectAndWait semop semop Context specific
    WaitForMultipleObjects sem_wait
    sem_trywait
    semop Context specific
  • 相关阅读:
    Apple的App Analytics统计平台你必须知道的Q&A整理与翻译
    WWDC2014总结---For产品经理们
    AppStore占坑注意事项
    Mac上的终端(Terminal)启动缓慢
    iOS推送失败的可能问题汇总
    Mac OS X 10.9 Mavericks安装后,Xcode调试时模拟器黑屏的处理方法
    MySql批处理的小窍门:排行榜类数据生成
    升级OSX 10.9 Mavericks后,会导致Finder始终无响应的一个问题
    拉面馆中的移动互联网——无线KPI探讨
    Weak is not weak,Strong is not strong
  • 原文地址:https://www.cnblogs.com/jacklikedogs/p/4030077.html
Copyright © 2011-2022 走看看