Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!cs.exeter.ac.uk!wca From: wca@cs.exeter.ac.uk (Cai Wen Tong) Newsgroups: comp.sys.transputer Subject: (none) Message-ID: <13423.9007161044@exsa.cs.exeter.ac.uk> Date: 16 Jul 90 10:44:26 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 66 A Little Trick on Detecting the Deadlocks by TDS Debugger --------------------------------------------------------- In TDS manual, it writes that `` A problem arises when a single processor has deadlock. Then there will be no active process from which the programmer can inspect channels, and hence jump to the waiting process.'' Yes, this true. When deadlocks occur, all processes either terminated or waiting on channel communication, therefore descheduled. The active process queue is empty. But, for the processes waiting on channels, their workspace descriptor (wdesc) and instruction pointer (iptr) are recorded at the places assigned to the channels (ccw). So, if you inspect channel instead of inspecting ``Run queue'' or ``Time queue'', you may find out the place which you can jump to. Consider the following simple example, #USE userio SEQ write.full.string(screen, ``PRESS ANY TO START*c*n'') write.full.string(screen, ``and then PRESS c-break*c*n'') INT kch: keyboard? kch CHAN OF ANY c1, c2: PAR INT x: SEQ c1! 0 -----(1) c2? x INT x: SEQ c2! 0 -----(2) c1? x : Certainly, this program will deadlock. By TDS debugger option ``R'' and ``T'', nothing useful is provided. But, you can use the option ``I'' to inspect channels (option 9 of option I) from memory start address (for T800, it is %48). When you scan channels, ignore any invalid iptr and wdesc pair (flagged by an asterisk, *). For a low priority process, look for a wdesc with byte selector equal to 1. For a high priority process, look for a wdesc with byte selector equal to 0. Eventually, you will find out the address assigned to the channel you are looking at. In my transputer, the channel c2 and c1 are assigned on addresses #8000008C and #80000090. And the information displayed are: address Iptr Wdesc . . . #8000008C #8000013B #80000069 #80000090 #80000132 #8000007D . . . Thus, I can use TDS debugger function ``O'' and ``%132, %7D'' pair to jump to (1), and ``%13B, %69'' to jump to (2). But, REMEMBER: ``TDS debugger has no intelligence. You must provide the intelligence!'' ______________________________________________________________________________ | Wentong Cai, | JANET: wca@uk.ac.exeter.cs | | Comp. Sci. Dept., Exeter Univ., | UUCP: wca@expya.uucp | | Devon, EX4 4PT, UK. TEL: (0392) 264061 | BITNET: wca%uk.ac.exeter.cs@ukacrl|