|
1 | 1 | # TokenGate Concept |
2 | | - |
| 2 | + |
3 | 3 | *"Threading and Async Token Concurrency"* is a concept that |
4 | 4 | positions itself in the intersection of threading and asynchronous |
5 | 5 | programming. |
6 | 6 |
|
| 7 | +**Jump to:** [Introduction](#introduction) · [Concept Overview](#concept-overview) · [Conclusion](#conclusion) |
| 8 | + |
7 | 9 | --- |
8 | 10 |
|
9 | 11 | ## Introduction |
10 | 12 |
|
11 | | -In the realm of programming, threading and asynchronous compute |
12 | | -are two powerful concepts that enable developers to create efficient |
13 | | -and responsive applications. |
14 | | - |
15 | | -"Threading" refers to a program which completes multiple |
16 | | -threads of execution concurrently. |
17 | | - |
18 | | -On the other hand, "Async" is a programming architecture that allows |
19 | | -developers to write code that can handle multiple tasks simultaneously |
20 | | -on the main thread. |
| 13 | +In the realm of programming, threading and asynchronous compute |
| 14 | +are two powerful concepts that enable developers to create efficient |
| 15 | +and responsive applications. |
| 16 | + |
| 17 | +"Threading" refers to a program which completes multiple |
| 18 | +threads of execution concurrently. |
| 19 | + |
| 20 | +On the other hand, "Async" is a programming architecture that allows |
| 21 | +developers to write code that can handle multiple tasks simultaneously |
| 22 | +on the main thread. |
| 23 | + |
| 24 | +[↑ Top](#tokengate-concept) |
21 | 25 |
|
22 | 26 | --- |
23 | | - |
24 | | -## Concept Overview |
25 | | - |
26 | | -Threading and asynchronous compute are techniques that promote |
| 27 | + |
| 28 | +## Concept Overview |
| 29 | + |
| 30 | +Threading and asynchronous compute are techniques that promote |
27 | 31 | parallelism in execution of tasks, but they differ in their approach. |
28 | | -Threading involves creating multiple worker threads of execution within a |
29 | | -single process, while async is about non-blocking orchestration. |
30 | | - |
31 | | -The concept comes together when you apply tokenization logic to manage |
32 | | -concurrent tasks. Tokens can be used to represent individual tasks or |
| 32 | +Threading involves creating multiple worker threads of execution within a |
| 33 | +single process, while async is about non-blocking orchestration. |
| 34 | + |
| 35 | +The concept comes together when you apply tokenization logic to manage |
| 36 | +concurrent tasks. Tokens can be used to represent individual tasks or |
33 | 37 | operations, allowing for better control and coordination of concurrent |
34 | | -processes. |
| 38 | +processes. |
35 | 39 |
|
36 | 40 | Structurally tokens open a window of possibility for performing tasks |
37 | | -in a way that respects both async and threading paradigms, allowing for |
38 | | -a more flexible and efficient approach to concurrency. By leveraging |
39 | | -tokens, developers can create systems that are both responsive and |
40 | | -capable of handling a high volume of tasks without blocking the main |
| 41 | +in a way that respects both async and threading paradigms, allowing for |
| 42 | +a more flexible and efficient approach to concurrency. By leveraging |
| 43 | +tokens, developers can create systems that are both responsive and |
| 44 | +capable of handling a high volume of tasks without blocking the main |
41 | 45 | thread or overwhelming system resources. |
42 | | - |
| 46 | + |
43 | 47 | The architecture takes form over "worker mailboxes" and an "async event |
44 | 48 | loop" that manages the execution of tasks. If workers are given positions |
45 | | -to monitor a mailbox with an index, tokens can be managed through |
46 | | -execution via async distribution and threaded task consumption. |
| 49 | +to monitor a mailbox with an index, tokens can be managed through |
| 50 | +execution via async distribution and threaded task consumption. |
| 51 | + |
| 52 | +In practice putting Async and Threading together directly is functionally |
| 53 | +intricate, but by using tokens to manage the execution of tasks it's possible. |
47 | 54 |
|
48 | | -In practice putting Async and Threading together directly is functionally |
49 | | -intricate, but by using tokens to manage the execution of tasks it's possible. |
| 55 | +[↑ Top](#tokengate-concept) |
50 | 56 |
|
51 | 57 | --- |
52 | 58 |
|
53 | 59 | ## Conclusion |
54 | | -In conclusion, threading and asynchronous concurrency are powerful |
| 60 | + |
| 61 | +In conclusion, threading and asynchronous concurrency are powerful |
55 | 62 | concepts that can be effectively combined using tokens. |
56 | 63 |
|
57 | | -This concept is not simply about mixing threading and async. It is about |
58 | | -using tokens to bridge the strengths of both, allowing asynchronous |
59 | | -orchestration and structured threaded execution to work together in |
60 | | -one indexed system. |
| 64 | +This concept is not simply about mixing threading and async. It is about |
| 65 | +using tokens to bridge the strengths of both, allowing asynchronous |
| 66 | +orchestration and structured threaded execution to work together in |
| 67 | +one indexed system. |
| 68 | + |
| 69 | +When worker positioning and token flow are preserved correctly, |
| 70 | +the result is a new approach that doesn't fight the architectural |
| 71 | +strengths of either paradigm, but instead leverages them to create |
| 72 | +a more efficient and responsive system. |
| 73 | + |
| 74 | +To get deeper insight explore the following resources: |
61 | 75 |
|
62 | | -When worker positioning and token flow are preserved correctly, |
63 | | -the result is a new approach that doesn't fight the architectural |
64 | | -strengths of either paradigm, but instead leverages them to create |
65 | | -a more efficient and responsive system. |
| 76 | +- [Concurrency in Python](https://realpython.com/python-concurrency/) |
| 77 | +- [Asyncio in Python](https://realpython.com/async-io-python/) |
| 78 | +- [Python's Asyncio Library](https://docs.python.org/library/asyncio.html) |
| 79 | +- [Python's Threading Library](https://docs.python.org/library/threading.html) |
66 | 80 |
|
| 81 | +For usage examples and setup see: |
67 | 82 |
|
68 | | -To get deeper insight explore the following resources: |
69 | | -- "Concurrency in Python": https://realpython.com/python-concurrency/ |
70 | | -- "Asyncio in Python": https://realpython.com/async-io-python/ |
71 | | -- "Python's Asyncio Library": https://docs.python.org/library/asyncio.html |
72 | | -- "Python's Threading Library": https://docs.python.org/library/threading.html |
| 83 | +- [proof-of-concept.md](proof-of-concept.md) — full architecture walkthrough with benchmarks |
| 84 | +- [quick-proof.md](quick-proof.md) — focused proof of CPU, I/O, and mixed workloads |
73 | 85 |
|
74 | | -For usage examples and install see: (proof-of-concept.md or quick-proof.md) |
| 86 | +[↑ Top](#tokengate-concept) |
0 commit comments