Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 22.6 ('Preemptive Threads')
Instant purchase and download via GumRoad!

FEATURE

Testing Preemptive Threading

Is It Really Faster?

Issue: 22.6 (November/December 2024)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 29,296
Starting Page Number: 40
Article Number: 22606
Resource File(s):

Download Icon project22606.zip Updated: 2024-10-31 23:47:18

Related Web Link(s):

http://www.xdevmag.com/browse/19.1/19104
http://www.xdevmag.com/browse/12.3/12310/
http://www.xdevmag.com/browse/17.1/17107/

Excerpt of article text...

Back in the days when computers only had a single processor, Xojo's cooperative multitasking was sufficient. But these days, all CPUs contain multiple cores. If you can harness those additional cores, your program can complete complex tasks much faster.

Xojo's first attempt to support multicore processing was via Workers (see "Working with Workers" in xDev 19.1, http://www.xdevmag.com/browse/19.1/19104). Workers are essentially separate console apps that are independent of your main program and can therefore run on their own core.

While this approach is not unreasonable, Workers are not easy to use. Console apps themselves are extremely limited, and passing data to and from them via your main app is incredibly complicated. When testing Workers, I discovered that the overhead of dealing with them can often make them slower than the traditional approach!

My conclusion was that Workers are only useful in extreme situations.

But finally, with Xojo 2024 Release 3, we have true preemptive threads! These threads can run on their own core, if available, and while not immune to problems, they are far easier to use than Workers.

What Are Threads?

...End of Excerpt. Please purchase the magazine to read the full article.