Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When running ps, you get something like:

root         2  0.0  0.0      0     0 ?        S<   00:00   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S<   00:00   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   00:00   0:00 [events/0]

All the daemon processes generally have the '[..]' brackets around them.

What do they mean (if anything)? How do you create a process that appears like this?

The reason I ask is we create a system daemon from the rcS (the programme uses fork to create the daemon), but ps entry looks like:

root       207  0.0  0.2   1516   200 ?        S    00:00   0:00 /root/testdaemo

So we were wondering if it is important to have the '[..]' brackets and how processes get them in the first place.

Thanks.

share|improve this question

migrated from stackoverflow.com Feb 13 '12 at 2:19

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 8 down vote accepted

Square brackets are used for processes that do not have an associated command line (mostly kernel threads and some system services).

If I recall correctly, you might be able to achieve the same effect for your process by setting argv[0] to the empty string.

share|improve this answer
    
Thanks for the answer –  user626201 Aug 16 '11 at 12:52
1  
mostly - what can make an exception? –  naxa Nov 24 '13 at 21:30
    
What does the trailing /0 mean? –  RyanN Feb 21 at 21:25
1  
@RyanN, it means that kernel thread is running on the first CPU. –  Frédéric Hamidi Feb 21 at 21:39

Your example doesn't even show the [...], so I'm not 100% sure what you're talking about. However it IS possible to modify the argv arguments of any program (in Linux). The arguments are reflected in the output of ps.

share|improve this answer
1  
[...] was meant as a placeholder. I was referring to the [kthreadd] <- the [] that encapsulate the name. –  user626201 Aug 16 '11 at 12:47
    
ah I see. Then yes I believe those are kernel processes. –  Chris Aug 16 '11 at 12:48
    
Thanks for the answer –  user626201 Aug 16 '11 at 12:52

Yes, they are kernel threads, created by kernel subsystems. They are created using kthread_create() or kernel_thread() functions in kernel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.