in reply to Re^4: Doing an Input->process->Output cycle with AnyEvent? (was: error: "recursive blocking wait detected")
in thread Doing an Input->process->Output cycle with AnyEvent? (was: error: "recursive blocking wait detected")
The mess of mutexes and semaphores with really high chance of dead-locking - that's what such application looks like.
Really? Show me. Or better yet. Show me, (real working code I can download), that does something (other than GUI or webserver), for which you believe that an event-driven architecture is the right tool for the job.
In return, I'll try to reproduce that using threads, without the need for a "mess of mutexes and semaphores".
All you need is good understanding of the event-driven approach.
Please believe me when I tell you that I do understand event-driven architectures.
It is exactly because I've done it, and then had to go through the pain of re-tuning it (the last project above), to run on faster hardware. And then add more ports and re-tune again. And then add a remote monitoring and control channel via modem, and the re-tune the whole, internecine monster all over again.
It is exactly because of that, that I don't understand why any one would choose the architecture if they had a choice.
It worked, and worked well (most of the time). But sheesh! Was it ever a bitch to maintain, upgrade and debug.
Latterly on the above project I ported it to OS/2 and used threading. What a joy. Simple, linear flows: read-ack-read-ack-read-nak-write ack. Add more ports, start more threads. Waiting for IO, just block. Need an accurate time window, raise your priority and sleep for the required number of milliseconds. Someone dials in, start a thread to talk to them. Each thread has it's own context and its own stack. No constantly shuffling data in and out of global stores each time you have to deal with something else.
Really, I've done it both ways, and I know which is easier to write, maintain and debug. Or at least, I believe I do. So prove me wrong?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Doing an Input->process->Output cycle with AnyEvent? (was: error: "recursive blocking wait detected")
by Corion (Patriarch) on Oct 20, 2010 at 09:43 UTC | |
by BrowserUk (Patriarch) on Oct 20, 2010 at 21:44 UTC |