1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Denton, Texas
    Rep Power

    Critical section and Deadlock

    Hello All...

    Can any one tell me the following:
    1. how to create 3 processes that enter and leave a Critical Section.\
    2. How to make 3 processes deadlock.

  2. #2
  3. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Rep Power
    how to make 3 processes enter/leave crit section:
    place a critical section in each one! no really that's all. critical sections dont span processes, only threads. a mutex is what you need to use. google for 'mutexes', not sure if your on windows/linux or not....

    how to make 3 processes deadlock:
    google for race condition. basicallly you could have 3 process sharing 3 resources. each process is sharing 2 resources, one with one process and one with another. in order to achieve its goal, a process has to lock into both of its available resources. if there is not proper synchronization on the testing of resource availability it may happen that each thread grabs a different available resource at the exact same time, thus causing all resources to be tied up, but no work can be accomplished b/c they only have one each. thus they are "frozen" / "deadlocked". there would be other ways to deadlock processes as well if your dealing with fifo's, etc.. google on race conditions, starvation, denial of service

IMN logo majestic logo threadwatch logo seochat tools logo