Creating deadlock

Discussion in 'Embedded Systems and Microcontrollers' started by vaidhya, Jan 12, 2010.

  1. vaidhya

    Thread Starter New Member

    Jan 3, 2008
    I want to write a C code to create deadlock in my microprocessor.
    Can i use serial communication to create deadlock ?
    My Processor is Infinion C165 CS-LM.
    I use Keil uVision3 to compile.
    I want to know what happens when deadlock occurs.
    I would be happy if i get a sample code.
    Thanks in Advance
  2. someonesdad

    Senior Member

    Jul 7, 2009
    I suggest you first do some reading about understanding what a deadlock is (such knowledge can help make it easier to figure out how to create a deadlock). Any textbook on operating systems will discuss it thoroughly or you can consult wikipedia. Then come back with a specific proposal and you'll get better help.

    An often-repeated cause of deadlock is inexperienced programmers working with multiple threads (my own initiation was writing a thread-safe deque implementation for a library, although it was nearly a year before the obscure bug appeared).
  3. vaidhya

    Thread Starter New Member

    Jan 3, 2008
    I have thoery knowledge on deadlock, but writing a microprocessor code i dont have that much knowledge.
    I can write code to serial communication, and do simple CAN.
    And about deadlock i dont have that much idea.
    I have an algorithm to do it but i cant write a code

    Process 1 has serial communication port and request port 2(LED)
    Process 2 has visa versa.
    Lock both serial port and port 2

    And i dont know to write code using thread