Thread: Detecting "deadlock" - Interesting question real-time C programming

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Detecting "deadlock" - Interesting question real-time C programming

    I need to detect a deadlock by adding some code to the process's main function or inside his handler (HandleEvent()) using only: NewThread, Semaphore, GetMessage, Write2memory, ReadFromMemory.


    There are 5 processes with there priority:
    processes: t1 t2 t3 t4 t5
    priority: 2 3 4 5 6


    lets say that every process main function looks something like:
    Code:
    void main()
    {
       GetEvent(event e);      //get event from the event's queue.
       HandleEvent(event e);  //treat the event and handle it.
    }

    There is a budget of 10 second for all the 5 processes. In other words, we are sure that all 5 processes got CPU's time during 10 sec. If 10 second passed and 2 or more of the processes didn't handle their events, that means they got stuck and they are in "deadlock" position. We want to add some code that eventually we get a message that says "Process X in deadlock". We want to know that when this happens.
    This should be Real-Time in C programming. The solution should be easy and simple, but I haven't found it yet.. Please guys, tell me what you think.. Thanks in advance.
    Daniel.

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Niche Question: real time stock quotes
    By keira in forum C Programming
    Replies: 0
    Last Post: 03-08-2008, 11:06 AM
  2. boost posix time question
    By l2u in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2008, 01:31 PM
  3. Interesting Question
    By Swordsman in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 07-10-2007, 11:19 AM
  4. interesting question, number of 0s at the end of N!
    By George2 in forum C Programming
    Replies: 3
    Last Post: 06-03-2006, 03:26 AM
  5. Real Time?
    By Sebastiani in forum C Programming
    Replies: 1
    Last Post: 09-23-2001, 03:33 PM

Tags for this Thread