其中存储命令行参数? [英] where command line arguments are stored?
问题描述
我怀疑@命令行参数的存储。
myprog.exe -cfgfile myconfig.cfg
其中OS存储它?
对于WIndows,命令行参数保存在进程环境块中( PEB
),它在创建进程时分配在用户进程地址空间中。
您可以阅读Windows Internals了解更多详细信息。以下是
我假设它对于Unix风格是一样的。此数据需要在进程内存中,以便进程可以访问它。
I have a doubt @ the storage of command line arguments.
myprog.exe -cfgfile myconfig.cfg
commandline args are passed when process gets created so are they strored outside the process?
where OS stores it?
For WIndows, the command line arguments are kept in the process environment block (PEB
), which is allocated in the user process address space when the process is created.
You can read Windows Internals for a lot more details. Here's a snippet from Chapter 5 - Processes, Threads, and Jobs.
I would assume that it's the same for the Unix flavors. This data needs to be in the process memory, so that it can be accessed by the process itself.
这篇关于其中存储命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!