Windows 和 Linux 的IPC API对应表

来源:互联网 发布:excel表格查重复的数据 编辑:程序博客网 时间:2024/05/16 12:25

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


                                             Windows 和 Linux 的IPC API对应表(IPC(Inter-Process Communication,进程间通信)

 

Table 1. Process mappingWindowsLinuxClassificationCreateProcess()
CreateProcessAsUser()fork()
setuid()
exec()MappableTerminateProcess()kill()MappableSetThreadpriority()
GetThreadPriority()Setpriority()
GetPriority()MappableGetCurrentProcessID()getpid()MappableExitprocess()exit()MappableWaitForSingleObjec()
WaitForMultipleObject()
GetExitCodeProcess()waitpid()
※Using Sys V semaphores, WaitForSingleObjec/MultipleObject
can be implementedContext specificGetEnvironmentVariable()
SetEnvironmentVariable()getenv()
setenv()Mappable

 

 

Table 2. Thread mappingWindowsLinuxClassificationCreateThread()pthread_create
pthread_attr_init
pthread_attr_setstacksize
pthread_attr_destroyMappableThreadExit()pthread_exitMappableWaitForSingleObject()pthread_join
pthread_attr_setdetachstate
pthread_detachMappableSetPriorityClass()
SetThreadPriority()setpriority
sched_setscheduler
sched_setparam

pthread_setschedparam
pthread_setschedpolicy
pthread_attr_setschedparam
pthread_attr_setschedpolicy>

Context Specific

 

 

Table 3. Synchronization mappingWindowsLinux -- threadsLinux -- processMutexMutex - pthread librarySystem V semaphoresCritical sectionMutex - pthread libraryNot applicable as critical sections are used only between the threads of the same processSemaphoreConditional Variable with mutex - pthreads
POSIX semaphoresSystem V SemaphoresEventConditional Variable with mutex - pthreadsSystem V Semaphores

 

 

Table 4. Semaphore mappingWindowsLinux -- threadsLinux -- processClassificationCreateSemaphoresem_initsemget
semctlContext specificOpenSemaphoreNot applicablesemgetContext specificWaitForSingleObjectsem_wait
sem_trywaitsemopContext specificReleaseSemaphoresem_postsemopContext specificCloseHandlesem_destroysemctlContext specific

 

 

Table 5. Event objects mappingWindowsLinux -- threadsLinux -- processClassificationCreateEvent
OpenEventpthread_cond_init
sem_initsemget
semctlContext specificSetEventpthread_cond_signal
sem_postsemopContext specificResetEventN/AN/AContext specificWaitForSingleObjectpthread_cond_wait
pthread_cond_timedwait
sem_wait
sem_trywaitsemopContext specificCloseHandlepthread_cond_destroy
sem_destroysemctlContext specific

 

 

Table 6. Mutex mappingWindowsLinux -- threadsLinux -- processClassificationCreateMutexpthreads_mutex_initsemget
semctlContext specificOpenMutexNot applicablesemgetContext specificWaitForSingleObjectpthread_mutex_lock
pthread_mutex_trylocksemopContext specificReleaseMutexpthread_mutex_unlocksemopContext specificCloseHandlepthread_mutex_destroysemctlContext specific

 

 

Table 7. Critical section mappingWindowsLinuxClassificationInitializeCriticalSection
InitializeCriticalSectionAndSpinCountpthreads_mutex_initMappableEnterCriticalSection
TryEnterCriticalSectionpthread_mutex_lock
pthread_mutex_trylockMappableLeaveCriticalSectionpthread_mutex_unlockMappableDeleteCriticalSectionpthread_mutex_destroyMappable

 

 

Table 6. Mutex mappingWindowsLinux -- threadsLinux -- processClassificationSignalObjectAndWaitsemopsemopContext specificWaitForMultipleObjectssem_wait
sem_trywaitsemopContext specific


0 0
原创粉丝点击