开发者

Are unix process ID's base 10?

开发者_JAVA技巧

After reading a series of man pages and searching through google, I decided to post this question to the bright folks of stack overflow.

I'm working on a basic Unix Shell and one of the requirements is that I have to implement a command to echo out the shell's pid in base 10 ASCII... Before I read this requirement, I had assumed that process id's were already base 10 numbers. Does anyone know if this is true?


Technically speaking, the numbers that are returned by getpid() are in base two. :-)

Seriously speaking, the requirement probably just means that the number should be displayed as a decimal number as opposed to, for example, a hexadecimal number. I would ask for clarification of that requirement though, since you had to ask.


Numbers themselves don't have a base. They just represent a value. If you have seventeen goats unicorns, then you still have the same number of unicorns no matter what base you choose to write that down in.

Once you decide to print a value using a human readable representation, then you have to choose a base. Your requirement is that the user expects to see the PID in a base 10 representation.


Of course, they are [printed in base 10 by system utilities].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜