473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: concurrency program design stackless python tasklet or pythonthread?

Hi there,

On Tue, Nov 11, 2008 at 5:57 AM, davy zhang <da*******@gmail.comwrote:
first here is my basic idea is every actor holds their own msg queue,
the process function will handle the message as soon as the dispatcher
object put the message in.
Using stackless, every tasklet can have a channel which it uses to communicate
with other tasklets. The tasklet is blocked until there's something on
the channel
to receive.
This idea naturally leads me to place every actor in a separate thread
waiting for msg
You can have actors with many separate tasklets waiting for messages, still
being relatively lightweight, meaning you can run thousands of tasklets without
serious lack of performance.
but I found the tasklet is really a lined-up sequence , that means if
a tasklet blocked or do some time consuming calculation, the other
tasklets can not get the cpu slice
This is cooperative scheduling, which you can choose not to use with Stackless
(instead, use preemptive scheduling). If you determine that one particular
task is taking too much cpu, you can declaratively call stackless.schedule()
and put that task back to the scheduler queue and allow other tasks to
have a go.
so we must design very carefully to avoid the big job for single task
That's right - with cooperative scheduling careful design is the key.
I am just confused why the stackless python is said to be good at
concurrency program model or just I get a wrong idea to practice?
Stackless is an extremely lightweight way into concurrent programming.
I have personally used it in few projects and i quite like how lightweight
it is and how easy it is to write concurrent programs.

On the plus side, Stackless developers have plenty of examples and
common idioms of how Stackless should be used, which I highly recommend
you to check out. You might find a solution to your problem right there
amongst the examples.
Check it all out on http://www.stackless.com

--
a lex 13 x
http://www.a13x.info
Nov 11 '08 #1
0 1037

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Christian Tismer | last post by:
Howdy, I made a little demo of Stackless Zope. It is just a quick hack to see how things can work. The example is a long-running Python method which "prints" lines to the browser. The key to...
0
by: Christian Tismer | last post by:
Hi friends, for the last two+ weeks, I was hacking on the internals of stackless, in order to make things cleaner, smaller, more natural and more complete. This patch is a quite essential...
3
by: Martin Evans | last post by:
I've just been tasked with porting our desktop embedded Python support onto our existing CE offering. I've managed to compile the Python sources and have produced an armdbg420\python23.lib file. ...
2
by: Michael Hudson | last post by:
The PyPy development team has been busy working and we've now packaged our latest improvements, completed work and new experiments as version 0.9.0, our fourth public release. The highlights of...
14
by: fdu.xiaojf | last post by:
Hi, I have a program which will continue to run for several days. When it is running, I can't do anything except waiting because it takes over most of the CUP time. Is it possible that the...
3
by: archaegeo | last post by:
I am getting started in Python, and I have looked on both the stackless page and python.org and cannot find the answer to what I think is a simple problem. If I start the python command line or...
6
by: Justin T. | last post by:
Hi, I've been looking at stackless python a little bit, and it's awesome. My question is, why hasn't it been integrated into the upstream python tree? Does it cause problems with the current...
0
by: Linnorm | last post by:
I've written a port forwarding wrapper with paramiko for an app we use and it works fine except that it consumes way too much processor. (i.e. 25% +) I'm trying to write a stackless-based server...
1
by: davy zhang | last post by:
first here is my basic idea is every actor holds their own msg queue, the process function will handle the message as soon as the dispatcher object put the message in. This idea naturally leads...
0
by: davy zhang | last post by:
thank you very much for the advices! I asked myself many times, why not just use thread:D After some research I found thread has some fatal defects 1. thread number is limited by os, that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.