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

  • SEARCH
  • Home
  • 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 6742781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:53:02+00:00 2026-05-26T11:53:02+00:00

On unix, a process is stuck, you doubt that it may be deadlock, find

  • 0

On unix, a process is stuck, you doubt that it may be deadlock, find the reasons for deadlocking and how to remove and avoid it ?

I know the 4 conditions for deadlock:

  1. Mutual exclusion: A resource can be assigned to at most one process at a time (no sharing).

  2. Hold and wait: A processing holding a resource is permitted to request another.

  3. No preemption: A process must release its resources; they cannot be taken away.

  4. Circular wait: There must be a chain of processes such that each member of the chain is waiting for a resource held by the next member of the chain.

But, they are theoretical, how to determine a deadlock on unix practically ?
Only by seeing that a process does not make progress ?
How to find which part of the code cause the deadlock and the reasons ?
If you are allowed to use tools, what can be used ?

thanks

  • 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-05-26T11:53:03+00:00Added an answer on May 26, 2026 at 11:53 am

    There is also Valgrind’s Helgrind tool: Helgrind: a thread error detector

    Helgrind is a Valgrind tool for detecting synchronisation errors in C, C++ and Fortran programs that use the POSIX pthreads threading primitives.

    The main abstractions in POSIX pthreads are: a set of threads sharing a common address space, thread creation, thread joining, thread exit, mutexes (locks), condition variables (inter-thread event notifications), reader-writer locks, spinlocks, semaphores and barriers.

    Helgrind can detect three classes of errors, which are discussed in detail in the next three sections:

    1. Misuses of the POSIX pthreads API.

    2. Potential deadlocks arising from lock ordering problems.

    3. Data races — accessing memory without adequate locking or synchronisation.

    Problems like these often result in unreproducible, timing-dependent crashes, deadlocks and other misbehaviour, and can be difficult to find by other means.

    Helgrind is aware of all the pthread abstractions and tracks their effects as accurately as it can. On x86 and amd64 platforms, it understands and partially handles implicit locking arising from the use of the LOCK instruction prefix.

    Helgrind works best when your application uses only the POSIX pthreads API. However, if you want to use custom threading primitives, you can describe their behaviour to Helgrind using the ANNOTATE_* macros defined in helgrind.h. This functionality was added in release 3.5.0 of Valgrind, and is considered experimental.

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

Sidebar

Related Questions

I'm writing a PHP process that will run on a Unix machine that will
I know process 0 is the swapper process in UNIX responsible for process scheduling
I'm trying to find the maximum number of threads per process on a UNIX
UNIX file-locking is dead-easy: The operating system assumes that you know what you are
I basically have a unix process running and it is doing some heavy processing
I need to start a Unix process by calling a PHP-page through the web.
I'm writing a mini-shell to get more familiar with Unix process management in C.
In Unix, when a child process in background terminates, it sends a SIGCHLD signal
Under many operating systems Unix-domain sockets allow a process to reliably pass its credentials
Is there a lightweight process execution timer like Unix's time included with Windows? Sometimes

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.