Windows 和 Linux 的IPC API對應表

來源:互聯網
上載者:User

標籤:des   blog   http   color   io   os   ar   for   strong   

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

 

                                             Windows 和 Linux 的IPC API對應表

 

Table 1. Process mapping
Windows Linux Classification
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
Windows Linux Classification
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
Windows Linux -- threads Linux -- 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
Windows Linux -- threads Linux -- process Classification
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
Windows Linux -- threads Linux -- process Classification
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
Windows Linux -- threads Linux -- process Classification
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
Windows Linux Classification
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
Windows Linux -- threads Linux -- process Classification
SignalObjectAndWait semop semop Context specific
WaitForMultipleObjects sem_wait
sem_trywait
semop Context specific

Windows 和 Linux 的IPC API對應表

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.