25 กุมภาพันธ์ 2560

Published กุมภาพันธ์ 25, 2560 by with 0 comment

microthreads ใน Python

CPython ณ ปัจจุบันนี้ยังไม่สนับสนุน microthreads แต่มีความพยายามที่จะทำให้ CPython สนับสนุน microthreads คือ Stackless Python

Stackless Python


Stackless Python เป็นสาขาการพัฒนาของ CPython ที่ทำให้ CPython สนับสนุน microthreads เนื่องจาก CPython ไม่สนับสนุน microthreads

ทำไม CPython ถึงไม่สนับสนุน microthreads ?
ย้อนกลับไปเมื่อปี ค.ศ.2000 ได้มีการเสนอ "PEP 219 -- Stackless Python" (https://www.python.org/dev/peps/pep-0219/) เพื่อให้แกนกลาง Python สนับสนุน generators, microthreads และ coroutines แต่ไม่ได้รับการสนับสนุนเท่าไรจากชุมชนนักพัฒนาภาษา Python ([Python-Dev] comments on PEP 219 : https://mail.python.org/pipermail/python-dev/2001-March/013519.html)

Stackless Python จึงกำเนิดขึ้น โดย Stackless Python  ถูกใช้งานใน Eve Online  และตัว Stackless Python ได้มีการพัฒนาออกเป็นโมดูลที่ชื่อว่า  greenlet เพื่อให้ CPython สนับสนุน microthreads

หน้าหลัก https://bitbucket.org/stackless-dev/stackless
หน้าโหลด Stackless Python https://bitbucket.org/stackless-dev/stackless/wiki/Download
เอกสารการใช้งาน http://www.grant-olson.net/files/why_stackless.html

โมดูล greenlet สามารถดูรายละเอียดได้ที่ https://github.com/python-greenlet/greenlet

0 ความคิดเห็น:

แสดงความคิดเห็น

แสดงความคิดเห็นได้ครับ :)