Windows 和 Linux 的IPC API对应表
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
相关文档:
本文作者:Heliode
翻译人员:Jonah.Simon,
校对人员:lyreopera
“那我该用什么来备份我的系统呢?”也许你会问。小事一桩,就像你备份或压缩一个别的文件一样,TAR。不像Windows,Linux不限制根用户存取任何东西,因此,你完全可以把一个分区 ......
2.2 构建ARM Linux交叉编译工具链
构建交叉编译器的第一个步骤就是确定目标平台。在GNU系统中,每个目标平台都有一个明确的格式,这些信息用于在构建过程中识别要使用的不同工具的正确版本。因此,当在一个特定目标机下运行GCC时,GCC便在目录路径中查找包含该目标规范的应用程序路径。GNU的目标规范格式为CPU-PLATF ......
Linux 2.6.19.x 内核编译配置选项简介
作者:金步国
版权声明
本文作者是一位自由软件爱好者,所以本文虽然不是软件,但是本着 GPL 的精神发布。任何人都可以自由使用、转载、复制和再分发,但必须保留作者署名,亦不得对声明中的任何条款作任何形式的修改,也不得附加任何其它条件。您可以自由链接、下载、传播此文档 ......
在linux的日常服务器维护站点维护中,经常需要批量操作一部分文件,比如数据库用户的资料变更,那么所以相关站点的数据库配置文件要相应的修改。大家都知道,linux下面几乎所有的配置文件都是纯粹的文本文件,所以这其实就是一个基本的文本操作。一台服务器上有上百个甚至上千个的网站。如果我们一个个来修改不是不可以,但 ......
du -sh * 查看当前目录下的文件夹大小
du 命令
用途
概述磁盘使用。
语法
du [ -a | -s ] [ -k ] [ -m ] [ -g ][ -l ] [ -r ] [ -x ] [ -H | -L ][ File ... ]
描述
du命令显示用于文件的块的数量。
如果指定的File参数实际上是一个目录,就要报告该目录内的所有文件。如果没有提供 File参数,du命令使用当前目录 ......