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 9242873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:40:45+00:00 2026-06-18T08:40:45+00:00

how to print the current process state main () { pid_t pid; printf(parent :

  • 0

how to print the current process state

main ()
{
  pid_t pid;
  printf("parent : %d\n", getpid());
  pid = fork();
  if (pid == 0)
    {
      printf("child : %d\n", getpid());
      sleep(2);
      printf("child exit\n");
      exit(1);
    }
  while (1)
    { /*after the child exit, its a zombie process */
      system("clear");
      system("ps -x | grep t"); /* if a.out is Z means zombie process */
      sleep(8);
    }
}

Is there any other method or way to view the current process state in output
itself..?

  • 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-18T08:40:47+00:00Added an answer on June 18, 2026 at 8:40 am

    Determining the scheduling state of a process is OS specific. On Linux, top and similar read it from the third field in /proc/$PID/stat.

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

Sidebar

Related Questions

Current scenario, I launch a process that forks, and after a while it aborts().
test1.py: process = Popen([python,test2.py]) time.sleep(3) alive = process.poll() if alive is None: print Still
I use next code to print current time Calendar cal = Calendar.getInstance(); System.out.println(cal.getTime()); I
The JavaScript code window.print() can print the current HTML page. If I have a
I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
In Python, how can I print the current call stack from within a method
The current applications uses .net printdocument to create print jobs which it sends to
How can I print the next year if the current year is given in
How do i print out female only students from an array. My current code
I have used the following statements to get the current time. print $query executed

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.