Knowledge (XXG)

Talk:Stackless Python

Source đź“ť

176: 84: 53: 152: 22: 395:
A pure Python stack makes introspection possible, and additionally you can maintain a tree structure of stacks rather than a single stack. (The root of this tree is the C stack that starts off the first Python function/method.) The big win with the tree structure is, as Chris pointed out, is that you
239:
It is false in the sense that Stackless of course has continuations in their full sense, that is you can take a snapshot of a running program and start this several times, concurrently. It is not directly supported any longer, but running tasklets may be pickled. It is up to the user to load a stored
230:
Well this is true in the sense that the article includes old information. Continuations were the target of the first implementations, later on I changed to the less powerful but easier to understand taskletmodel, which is some kind of one-shot continuations. Actually, this appears to be the only kind
461:
But as it stands, now in 2018, CPython has achieved a lot of what Stackless had. It took 15 years, and they adopted a way more complicated way do squeeze all concurrency into generators, using "yield from" or the modern syntactic sugar, but it is far enough to say that Python 3.5 and up have solved
496:
Stackless isn't experimental now that's it's in 3 major commercial releases. The point about how much more easily conccurent processes are run as the major influence for choosing this product over regular Python needs expounding. A programmer would be better suited than I. Maybe look at Second
465:
What they have still not used is the feature of pickling program state. With Stackless, you can capture a running program, stop it and resume it later, or even on a different machine. That part of Stackless might still be a feature that could be adopted by CPython - of course with quite different
387:
In ordinary C-based Python, there is a commingling of the call stack for Python with the call stack for C. What I mean is that for one Python function or method to call another, it drops down into the C world and comes back up. State information connecting the caller and the callee lives on the C
360:
Essentially correct. "Stackless" just means that it uses a tree structure instead of stack(s) to keep track of the state of different threads. This allows cooperative-multitasking microthreads, and a few other interesting features. It's sort of a niche platform, because "micro" doesn't mean free.
376:
This sounds somewhat funny. Where do the numbers come from? 20KB for what? Well, if you hit a special case and switch tasklets from inside a C extension, then you get more or less C stack crap to be saved, but the general case is much different: A few bytes, fust for the Python frames and a tiny
267:
And about the tasklets: I thought of a one-shot continuation because the continuation inside the tasklet is not restartable, but a different one after suspend/resume. But I think that makes no sense, it is actually a coroutine. I should probably be more aware of the literature.
595: 317:
Is it faster? More efficient? More secure? More suited for specific tasks where ordinary Python doesn't cut it? "It's Python, without the stack" isn't very informative. If this be clarified in the article, it'd be highly appreciated.
185: 67: 247:
Isn't it crucial for invoked continuations to refer to the same environment as they did when they were captured? I think most of the things continuations are used for are impossible if that isn't the case.
304:
Look, I fancy myself as a computer scientist even when I'm really a plain ordinary Sunday programmer who knows a lot of tiny little details but fails to understand the big picture at times. I know what a
250:
And about the tasklets: are they really one-shot continuations, or coroutines? In other words, can you invoke previously-captured continuations of a tasklet, or just suspend/resume the current tasklet?
590: 190: 585: 575: 290:
I think that talking to the author of the following article and reusing the bulk of it where it doesn't specifically apply to game programming would allow a more extensive entry here:
361:
Each task eats up something like 20KB, and the scheduler isn't very fast, so it starts adding up to a major performance hit after a couple thousand tasks (original research). --
600: 458:
That is the big difference: Stackless can modify the execution state, easily, because it is not blocking structures on the stack, but has it available as a data structure.
142: 560: 132: 570: 166: 240:
tasklet from disk multiple times. This is almost like full continuations, despite the fact that the variables are not shared between the instances.
555: 108: 565: 339:
Agreed that this is needed--as far as I can tell the number 1 (only?) reason to use Stackless over regular Python is because it supports
216:
posted by Christian Tismer to the Stackless Mailing list on March, 2004. Newer versions have light weight threads called tasklets. --
91: 58: 161: 63: 212:
I wish to mention that this artical is several years out of date. Stackless no longer supports continuations, as mentioned in a
605: 33: 580: 291: 329: 377:
tasklet structure, that's it. And why is the scheduler slow? It is at least 80 times faster than switching real threads.
481: 175: 39: 21: 313:
is, but this article fails to answer a rather big question why I wanted to read the article in first place:
469: 217: 516:
If no one objects, I'll try to write some examples that show Stackless's strengths versus vanilla Python.
104: 521: 264:
Yes, you are right, and I stand corrected. The cloning of tasklets cannot be compared with continuations.
107:
on Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
347:, with all the performance and complexity implications that entails. But I am not an expert on either! 536: 477: 273: 213: 413:
This is correct except for the stack introspection, which CPython supports without difficulty. (See
362: 532: 473: 389: 378: 348: 269: 502: 438: 325: 252: 292:
http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/
517: 420: 414: 549: 401: 432: 498: 320: 452:
Sure, CPython does some introspection. But it is not able to modify the structure.
426: 397: 151: 83: 52: 100: 540: 525: 506: 485: 441: 404: 365: 351: 333: 277: 255: 220: 396:
get fast light threads. You can see these and some other applications at
96: 243:
Christian Tismer, creator of Stackless Python -- 15:02, 18 August 2005
596:
Start-Class Free and open-source software articles of Low-importance
15: 343:. Regular Python only supports concurrency through multiple 174: 150: 591:
Low-importance Free and open-source software articles
95:, a collaborative effort to improve the coverage of 586:Start-Class Free and open-source software articles 576:Start-Class software articles of Low-importance 388:stack, unavailable to Python, so you can't do 531:That would be appreciated, please go ahead!-- 8: 497:Lifes developers' blogs for clues to this? 398:http://code.google.com/p/stacklessexamples/ 19: 601:All Free and open-source software articles 467: 47: 49: 296:Richard Tew, user of Stackless Python 231:of continuations commonly understood. 117:Knowledge (XXG):WikiProject Computing 7: 462:the concurrency problem quite well. 89:This article is within the scope of 38:It is of interest to the following 14: 561:Low-importance Computing articles 571:Low-importance software articles 518:LoknarGor-The Jack of All Trades 82: 51: 20: 137:This article has been rated as 556:Start-Class Computing articles 526:01:45, 21 September 2009 (UTC) 278:16:56, 26 September 2010 (UTC) 120:Template:WikiProject Computing 1: 566:Start-Class software articles 186:Free and open-source software 183:This article is supported by 159:This article is supported by 111:and see a list of open tasks. 68:Free and open-source software 486:16:23, 26 August 2018 (UTC) 622: 541:17:42, 12 March 2010 (UTC) 507:12:46, 5 August 2008 (UTC) 143:project's importance scale 442:00:14, 20 July 2007 (UTC) 405:17:49, 19 July 2007 (UTC) 366:20:54, 20 June 2007 (UTC) 352:16:28, 19 June 2007 (UTC) 256:10:10, 8 March 2006 (UTC) 221:17:42, 24 July 2005 (UTC) 182: 158: 136: 77: 46: 334:12:55, 30 May 2007 (UTC) 341:lightweight concurrency 606:All Computing articles 286:Expanding on this page 208:No more continuations? 179: 155: 105:information technology 28:This article is rated 581:All Software articles 178: 154: 92:WikiProject Computing 32:on Knowledge (XXG)'s 162:WikiProject Software 422:sys._current_frames 300:A glaring omission 180: 156: 123:Computing articles 34:content assessment 488: 472:comment added by 205: 204: 201: 200: 197: 196: 613: 435: 429: 423: 417: 315:what good it is? 235:partially false 218:Lenard Lindstrom 125: 124: 121: 118: 115: 86: 79: 78: 73: 70: 55: 48: 31: 25: 24: 16: 621: 620: 616: 615: 614: 612: 611: 610: 546: 545: 514: 494: 492:Page needs more 433: 427: 421: 415: 302: 288: 226:partially true 210: 122: 119: 116: 113: 112: 71: 61: 29: 12: 11: 5: 619: 617: 609: 608: 603: 598: 593: 588: 583: 578: 573: 568: 563: 558: 548: 547: 544: 543: 513: 510: 493: 490: 456: 455: 454: 453: 447: 446: 445: 444: 408: 407: 393: 384: 383: 382: 381: 371: 370: 369: 368: 355: 354: 301: 298: 287: 284: 283: 282: 281: 280: 265: 259: 258: 248: 209: 206: 203: 202: 199: 198: 195: 194: 191:Low-importance 181: 171: 170: 167:Low-importance 157: 147: 146: 139:Low-importance 135: 129: 128: 126: 109:the discussion 87: 75: 74: 72:Low‑importance 56: 44: 43: 37: 26: 13: 10: 9: 6: 4: 3: 2: 618: 607: 604: 602: 599: 597: 594: 592: 589: 587: 584: 582: 579: 577: 574: 572: 569: 567: 564: 562: 559: 557: 554: 553: 551: 542: 538: 534: 530: 529: 528: 527: 523: 519: 511: 509: 508: 504: 500: 491: 489: 487: 483: 479: 475: 471: 463: 459: 451: 450: 449: 448: 443: 440: 436: 430: 424: 418: 416:sys._getframe 412: 411: 410: 409: 406: 403: 399: 394: 391: 390:introspection 386: 385: 380: 375: 374: 373: 372: 367: 364: 359: 358: 357: 356: 353: 350: 349:rococo roboto 346: 342: 338: 337: 336: 335: 331: 327: 323: 322: 316: 312: 309:is, and what 308: 299: 297: 294: 293: 285: 279: 275: 271: 266: 263: 262: 261: 260: 257: 254: 249: 246: 245: 244: 241: 237: 236: 232: 228: 227: 223: 222: 219: 215: 207: 192: 189:(assessed as 188: 187: 177: 173: 172: 168: 165:(assessed as 164: 163: 153: 149: 148: 144: 140: 134: 131: 130: 127: 110: 106: 102: 98: 94: 93: 88: 85: 81: 80: 76: 69: 65: 60: 57: 54: 50: 45: 41: 35: 27: 23: 18: 17: 515: 495: 468:— Preceding 464: 460: 457: 439:Piet Delport 437:modules.) — 344: 340: 319: 314: 310: 306: 303: 295: 289: 253:Piet Delport 242: 238: 234: 233: 229: 225: 224: 211: 184: 160: 138: 90: 40:WikiProjects 30:Start-class 550:Categories 466:details. 425:, and the 434:traceback 345:processes 114:Computing 101:computing 97:computers 59:Computing 512:Examples 482:contribs 470:unsigned 402:WillWare 392:with it. 363:Nasarius 64:Software 499:Alatari 428:inspect 321:wwwwolf 214:message 141:on the 533:Tismer 474:Tismer 379:Tismer 330:growls 311:Python 270:Tismer 103:, and 36:scale. 400:. -- 326:barks 307:stack 537:talk 522:talk 503:talk 478:talk 431:and 419:and 274:talk 133:Low 552:: 539:) 524:) 505:) 484:) 480:• 332:) 318:-- 276:) 251:-- 193:). 169:). 99:, 66:/ 62:: 535:( 520:( 501:( 476:( 328:/ 324:( 272:( 145:. 42::

Index


content assessment
WikiProjects
WikiProject icon
Computing
Software
Free and open-source software
WikiProject icon
WikiProject Computing
computers
computing
information technology
the discussion
Low
project's importance scale
Taskforce icon
WikiProject Software
Low-importance
Taskforce icon
Free and open-source software
Low-importance
message
Lenard Lindstrom
17:42, 24 July 2005 (UTC)
Piet Delport
10:10, 8 March 2006 (UTC)
Tismer
talk
16:56, 26 September 2010 (UTC)
http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑