| From | Sent On | Attachments |
|---|---|---|
| Marilyn Davis | Jan 13, 2005 2:04 am | |
| Danny Yoo | Jan 13, 2005 2:31 am | |
| Danny Yoo | Jan 13, 2005 2:41 am | |
| Marilyn Davis | Jan 13, 2005 3:17 am | |
| Danny Yoo | Jan 13, 2005 6:29 am | |
| Alan Gauld | Jan 13, 2005 10:20 am | |
| Marilyn Davis | Jan 15, 2005 11:19 pm | |
| Marilyn Davis | Jan 16, 2005 3:12 am | |
| Marilyn Davis | Jan 16, 2005 6:47 am | |
| Danny Yoo | Jan 16, 2005 7:40 am | |
| Marilyn Davis | Jan 17, 2005 5:02 am | |
| Danny Yoo | Jan 18, 2005 10:51 am | |
| Danny Yoo | Jan 18, 2005 7:24 pm | |
| Marilyn Davis | Jan 19, 2005 2:32 am | |
| Danny Yoo | Jan 19, 2005 8:12 am | |
| Kent Johnson | Jan 19, 2005 12:35 pm | |
| Marilyn Davis | Jan 19, 2005 8:57 pm | |
| Marilyn Davis | Jan 19, 2005 9:13 pm | |
| Danny Yoo | Jan 19, 2005 9:53 pm | |
| Marilyn Davis | Jan 19, 2005 10:28 pm | |
| Marilyn Davis | Jan 21, 2005 5:05 am |
| Subject: | [Tutor] sockets, files, threads | |
|---|---|---|
| From: | Marilyn Davis (mari...@deliberate.com) | |
| Date: | Jan 17, 2005 5:02:48 am | |
| List: | org.python.tutor | |
On Sat, 15 Jan 2005, Danny Yoo wrote:
I have only wrapped my lock around file-descriptor creations. Should I wrap it around closings too? Or the whole open -> close transaction? It sounds like error-prone work to do the latter. What am I missing?
Hi Marilyn,
Can you send a link to the source code to the Tutor list? I'm getting the feeling that there's might be a design problem. Just adding locks whenever something doesn't work is not a sustainable way to write a multithreaded application.
We have to see why your file descriptors being are being shared between threads. Is there a reason why you need to share them as global resources?
No. And I don't. They are often attributes of instantiations of classes; or they come and go quickly.
Thank you for offering to look at the code. Start at:
http://www.maildance.com/python/doorman/README
Then, the daemon that creates the threads is:
http://www.maildance.com/python/doorman/py_daemon.py
I'm testing using calls to:
http://www.maildance.com/python/doorman/route_mail.py http://www.maildance.com/python/doorman/doorman.py
Other modules that open and close file descriptors from there are:
http://www.maildance.com/python/doorman/db.py http://www.maildance.com/python/doorman/doorman_log.py http://www.maildance.com/python/doorman/exim.py http://www.maildance.com/python/doorman/move.py
I'll be grateful for any improvements you suggest. But, I do know that some modules aren't well-documented, or are hardly documented at all yet. And db.py seems like a mess to me. But I'm not ready to straighten it up yet.
But the most important one, py_daemon.py, I hope is very readable.
Still though, I should confess, I am feeling a bit dismal about the thread situation, especially since searching around for info on critical code. The examples I found, before I gave up, were all trivial. Also, there is this article:
http://linuxgazette.net/107/pai.html
Which says that the performance is almost the same with threads as with single-threading. Boo.
So suddenly, I have no idea why I'm down this road. We have a huge performance savings from setting up a daemon that reads a socket. But, unless something changes our minds soon, I'll rip threading out of our code.
Still though, I am a teacher too, and a student. So any thoughts you have about our code will be treated like the pearls they are.
Thank you again.
Marilyn
--





