CoolInterview.com - World's Largest Collection of Interview Questions
 Interview Questions  
 Our Services  

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!


    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS OPERATING SYSTEMS UNIX COMMANDS DETAILS
    Question :
    Explain kill() and its possible return values.
    Category Unix Commands Interview Questions
    Rating (4.8) By 5 users
    Added on 10/25/2004
    Views 4477
    Rate it!
    Answers:

    There are four possible results from this call:
    ?kill()? returns 0. This implies that a process exists with the given PID, and the system would allow you to send signals to it. It is system-dependent whether the process could be a zombie.
    ?kill()? returns -1, ?errno == ESRCH? either no process exists with the given PID, or security enhancements are causing the system to deny its existence. (On some systems, the process could be a zombie.)
    ?kill()? returns -1, ?errno == EPERM? the system would not allow you to kill the specified process. This means that either the process exists (again, it could be a zombie) or draconian security enhancements are present (e.g. your process is not allowed to send signals to *anybody*).
    ?kill()? returns -1, with some other value of ?errno? you are in trouble! The most-used technique is to assume that success or failure with ?EPERM? implies that the process exists, and any other error implies that it doesn't. An alternative exists, if you are writing specifically for a system (or all those systems) that provide a ?/proc? filesystem: checking for the existence of ?/proc/PID? may work.





    If you have the better answer, then send it to us. We will display your answer after the approval.
    Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    What is a pipe and give an example?
    View Answer
    How to terminate a process which is running and the specialty on command kill 0?
    View Answer
    What is redirection?
    View Answer
    What are shell variables?
    View Answer
    How to switch to a super user status to gain privileges?
    View Answer
    How does the kernel differentiate device files and ordinary files?
    View Answer
    How many prompts are available in a UNIX system?
    View Answer
    Name the data structure used to maintain file identification?
    View Answer
    Is it possible to count number char, line in a file; if so, How?
    View Answer
    Is ?du? a command? If so, what is its use?
    View Answer

    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL Unix Commands Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2009 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/2504/default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | Joke of the Day

    0.52