プレイ日記
Dustii DustiiWolf
It may look terribly BASIC, but it's what's inside that counts! And in this case, that means... PREEMPTION! What's that mean, you ask? That means this simple little program is using a form of MULTITASKING! Using a scheduler, it schedules equally the repeated printing of the alphabet to the console AND control of the pointer via input, allowing both to run effectively the same time!
6そうだね
プレイ済み
返信[1]
親投稿
Stewart segludian
Sounds very cool, I am impressed. Any code to show off?
1そうだね
プレイ済み
返信[2]
親投稿
Dustii DustiiWolf
Not at the moment. I want to wait till I have the core OS working before I publish anything. But I will explain the basics: It works by using an empty slot as the "thread space"; The software will load up the code for both "processes" into the "schedule", and the "scheduler" will replace the current "thread" with the next thread in the schedule and execute it.
1そうだね
プレイ済み
返信[3]
親投稿
Dustii DustiiWolf
Essentially, to adopt terms that closely meet the implementation, it's single-threaded (one command at a time), and similar to a 'time slice', the scheduler regularly runs, in-between threads, splitting processing time between process threads equally.
1そうだね
プレイ済み
返信[4]
親投稿
Dustii DustiiWolf
Due to SmileBASIC limitations, it's not perfect however; It cannot natively support IF statements and other multi-command blocks of code, so "wrappers" using COMMON DEF must be implemented. And as there is no true method of interruption, programs must be thoughtfully coded around the scheduler; a poorly placed wait can cause the whole system to freeze, making the scheduler merely preemptive-esque.
1そうだね
プレイ済み
返信[5]
親投稿
Dustii DustiiWolf
It's really somewhere in-between a Preemptive scheduler and Cooperative scheduler, as it doesn't truly interrupt thread (commands), but rather boils them down to single lines of code to facilitate the scheduler; But this also means that it isn't at the mercy of a process like Cooperative (unless WAIT is used), nor do processes need to be explicitly programmed to hand control over to the scheduler.
1そうだね
プレイ済み