Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43600
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dihedral88888@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'dynamically': 0.07; 'suppose': 0.07; 'feasible.': 0.09; 'instances.': 0.09; 'keys,': 0.09; 'subject:design': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.11; 'thread': 0.14; 'actors': 0.16; 'charles': 0.16; 'dict': 0.16; 'instances,': 0.16; 'loops': 0.16; 'mean,': 0.16; 'receive.': 0.16; 'subject:item': 0.16; 'else,': 0.19; 'implementing': 0.19; 'cc:addr:python.org': 0.22; 'header :User-Agent:1': 0.23; 'instance,': 0.24; 'lets': 0.24; 'subject:problem': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'possibly': 0.26; 'post': 0.26; 'required.': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'database,': 0.30; "i'm": 0.30; 'continually': 0.31; 'stuff': 0.32; 'quite': 0.32; 'running': 0.33; 'could': 0.34; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'something': 0.35; 'operations': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'too': 0.37; 'received:209': 0.37; 'implement': 0.38; 'actions': 0.38; 'from:addr:googlemail.com': 0.38; 'handle': 0.38; 'list,': 0.38; 'planning': 0.38; 'rather': 0.38; 'enough': 0.39; 'space': 0.40; 'even': 0.60; 'read': 0.60; 'new': 0.61; 'maximum': 0.63; 'more': 0.64; 'mailbox': 0.68; 'receive': 0.70; 'gain': 0.79; 'awhile': 0.84; 'dict.': 0.84; 'or...': 0.84; 'uncertain': 0.84 |
| X-Received | by 10.50.131.232 with SMTP id op8mr625421igb.5.1365993699488; Sun, 14 Apr 2013 19:41:39 -0700 (PDT) |
| Newsgroups | comp.lang.python |
| Date | Sun, 14 Apr 2013 19:41:39 -0700 (PDT) |
| In-Reply-To | <mailman.609.1365981993.3114.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw |
| References | <mailman.609.1365981993.3114.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 123.192.32.215 |
| MIME-Version | 1.0 |
| Subject | Re: Threadpool item mailboxes design problem |
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.617.1365993702.3114.python-list@python.org> (permalink) |
| Lines | 75 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365993702 news.xs4all.nl 2587 [2001:888:2000:d::a6]:54973 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43600 |
Show key headers only | View raw
Charles Hixson於 2013年4月15日星期一UTC+8上午7時12分11秒寫道:
> What is the best approach to implementing actors that accept and post
>
> messages (and have no other external contacts).
>
>
>
> So far what I've come up with is something like:
>
> actors = {}
>
> mailboxs = {}
>
>
>
> Stuff actors with actor instances, mailboxes with multiprocessing.queue
>
> instances. (Actors and mailboxes will have identical keys, which are
>
> id#, but it's got to be a dict rather than a list, because too many are
>
> rolled out to disk.) And I'm planning of having the actors running
>
> simultaneously and continually in a threadpool that just loops through
>
> the actors that are assigned to each thread of the pool.
>
>
>
> This lets any actor post messages to the mailbox of any other actor that
>
> it has the id of, and lets him read his own mail without
>
> multi-processing clashes. But I'm quite uncertain that this is the best
>
> way, because, if nothing else, it means that each mailbox needs to be
>
> allocated large enough to handle the maximum amount of mail it could
>
> possibly receive. (I suppose I could implement some sort of "wait
>
> awhile and try again" method.) It would, however, be better if the
>
> mailbox could be specific to the threadpool instance, so less space
>
> would be wasted. Or if the queues could dynamically resize. Or if
>
> there was a threadsafe dict. Or... But I don't know that any of these
>
> are feasible. (I mean, yes, I could write all the mail to a database,
>
> but is that a better answer, or even a good one?)
>
>
>
> --
>
> Charles Hixson
Actors can receive and response to messages to take actions
accordingly in time in one or more cores.
The timer is required and the message read/write operations
are required.
Do you want the actors to gain new methods to evolve
in the long run?
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Threadpool item mailboxes design problem Charles Hixson <charleshixsn@earthlink.net> - 2013-04-14 16:12 -0700 Re: Threadpool item mailboxes design problem 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-14 19:41 -0700 Re: Threadpool item mailboxes design problem 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-14 19:41 -0700
csiph-web