Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:55:04+00:00 2026-06-05T15:55:04+00:00

I am on Centos 4 and am using kill(pid, 0) in my C++ program

  • 0

I am on Centos 4 and am using kill(pid, 0) in my C++ program to check whether there is presently a process running with the given pid. I am beginning to suspect that there is a race condition whereby shortly after a process has started, there is a small window of time wherein the kill(pid, 0) does not return zero even though there is actually a process running.

Is this a known issue? Will kill() ever return non-zero when a pid actually exists but has just been started? If kill() is not a reliable to test for existence, is there a better way to perform this test?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:55:06+00:00Added an answer on June 5, 2026 at 3:55 pm

    kill(pid, 0) will only return 0 if the process exists and you would be able to send it a signal. If the process isn’t running as you (and you aren’t root), then the call will fail with -EPERM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running Puppet v2.7.14 on CEntOs 6 and also using Apache/Passenger instead of WEBrick. I
I'm using CentOS 5.4 x86_64 and Boost 1.42.0 on a cluster that uses Open-MPI
I'm using PHP 5.3, CentOS 6.2, httpd 2.2.15, NetBeans 7.0.1 (running remotely via ftp).
I have a java application connect to a remote CentOS using ssh connection. There's
I am running CentOS 5.2 and using yum to manage packages. I have had
I have a website running on CentOS using the usual suspects (Apache, MySQL, and
There are different mysql install packages for differential platforms. http://www.mysql.com/downloads/mysql/#downloads I'm using CentOS, which
I'm debugging an ANSI C program run on 64-bit Linux CentOS 5.7 using gcc44
I have an environment variable that I set (on Centos 6) using profile.d, as
I have built boost 1.44 on CentOS 5.5 using the gcc that is part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.