SUMMARY: Question on why ps sometimes truncates the process name and puts it in brackets



Original Question:

Why does the ps output sometimes truncate the process name and put it in
brackets?

Thanks to Dr. Blinn for the following thorough answer:

The UNIX standard for the "ps" command allows the system to truncate or
omit certain parts of the output when the resources necessary to gather
and display them are unavailable. There are two places this could
happen -- inside the "ps" utility and in the kernel (which is called
MANY times by the utility to gather the data for a single "ps -e"
command, especially if there are a lot of processes on the system).

In this case, the output is usually being truncated in the kernel
because there is a temporary shortage of the in-memory buffer size
needed for that particular field. When that happens, you'll see the
kind of output you're seeing.

The correct fix for this is to design your script to be able to deal
with either of the two outputs, since you will presumably always get one
or the other.

There may be ways to simplify the logic that would result in a more
expeditious and reliable test, but you should be just fine if you take
into account that as system load changes, there can be times when
certain resources are temporarily scarce and that these times can impact
the output of commands like "ps" (or for that matter, cause some things
to simply fail).



Relevant Pages

  • Re: how to shrink the .LDF ? -- spanish subtitled
    ... DBCC SHRINKFILE is not a truncate command. ... Commmand to truncate the Log is BACKUP LOG command. ...
    (microsoft.public.sqlserver.setup)
  • Re: [Info-Ingres] commit question
    ... The next block has been turned into a rollback ... hence the next command executed is the rollback and not the commit. ... The situation we had was that the "modify to truncate" command succeeded ...
    (comp.databases.ingres)
  • Re: best "drop table if exists" idiom?
    ... drop and creates and replace the create with a truncate. ... The temporary table method is best when multiple user sessions might ... owner that performs the truncate command via 'execute immediate' (PL/ ...
    (comp.databases.oracle.misc)
  • RE: Trucate Command
    ... you can not do any kind of recovery using truncate table command. ... into syntax will look as follows. ... To transfer rows back to the original table from temp table you can use same INSERT INTO....SELECT syntax. ...
    (microsoft.public.sqlserver.mseq)